Commit bd7dd77c by Takashi Iwai Committed by Takashi Iwai

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: 's avatarTakashi Iwai <tiwai@suse.de>
parent e58de7ba
......@@ -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 */
return -EBUSY;
alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card));
if (!alsa_card)
return -ENOMEM;
err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
&alsa_card);
if (err < 0)
return err;
aoa_card = alsa_card->private_data;
aoa_card->alsa_card = alsa_card;
alsa_card->dev = dev;
......
......@@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
{
struct aaci *aaci;
struct snd_card *card;
int err;
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(struct aaci));
if (card == NULL)
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(struct aaci), &card);
if (err < 0)
return NULL;
card->private_free = aaci_free_card;
......
......@@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
struct snd_ac97_template ac97_template;
int ret;
ret = -ENOMEM;
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0);
if (!card)
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
if (ret < 0)
goto err;
card->dev = &dev->dev;
......
......@@ -887,9 +887,10 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr)
struct sa11xx_uda1341 *chip;
/* register the soundcard */
card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(-1, id, THIS_MODULE,
sizeof(struct sa11xx_uda1341), &card);
if (err < 0)
return err;
chip = card->private_data;
spin_lock_init(&chip->s[0].dma_lock);
......
......@@ -588,10 +588,10 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
int idx, err;
int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dummy));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dummy), &card);
if (err < 0)
return err;
dummy = card->private_data;
dummy->card = card;
for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
......
......@@ -1279,9 +1279,9 @@ static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev)
if (!enable[dev])
return -ENOENT;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr);
if (err < 0) {
PDEBUG(INIT_FAILURE, "probe(): create failed!\n");
......
......@@ -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");
*rcard = NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
strcpy(card->driver, "MPU-401 UART");
strcpy(card->shortname, card->driver);
sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);
......
......@@ -696,9 +696,9 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
int err;
struct mtpav *mtp_card;
card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card));
if (! card)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card);
if (err < 0)
return err;
mtp_card = card->private_data;
spin_lock_init(&mtp_card->spinlock);
......
......@@ -957,10 +957,10 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev)
if ((err = snd_mts64_probe_port(p)) < 0)
return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL) {
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printd("Cannot create card\n");
return -ENOMEM;
return err;
}
strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, "ESI " CARD_NAME);
......
......@@ -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);
pcsp_chip.timer.function = pcsp_do_timer;
card = snd_card_new(index, id, THIS_MODULE, 0);
if (!card)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
err = snd_pcsp_create(card);
if (err < 0) {
......
......@@ -746,10 +746,10 @@ static int __devinit snd_portman_probe(struct platform_device *pdev)
if ((err = snd_portman_probe_port(p)) < 0)
return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL) {
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printd("Cannot create card\n");
return -ENOMEM;
return err;
}
strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, CARD_NAME);
......
......@@ -936,9 +936,9 @@ static int __devinit snd_serial_probe(struct platform_device *devptr)
return -ENODEV;
}
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
strcpy(card->driver, "Serial");
strcpy(card->shortname, "Serial MIDI (UART16550A)");
......
......@@ -90,10 +90,10 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr)
int idx, err;
int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_virmidi));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_virmidi), &card);
if (err < 0)
return err;
vmidi = (struct snd_card_virmidi *)card->private_data;
vmidi->card = card;
......
......@@ -636,9 +636,10 @@ au1000_init(void)
struct snd_card *card;
struct snd_au1000 *au1000;
card = snd_card_new(-1, "AC97", THIS_MODULE, sizeof(struct snd_au1000));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(-1, "AC97", THIS_MODULE,
sizeof(struct snd_au1000), &card);
if (err < 0)
return err;
card->private_free = snd_au1000_free;
au1000 = card->private_data;
......
......@@ -878,9 +878,9 @@ static int __devinit hal2_probe(struct platform_device *pdev)
struct snd_hal2 *chip;
int err;
card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
err = hal2_create(card, &chip);
if (err < 0) {
......
......@@ -936,9 +936,9 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
struct snd_sgio2audio *chip;
int err;
card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
err = snd_sgio2audio_create(card, &chip);
if (err < 0) {
......
......@@ -975,9 +975,9 @@ snd_harmony_probe(struct parisc_device *padev)
struct snd_card *card;
struct snd_harmony *h;
card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
err = snd_harmony_create(card, padev, &h);
if (err < 0)
......
......@@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device)
*/
static int snd_pdacf_probe(struct pcmcia_device *link)
{
int i;
int i, err;
struct snd_pdacf *pdacf;
struct snd_card *card;
static struct snd_device_ops ops = {
......@@ -112,10 +112,10 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
if (card == NULL) {
err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
return -ENOMEM;
return err;
}
pdacf = snd_pdacf_create(card);
......
......@@ -292,7 +292,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
{
struct snd_card *card;
struct snd_vxpocket *vxp;
int i;
int i, err;
/* find an empty slot from the card list */
for (i = 0; i < SNDRV_CARDS; i++) {
......@@ -307,10 +307,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
if (card == NULL) {
err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
return -ENOMEM;
return err;
}
vxp = snd_vxpocket_new(card, ibl[i], p_dev);
......
......@@ -58,9 +58,9 @@ static int __init snd_pmac_probe(struct platform_device *devptr)
char *name_ext;
int err;
card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
if ((err = snd_pmac_new(card, &chip)) < 0)
goto __error;
......
......@@ -969,11 +969,9 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
}
/* create card instance */
the_card.card = snd_card_new(index, id, THIS_MODULE, 0);
if (!the_card.card) {
ret = -ENXIO;
ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card);
if (ret < 0)
goto clean_irq;
}
strcpy(the_card.card->driver, "PS3");
strcpy(the_card.card->shortname, "PS3");
......
......@@ -609,11 +609,11 @@ static int __devinit snd_aica_probe(struct platform_device *devptr)
dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
if (unlikely(!dreamcastcard))
return -ENOMEM;
dreamcastcard->card =
snd_card_new(index, SND_AICA_DRIVER, THIS_MODULE, 0);
if (unlikely(!dreamcastcard->card)) {
err = snd_card_create(index, SND_AICA_DRIVER, THIS_MODULE, 0,
&dreamcastcard->card);
if (unlikely(err < 0)) {
kfree(dreamcastcard);
return -ENODEV;
return err;
}
strcpy(dreamcastcard->card->driver, "snd_aica");
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
......
......@@ -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_card *card = socdev->card;
int ret = 0, i;
int ret, i;
mutex_lock(&codec->mutex);
/* register a sound card */
codec->card = snd_card_new(idx, xid, codec->owner, 0);
if (!codec->card) {
ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card);
if (ret < 0) {
printk(KERN_ERR "asoc: can't create sound card for codec %s\n",
codec->name);
mutex_unlock(&codec->mutex);
return -ENODEV;
return ret;
}
codec->card->dev = socdev->dev;
......
......@@ -1018,9 +1018,10 @@ static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_de
return -ENOENT;
}
card = snd_card_new(index[dev_num], id[dev_num], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev_num], id[dev_num], THIS_MODULE, 0,
&card);
if (err < 0)
return err;
strcpy(card->driver, "AMD7930");
strcpy(card->shortname, "Sun AMD7930");
......
......@@ -1563,6 +1563,7 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
{
struct snd_card *card;
struct snd_cs4231 *chip;
int err;
*rcard = NULL;
......@@ -1574,10 +1575,10 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
return -ENOENT;
}
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cs4231));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cs4231), &card);
if (err < 0)
return err;
strcpy(card->driver, "CS4231");
strcpy(card->shortname, "Sun CS4231");
......
......@@ -2612,10 +2612,10 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id
return -ENODEV;
}
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dbri));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dbri), &card);
if (err < 0)
return err;
strcpy(card->driver, "DBRI");
strcpy(card->shortname, "Sun DBRI");
......
......@@ -965,12 +965,11 @@ static int __devinit snd_at73c213_probe(struct spi_device *spi)
return PTR_ERR(board->dac_clk);
}
retval = -ENOMEM;
/* Allocate "card" using some unused identifiers. */
snprintf(id, sizeof id, "at73c213_%d", board->ssc_id);
card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct snd_at73c213));
if (!card)
retval = snd_card_create(-1, id, THIS_MODULE,
sizeof(struct snd_at73c213), &card);
if (retval < 0)
goto out;
chip = card->private_data;
......
......@@ -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)
{
int devnum;
int err;
struct snd_card *card;
struct snd_usb_caiaqdev *dev;
......@@ -349,9 +350,9 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
if (devnum >= SNDRV_CARDS)
return NULL;
card = snd_card_new(index[devnum], id[devnum], THIS_MODULE,
sizeof(struct snd_usb_caiaqdev));
if (!card)
err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
sizeof(struct snd_usb_caiaqdev), &card);
if (err < 0)
return NULL;
dev = caiaqdev(card);
......
......@@ -3463,10 +3463,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
return -ENXIO;
}
card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0);
if (card == NULL) {
err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printk(KERN_ERR "cannot create card instance %d\n", idx);
return -ENOMEM;
return err;
}
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
......
......@@ -482,14 +482,16 @@ static struct snd_card *usx2y_create_card(struct usb_device *device)
{
int dev;
struct snd_card *card;
int err;
for (dev = 0; dev < SNDRV_CARDS; ++dev)
if (enable[dev] && !snd_us122l_card_used[dev])
break;
if (dev >= SNDRV_CARDS)
return NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct us122l));
if (!card)
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct us122l), &card);
if (err < 0)
return NULL;
snd_us122l_card_used[US122L(card)->chip.index = dev] = 1;
......
......@@ -337,13 +337,16 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device)
{
int dev;
struct snd_card * card;
int err;
for (dev = 0; dev < SNDRV_CARDS; ++dev)
if (enable[dev] && !snd_usX2Y_card_used[dev])
break;
if (dev >= SNDRV_CARDS)
return NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev));
if (!card)
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct usX2Ydev), &card);
if (err < 0)
return NULL;
snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1;
card->private_free = snd_usX2Y_card_private_free;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment