1
0
Fork 0

ALSA: Convert to snd_card_create() in other sound/*

Convert from snd_card_new() to the new snd_card_create() function
in other sound subdirectories.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
hifive-unleashed-5.1
Takashi Iwai 2008-12-28 16:45:02 +01:00 committed by Takashi Iwai
parent e58de7baf7
commit bd7dd77c2a
31 changed files with 111 additions and 103 deletions

View File

@ -23,9 +23,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
/* cannot be EEXIST due to usage in aoa_fabric_register */ /* cannot be EEXIST due to usage in aoa_fabric_register */
return -EBUSY; return -EBUSY;
alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card)); err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
if (!alsa_card) &alsa_card);
return -ENOMEM; if (err < 0)
return err;
aoa_card = alsa_card->private_data; aoa_card = alsa_card->private_data;
aoa_card->alsa_card = alsa_card; aoa_card->alsa_card = alsa_card;
alsa_card->dev = dev; alsa_card->dev = dev;

View File

@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
{ {
struct aaci *aaci; struct aaci *aaci;
struct snd_card *card; struct snd_card *card;
int err;
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(struct aaci)); THIS_MODULE, sizeof(struct aaci), &card);
if (card == NULL) if (err < 0)
return NULL; return NULL;
card->private_free = aaci_free_card; card->private_free = aaci_free_card;

View File

@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
struct snd_ac97_template ac97_template; struct snd_ac97_template ac97_template;
int ret; int ret;
ret = -ENOMEM; ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, 0, &card);
THIS_MODULE, 0); if (ret < 0)
if (!card)
goto err; goto err;
card->dev = &dev->dev; card->dev = &dev->dev;

View File

@ -887,9 +887,10 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr)
struct sa11xx_uda1341 *chip; struct sa11xx_uda1341 *chip;
/* register the soundcard */ /* register the soundcard */
card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341)); err = snd_card_create(-1, id, THIS_MODULE,
if (card == NULL) sizeof(struct sa11xx_uda1341), &card);
return -ENOMEM; if (err < 0)
return err;
chip = card->private_data; chip = card->private_data;
spin_lock_init(&chip->s[0].dma_lock); spin_lock_init(&chip->s[0].dma_lock);

View File

@ -588,10 +588,10 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dummy)); sizeof(struct snd_dummy), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
dummy = card->private_data; dummy = card->private_data;
dummy->card = card; dummy->card = card;
for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {

View File

@ -1279,9 +1279,9 @@ static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev)
if (!enable[dev]) if (!enable[dev])
return -ENOENT; return -ENOENT;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr);
if (err < 0) { if (err < 0) {
PDEBUG(INIT_FAILURE, "probe(): create failed!\n"); PDEBUG(INIT_FAILURE, "probe(): create failed!\n");

View File

@ -73,9 +73,9 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard)
snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n");
*rcard = NULL; *rcard = NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "MPU-401 UART"); strcpy(card->driver, "MPU-401 UART");
strcpy(card->shortname, card->driver); strcpy(card->shortname, card->driver);
sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);

View File

@ -696,9 +696,9 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
int err; int err;
struct mtpav *mtp_card; struct mtpav *mtp_card;
card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card)); err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
mtp_card = card->private_data; mtp_card = card->private_data;
spin_lock_init(&mtp_card->spinlock); spin_lock_init(&mtp_card->spinlock);

View File

@ -957,10 +957,10 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev)
if ((err = snd_mts64_probe_port(p)) < 0) if ((err = snd_mts64_probe_port(p)) < 0)
return err; return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return -ENOMEM; return err;
} }
strcpy(card->driver, DRIVER_NAME); strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, "ESI " CARD_NAME); strcpy(card->shortname, "ESI " CARD_NAME);

View File

@ -98,9 +98,9 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pcsp_chip.timer.function = pcsp_do_timer; pcsp_chip.timer.function = pcsp_do_timer;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
err = snd_pcsp_create(card); err = snd_pcsp_create(card);
if (err < 0) { if (err < 0) {

View File

@ -746,10 +746,10 @@ static int __devinit snd_portman_probe(struct platform_device *pdev)
if ((err = snd_portman_probe_port(p)) < 0) if ((err = snd_portman_probe_port(p)) < 0)
return err; return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return -ENOMEM; return err;
} }
strcpy(card->driver, DRIVER_NAME); strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, CARD_NAME); strcpy(card->shortname, CARD_NAME);

View File

@ -936,9 +936,9 @@ static int __devinit snd_serial_probe(struct platform_device *devptr)
return -ENODEV; return -ENODEV;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "Serial"); strcpy(card->driver, "Serial");
strcpy(card->shortname, "Serial MIDI (UART16550A)"); strcpy(card->shortname, "Serial MIDI (UART16550A)");

View File

@ -90,10 +90,10 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_virmidi)); sizeof(struct snd_card_virmidi), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
vmidi = (struct snd_card_virmidi *)card->private_data; vmidi = (struct snd_card_virmidi *)card->private_data;
vmidi->card = card; vmidi->card = card;

View File

@ -636,9 +636,10 @@ au1000_init(void)
struct snd_card *card; struct snd_card *card;
struct snd_au1000 *au1000; struct snd_au1000 *au1000;
card = snd_card_new(-1, "AC97", THIS_MODULE, sizeof(struct snd_au1000)); err = snd_card_create(-1, "AC97", THIS_MODULE,
if (card == NULL) sizeof(struct snd_au1000), &card);
return -ENOMEM; if (err < 0)
return err;
card->private_free = snd_au1000_free; card->private_free = snd_au1000_free;
au1000 = card->private_data; au1000 = card->private_data;

View File

@ -878,9 +878,9 @@ static int __devinit hal2_probe(struct platform_device *pdev)
struct snd_hal2 *chip; struct snd_hal2 *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = hal2_create(card, &chip); err = hal2_create(card, &chip);
if (err < 0) { if (err < 0) {

View File

@ -936,9 +936,9 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
struct snd_sgio2audio *chip; struct snd_sgio2audio *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_sgio2audio_create(card, &chip); err = snd_sgio2audio_create(card, &chip);
if (err < 0) { if (err < 0) {

View File

@ -975,9 +975,9 @@ snd_harmony_probe(struct parisc_device *padev)
struct snd_card *card; struct snd_card *card;
struct snd_harmony *h; struct snd_harmony *h;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_harmony_create(card, padev, &h); err = snd_harmony_create(card, padev, &h);
if (err < 0) if (err < 0)

View File

@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device)
*/ */
static int snd_pdacf_probe(struct pcmcia_device *link) static int snd_pdacf_probe(struct pcmcia_device *link)
{ {
int i; int i, err;
struct snd_pdacf *pdacf; struct snd_pdacf *pdacf;
struct snd_card *card; struct snd_card *card;
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
@ -112,10 +112,10 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
return -ENODEV; /* disabled explicitly */ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */ /* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0); err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
return -ENOMEM; return err;
} }
pdacf = snd_pdacf_create(card); pdacf = snd_pdacf_create(card);

View File

@ -292,7 +292,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_vxpocket *vxp; struct snd_vxpocket *vxp;
int i; int i, err;
/* find an empty slot from the card list */ /* find an empty slot from the card list */
for (i = 0; i < SNDRV_CARDS; i++) { for (i = 0; i < SNDRV_CARDS; i++) {
@ -307,10 +307,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
return -ENODEV; /* disabled explicitly */ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */ /* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0); err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
return -ENOMEM; return err;
} }
vxp = snd_vxpocket_new(card, ibl[i], p_dev); vxp = snd_vxpocket_new(card, ibl[i], p_dev);

View File

@ -58,9 +58,9 @@ static int __init snd_pmac_probe(struct platform_device *devptr)
char *name_ext; char *name_ext;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_pmac_new(card, &chip)) < 0) if ((err = snd_pmac_new(card, &chip)) < 0)
goto __error; goto __error;

View File

@ -969,11 +969,9 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
} }
/* create card instance */ /* create card instance */
the_card.card = snd_card_new(index, id, THIS_MODULE, 0); ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card);
if (!the_card.card) { if (ret < 0)
ret = -ENXIO;
goto clean_irq; goto clean_irq;
}
strcpy(the_card.card->driver, "PS3"); strcpy(the_card.card->driver, "PS3");
strcpy(the_card.card->shortname, "PS3"); strcpy(the_card.card->shortname, "PS3");

View File

@ -609,11 +609,11 @@ static int __devinit snd_aica_probe(struct platform_device *devptr)
dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL); dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
if (unlikely(!dreamcastcard)) if (unlikely(!dreamcastcard))
return -ENOMEM; return -ENOMEM;
dreamcastcard->card = err = snd_card_create(index, SND_AICA_DRIVER, THIS_MODULE, 0,
snd_card_new(index, SND_AICA_DRIVER, THIS_MODULE, 0); &dreamcastcard->card);
if (unlikely(!dreamcastcard->card)) { if (unlikely(err < 0)) {
kfree(dreamcastcard); kfree(dreamcastcard);
return -ENODEV; return err;
} }
strcpy(dreamcastcard->card->driver, "snd_aica"); strcpy(dreamcastcard->card->driver, "snd_aica");
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);

View File

@ -1311,17 +1311,17 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
{ {
struct snd_soc_codec *codec = socdev->codec; struct snd_soc_codec *codec = socdev->codec;
struct snd_soc_card *card = socdev->card; struct snd_soc_card *card = socdev->card;
int ret = 0, i; int ret, i;
mutex_lock(&codec->mutex); mutex_lock(&codec->mutex);
/* register a sound card */ /* register a sound card */
codec->card = snd_card_new(idx, xid, codec->owner, 0); ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card);
if (!codec->card) { if (ret < 0) {
printk(KERN_ERR "asoc: can't create sound card for codec %s\n", printk(KERN_ERR "asoc: can't create sound card for codec %s\n",
codec->name); codec->name);
mutex_unlock(&codec->mutex); mutex_unlock(&codec->mutex);
return -ENODEV; return ret;
} }
codec->card->dev = socdev->dev; codec->card->dev = socdev->dev;

View File

@ -1018,9 +1018,10 @@ static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_de
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev_num], id[dev_num], THIS_MODULE, 0); err = snd_card_create(index[dev_num], id[dev_num], THIS_MODULE, 0,
if (card == NULL) &card);
return -ENOMEM; if (err < 0)
return err;
strcpy(card->driver, "AMD7930"); strcpy(card->driver, "AMD7930");
strcpy(card->shortname, "Sun AMD7930"); strcpy(card->shortname, "Sun AMD7930");

View File

@ -1563,6 +1563,7 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_cs4231 *chip; struct snd_cs4231 *chip;
int err;
*rcard = NULL; *rcard = NULL;
@ -1574,10 +1575,10 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cs4231)); sizeof(struct snd_cs4231), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "CS4231"); strcpy(card->driver, "CS4231");
strcpy(card->shortname, "Sun CS4231"); strcpy(card->shortname, "Sun CS4231");

