Commit 5872f3f6 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: drivers: Convert to snd_card_new() with a device pointer

Also remove superfluous snd_card_set_dev() calls.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 393aa9c1
...@@ -1142,8 +1142,8 @@ static int loopback_probe(struct platform_device *devptr) ...@@ -1142,8 +1142,8 @@ static int loopback_probe(struct platform_device *devptr)
int dev = devptr->id; int dev = devptr->id;
int err; int err;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
sizeof(struct loopback), &card); sizeof(struct loopback), &card);
if (err < 0) if (err < 0)
return err; return err;
loopback = card->private_data; loopback = card->private_data;
......
...@@ -1054,8 +1054,8 @@ static int snd_dummy_probe(struct platform_device *devptr) ...@@ -1054,8 +1054,8 @@ static int snd_dummy_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dummy), &card); sizeof(struct snd_dummy), &card);
if (err < 0) if (err < 0)
return err; return err;
dummy = card->private_data; dummy = card->private_data;
...@@ -1114,8 +1114,6 @@ static int snd_dummy_probe(struct platform_device *devptr) ...@@ -1114,8 +1114,6 @@ static int snd_dummy_probe(struct platform_device *devptr)
dummy_proc_init(dummy); dummy_proc_init(dummy);
snd_card_set_dev(card, &devptr->dev);
err = snd_card_register(card); err = snd_card_register(card);
if (err == 0) { if (err == 0) {
platform_set_drvdata(devptr, card); platform_set_drvdata(devptr, card);
......
...@@ -1280,7 +1280,8 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev) ...@@ -1280,7 +1280,8 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev)
if (!enable[dev]) if (!enable[dev])
return -ENOENT; return -ENOENT;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); err = snd_card_new(&pfdev->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0) if (err < 0)
return err; return err;
err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr);
...@@ -1310,8 +1311,6 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev) ...@@ -1310,8 +1311,6 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev)
(unsigned long)ml403_ac97cr->port, ml403_ac97cr->irq, (unsigned long)ml403_ac97cr->port, ml403_ac97cr->irq,
ml403_ac97cr->capture_irq, dev + 1); ml403_ac97cr->capture_irq, dev + 1);
snd_card_set_dev(card, &pfdev->dev);
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0) {
snd_card_free(card); snd_card_free(card);
......
...@@ -64,7 +64,8 @@ static struct platform_device *platform_devices[SNDRV_CARDS]; ...@@ -64,7 +64,8 @@ static struct platform_device *platform_devices[SNDRV_CARDS];
static int pnp_registered; static int pnp_registered;
static unsigned int snd_mpu401_devices; static unsigned int snd_mpu401_devices;
static int snd_mpu401_create(int dev, struct snd_card **rcard) static int snd_mpu401_create(struct device *devptr, int dev,
struct snd_card **rcard)
{ {
struct snd_card *card; struct snd_card *card;
int err; int err;
...@@ -73,7 +74,8 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard) ...@@ -73,7 +74,8 @@ 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;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0) if (err < 0)
return err; return err;
strcpy(card->driver, "MPU-401 UART"); strcpy(card->driver, "MPU-401 UART");
...@@ -114,10 +116,9 @@ static int snd_mpu401_probe(struct platform_device *devptr) ...@@ -114,10 +116,9 @@ static int snd_mpu401_probe(struct platform_device *devptr)
snd_printk(KERN_ERR "specify or disable IRQ\n"); snd_printk(KERN_ERR "specify or disable IRQ\n");
return -EINVAL; return -EINVAL;
} }
err = snd_mpu401_create(dev, &card); err = snd_mpu401_create(&devptr->dev, dev, &card);
if (err < 0) if (err < 0)
return err; return err;
snd_card_set_dev(card, &devptr->dev);
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
...@@ -194,14 +195,13 @@ static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, ...@@ -194,14 +195,13 @@ static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
err = snd_mpu401_pnp(dev, pnp_dev, id); err = snd_mpu401_pnp(dev, pnp_dev, id);
if (err < 0) if (err < 0)
return err; return err;
err = snd_mpu401_create(dev, &card); err = snd_mpu401_create(&pnp_dev->dev, dev, &card);
if (err < 0) if (err < 0)
return err; return err;
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
snd_card_set_dev(card, &pnp_dev->dev);
pnp_set_drvdata(pnp_dev, card); pnp_set_drvdata(pnp_dev, card);
snd_mpu401_devices++; snd_mpu401_devices++;
++dev; ++dev;
......
...@@ -697,7 +697,8 @@ static int snd_mtpav_probe(struct platform_device *dev) ...@@ -697,7 +697,8 @@ static int snd_mtpav_probe(struct platform_device *dev)
int err; int err;
struct mtpav *mtp_card; struct mtpav *mtp_card;
err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card); err = snd_card_new(&dev->dev, index, id, THIS_MODULE,
sizeof(*mtp_card), &card);
if (err < 0) if (err < 0)
return err; return err;
...@@ -732,7 +733,6 @@ static int snd_mtpav_probe(struct platform_device *dev) ...@@ -732,7 +733,6 @@ static int snd_mtpav_probe(struct platform_device *dev)
snd_mtpav_portscan(mtp_card); snd_mtpav_portscan(mtp_card);
snd_card_set_dev(card, &dev->dev);
err = snd_card_register(mtp_card->card); err = snd_card_register(mtp_card->card);
if (err < 0) if (err < 0)
goto __error; goto __error;
......
...@@ -959,7 +959,8 @@ static int snd_mts64_probe(struct platform_device *pdev) ...@@ -959,7 +959,8 @@ static int 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;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return err; return err;
...@@ -1009,8 +1010,6 @@ static int snd_mts64_probe(struct platform_device *pdev) ...@@ -1009,8 +1010,6 @@ static int snd_mts64_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, card); platform_set_drvdata(pdev, card);
snd_card_set_dev(card, &pdev->dev);
/* At this point card will be usable */ /* At this point card will be usable */
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_printd("Cannot register card\n"); snd_printd("Cannot register card\n");
......
...@@ -105,7 +105,7 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev) ...@@ -105,7 +105,7 @@ static int 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;
err = snd_card_create(index, id, THIS_MODULE, 0, &card); err = snd_card_new(dev, index, id, THIS_MODULE, 0, &card);
if (err < 0) if (err < 0)
return err; return err;
...@@ -127,8 +127,6 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev) ...@@ -127,8 +127,6 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
return err; return err;
} }
snd_card_set_dev(pcsp_chip.card, dev);
strcpy(card->driver, "PC-Speaker"); strcpy(card->driver, "PC-Speaker");
strcpy(card->shortname, "pcsp"); strcpy(card->shortname, "pcsp");
sprintf(card->longname, "Internal PC-Speaker at port 0x%x", sprintf(card->longname, "Internal PC-Speaker at port 0x%x",
......
...@@ -748,7 +748,8 @@ static int snd_portman_probe(struct platform_device *pdev) ...@@ -748,7 +748,8 @@ static int 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;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return err; return err;
...@@ -798,8 +799,6 @@ static int snd_portman_probe(struct platform_device *pdev) ...@@ -798,8 +799,6 @@ static int snd_portman_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, card); platform_set_drvdata(pdev, card);
snd_card_set_dev(card, &pdev->dev);
/* At this point card will be usable */ /* At this point card will be usable */
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_printd("Cannot register card\n"); snd_printd("Cannot register card\n");
......
...@@ -942,7 +942,8 @@ static int snd_serial_probe(struct platform_device *devptr) ...@@ -942,7 +942,8 @@ static int snd_serial_probe(struct platform_device *devptr)
return -ENODEV; return -ENODEV;
} }
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0) if (err < 0)
return err; return err;
...@@ -969,8 +970,6 @@ static int snd_serial_probe(struct platform_device *devptr) ...@@ -969,8 +970,6 @@ static int snd_serial_probe(struct platform_device *devptr)
uart->base, uart->base,
uart->irq); uart->irq);
snd_card_set_dev(card, &devptr->dev);
if ((err = snd_card_register(card)) < 0) if ((err = snd_card_register(card)) < 0)
goto _err; goto _err;
......
...@@ -90,8 +90,8 @@ static int snd_virmidi_probe(struct platform_device *devptr) ...@@ -90,8 +90,8 @@ static int snd_virmidi_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_virmidi), &card); sizeof(struct snd_card_virmidi), &card);
if (err < 0) if (err < 0)
return err; return err;
vmidi = card->private_data; vmidi = card->private_data;
...@@ -118,8 +118,6 @@ static int snd_virmidi_probe(struct platform_device *devptr) ...@@ -118,8 +118,6 @@ static int snd_virmidi_probe(struct platform_device *devptr)
strcpy(card->shortname, "VirMIDI"); strcpy(card->shortname, "VirMIDI");
sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
snd_card_set_dev(card, &devptr->dev);
if ((err = snd_card_register(card)) == 0) { if ((err = snd_card_register(card)) == 0) {
platform_set_drvdata(devptr, card); platform_set_drvdata(devptr, card);
return 0; return 0;
......
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