View File

@ -2612,10 +2612,10 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id
return -ENODEV; return -ENODEV;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dbri)); sizeof(struct snd_dbri), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "DBRI"); strcpy(card->driver, "DBRI");
strcpy(card->shortname, "Sun DBRI"); strcpy(card->shortname, "Sun DBRI");

View File

@ -965,12 +965,11 @@ static int __devinit snd_at73c213_probe(struct spi_device *spi)
return PTR_ERR(board->dac_clk); return PTR_ERR(board->dac_clk);
} }
retval = -ENOMEM;
/* Allocate "card" using some unused identifiers. */ /* Allocate "card" using some unused identifiers. */
snprintf(id, sizeof id, "at73c213_%d", board->ssc_id); snprintf(id, sizeof id, "at73c213_%d", board->ssc_id);
card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct snd_at73c213)); retval = snd_card_create(-1, id, THIS_MODULE,
if (!card) sizeof(struct snd_at73c213), &card);
if (retval < 0)
goto out; goto out;
chip = card->private_data; chip = card->private_data;

View File

@ -339,6 +339,7 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
static struct snd_card* create_card(struct usb_device* usb_dev) static struct snd_card* create_card(struct usb_device* usb_dev)
{ {
int devnum; int devnum;
int err;
struct snd_card *card; struct snd_card *card;
struct snd_usb_caiaqdev *dev; struct snd_usb_caiaqdev *dev;
@ -349,9 +350,9 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
if (devnum >= SNDRV_CARDS) if (devnum >= SNDRV_CARDS)
return NULL; return NULL;
card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
sizeof(struct snd_usb_caiaqdev)); sizeof(struct snd_usb_caiaqdev), &card);
if (!card) if (err < 0)
return NULL; return NULL;
dev = caiaqdev(card); dev = caiaqdev(card);

View File

@ -3463,10 +3463,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
return -ENXIO; return -ENXIO;
} }
card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR "cannot create card instance %d\n", idx); snd_printk(KERN_ERR "cannot create card instance %d\n", idx);
return -ENOMEM; return err;
} }
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL);

View File

@ -482,14 +482,16 @@ static struct snd_card *usx2y_create_card(struct usb_device *device)
{ {
int dev; int dev;
struct snd_card *card; struct snd_card *card;
int err;
for (dev = 0; dev < SNDRV_CARDS; ++dev) for (dev = 0; dev < SNDRV_CARDS; ++dev)
if (enable[dev] && !snd_us122l_card_used[dev]) if (enable[dev] && !snd_us122l_card_used[dev])
break; break;
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return NULL; return NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct us122l)); sizeof(struct us122l), &card);
if (!card) if (err < 0)
return NULL; return NULL;
snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; snd_us122l_card_used[US122L(card)->chip.index = dev] = 1;

View File

@ -337,13 +337,16 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device)
{ {
int dev; int dev;
struct snd_card * card; struct snd_card * card;
int err;
for (dev = 0; dev < SNDRV_CARDS; ++dev) for (dev = 0; dev < SNDRV_CARDS; ++dev)
if (enable[dev] && !snd_usX2Y_card_used[dev]) if (enable[dev] && !snd_usX2Y_card_used[dev])
break; break;
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return NULL; return NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev)); err = snd_card_create(index[dev], id[dev], THIS_MODULE,
if (!card) sizeof(struct usX2Ydev), &card);
if (err < 0)
return NULL; return NULL;
snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1;
card->private_free = snd_usX2Y_card_private_free; card->private_free = snd_usX2Y_card_private_free;