diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-01-29 06:59:08 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-12 04:58:20 -0500 |
commit | 5872f3f621f9f65342583a85ec93b00c0a697eda (patch) | |
tree | 6deaa1d968889986fcf84a38abb436961e613f60 | |
parent | 393aa9c1cc514774332d7bc861307a76206e358d (diff) |
ALSA: drivers: Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/drivers/aloop.c | 4 | ||||
-rw-r--r-- | sound/drivers/dummy.c | 6 | ||||
-rw-r--r-- | sound/drivers/ml403-ac97cr.c | 5 | ||||
-rw-r--r-- | sound/drivers/mpu401/mpu401.c | 12 | ||||
-rw-r--r-- | sound/drivers/mtpav.c | 4 | ||||
-rw-r--r-- | sound/drivers/mts64.c | 5 | ||||
-rw-r--r-- | sound/drivers/pcsp/pcsp.c | 4 | ||||
-rw-r--r-- | sound/drivers/portman2x4.c | 5 | ||||
-rw-r--r-- | sound/drivers/serial-u16550.c | 5 | ||||
-rw-r--r-- | sound/drivers/virmidi.c | 6 |
10 files changed, 23 insertions, 33 deletions
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index f7589923effa..2a16c86a60b3 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c | |||
@@ -1142,8 +1142,8 @@ static int loopback_probe(struct platform_device *devptr) | |||
1142 | int dev = devptr->id; | 1142 | int dev = devptr->id; |
1143 | int err; | 1143 | int err; |
1144 | 1144 | ||
1145 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 1145 | err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, |
1146 | sizeof(struct loopback), &card); | 1146 | sizeof(struct loopback), &card); |
1147 | if (err < 0) | 1147 | if (err < 0) |
1148 | return err; | 1148 | return err; |
1149 | loopback = card->private_data; | 1149 | loopback = card->private_data; |
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 915b4d7fbb23..fab90bd2bd51 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -1054,8 +1054,8 @@ static int snd_dummy_probe(struct platform_device *devptr) | |||
1054 | int idx, err; | 1054 | int idx, err; |
1055 | int dev = devptr->id; | 1055 | int dev = devptr->id; |
1056 | 1056 | ||
1057 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 1057 | err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, |
1058 | sizeof(struct snd_dummy), &card); | 1058 | sizeof(struct snd_dummy), &card); |
1059 | if (err < 0) | 1059 | if (err < 0) |
1060 | return err; | 1060 | return err; |
1061 | dummy = card->private_data; | 1061 | dummy = card->private_data; |
@@ -1114,8 +1114,6 @@ static int snd_dummy_probe(struct platform_device *devptr) | |||
1114 | 1114 | ||
1115 | dummy_proc_init(dummy); | 1115 | dummy_proc_init(dummy); |
1116 | 1116 | ||
1117 | snd_card_set_dev(card, &devptr->dev); | ||
1118 | |||
1119 | err = snd_card_register(card); | 1117 | err = snd_card_register(card); |
1120 | if (err == 0) { | 1118 | if (err == 0) { |
1121 | platform_set_drvdata(devptr, card); | 1119 | platform_set_drvdata(devptr, card); |
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 95ea4a153ea4..33ed76530d0b 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c | |||
@@ -1280,7 +1280,8 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev) | |||
1280 | if (!enable[dev]) | 1280 | if (!enable[dev]) |
1281 | return -ENOENT; | 1281 | return -ENOENT; |
1282 | 1282 | ||
1283 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 1283 | err = snd_card_new(&pfdev->dev, index[dev], id[dev], THIS_MODULE, |
1284 | 0, &card); | ||
1284 | if (err < 0) | 1285 | if (err < 0) |
1285 | return err; | 1286 | return err; |
1286 | err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); | 1287 | err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); |
@@ -1310,8 +1311,6 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev) | |||
1310 | (unsigned long)ml403_ac97cr->port, ml403_ac97cr->irq, | 1311 | (unsigned long)ml403_ac97cr->port, ml403_ac97cr->irq, |
1311 | ml403_ac97cr->capture_irq, dev + 1); | 1312 | ml403_ac97cr->capture_irq, dev + 1); |
1312 | 1313 | ||
1313 | snd_card_set_dev(card, &pfdev->dev); | ||
1314 | |||
1315 | err = snd_card_register(card); | 1314 | err = snd_card_register(card); |
1316 | if (err < 0) { | 1315 | if (err < 0) { |
1317 | snd_card_free(card); | 1316 | snd_card_free(card); |
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 90a3a7b38a2a..83014b83a44e 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c | |||
@@ -64,7 +64,8 @@ static struct platform_device *platform_devices[SNDRV_CARDS]; | |||
64 | static int pnp_registered; | 64 | static int pnp_registered; |
65 | static unsigned int snd_mpu401_devices; | 65 | static unsigned int snd_mpu401_devices; |
66 | 66 | ||
67 | static int snd_mpu401_create(int dev, struct snd_card **rcard) | 67 | static int snd_mpu401_create(struct device *devptr, int dev, |
68 | struct snd_card **rcard) | ||
68 | { | 69 | { |
69 | struct snd_card *card; | 70 | struct snd_card *card; |
70 | int err; | 71 | int err; |
@@ -73,7 +74,8 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard) | |||
73 | snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); | 74 | snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); |
74 | 75 | ||
75 | *rcard = NULL; | 76 | *rcard = NULL; |
76 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 77 | err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE, |
78 | 0, &card); | ||
77 | if (err < 0) | 79 | if (err < 0) |
78 | return err; | 80 | return err; |
79 | strcpy(card->driver, "MPU-401 UART"); | 81 | strcpy(card->driver, "MPU-401 UART"); |
@@ -114,10 +116,9 @@ static int snd_mpu401_probe(struct platform_device *devptr) | |||
114 | snd_printk(KERN_ERR "specify or disable IRQ\n"); | 116 | snd_printk(KERN_ERR "specify or disable IRQ\n"); |
115 | return -EINVAL; | 117 | return -EINVAL; |
116 | } | 118 | } |
117 | err = snd_mpu401_create(dev, &card); | 119 | err = snd_mpu401_create(&devptr->dev, dev, &card); |
118 | if (err < 0) | 120 | if (err < 0) |
119 | return err; | 121 | return err; |
120 | snd_card_set_dev(card, &devptr->dev); | ||
121 | if ((err = snd_card_register(card)) < 0) { | 122 | if ((err = snd_card_register(card)) < 0) { |
122 | snd_card_free(card); | 123 | snd_card_free(card); |
123 | return err; | 124 | return err; |
@@ -194,14 +195,13 @@ static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, | |||
194 | err = snd_mpu401_pnp(dev, pnp_dev, id); | 195 | err = snd_mpu401_pnp(dev, pnp_dev, id); |
195 | if (err < 0) | 196 | if (err < 0) |
196 | return err; | 197 | return err; |
197 | err = snd_mpu401_create(dev, &card); | 198 | err = snd_mpu401_create(&pnp_dev->dev, dev, &card); |
198 | if (err < 0) | 199 | if (err < 0) |
199 | return err; | 200 | return err; |
200 | if ((err = snd_card_register(card)) < 0) { | 201 | if ((err = snd_card_register(card)) < 0) { |
201 | snd_card_free(card); | 202 | snd_card_free(card); |
202 | return err; | 203 | return err; |
203 | } | 204 | } |
204 | snd_card_set_dev(card, &pnp_dev->dev); | ||
205 | pnp_set_drvdata(pnp_dev, card); | 205 | pnp_set_drvdata(pnp_dev, card); |
206 | snd_mpu401_devices++; | 206 | snd_mpu401_devices++; |
207 | ++dev; | 207 | ++dev; |
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index e5ec7eb27dec..4b66c7f22af7 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -697,7 +697,8 @@ static int snd_mtpav_probe(struct platform_device *dev) | |||
697 | int err; | 697 | int err; |
698 | struct mtpav *mtp_card; | 698 | struct mtpav *mtp_card; |
699 | 699 | ||
700 | err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card); | 700 | err = snd_card_new(&dev->dev, index, id, THIS_MODULE, |
701 | sizeof(*mtp_card), &card); | ||
701 | if (err < 0) | 702 | if (err < 0) |
702 | return err; | 703 | return err; |
703 | 704 | ||
@@ -732,7 +733,6 @@ static int snd_mtpav_probe(struct platform_device *dev) | |||
732 | 733 | ||
733 | snd_mtpav_portscan(mtp_card); | 734 | snd_mtpav_portscan(mtp_card); |
734 | 735 | ||
735 | snd_card_set_dev(card, &dev->dev); | ||
736 | err = snd_card_register(mtp_card->card); | 736 | err = snd_card_register(mtp_card->card); |
737 | if (err < 0) | 737 | if (err < 0) |
738 | goto __error; | 738 | goto __error; |
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index 4e0dd22ba08e..f5fd448dbc57 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c | |||
@@ -959,7 +959,8 @@ static int snd_mts64_probe(struct platform_device *pdev) | |||
959 | if ((err = snd_mts64_probe_port(p)) < 0) | 959 | if ((err = snd_mts64_probe_port(p)) < 0) |
960 | return err; | 960 | return err; |
961 | 961 | ||
962 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 962 | err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, |
963 | 0, &card); | ||
963 | if (err < 0) { | 964 | if (err < 0) { |
964 | snd_printd("Cannot create card\n"); | 965 | snd_printd("Cannot create card\n"); |
965 | return err; | 966 | return err; |
@@ -1009,8 +1010,6 @@ static int snd_mts64_probe(struct platform_device *pdev) | |||
1009 | 1010 | ||
1010 | platform_set_drvdata(pdev, card); | 1011 | platform_set_drvdata(pdev, card); |
1011 | 1012 | ||
1012 | snd_card_set_dev(card, &pdev->dev); | ||
1013 | |||
1014 | /* At this point card will be usable */ | 1013 | /* At this point card will be usable */ |
1015 | if ((err = snd_card_register(card)) < 0) { | 1014 | if ((err = snd_card_register(card)) < 0) { |
1016 | snd_printd("Cannot register card\n"); | 1015 | snd_printd("Cannot register card\n"); |
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index 328bd29264ce..36808cdab06f 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -105,7 +105,7 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev) | |||
105 | hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 105 | hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
106 | pcsp_chip.timer.function = pcsp_do_timer; | 106 | pcsp_chip.timer.function = pcsp_do_timer; |
107 | 107 | ||
108 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); | 108 | err = snd_card_new(dev, index, id, THIS_MODULE, 0, &card); |
109 | if (err < 0) | 109 | if (err < 0) |
110 | return err; | 110 | return err; |
111 | 111 | ||
@@ -127,8 +127,6 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev) | |||
127 | return err; | 127 | return err; |
128 | } | 128 | } |
129 | 129 | ||
130 | snd_card_set_dev(pcsp_chip.card, dev); | ||
131 | |||
132 | strcpy(card->driver, "PC-Speaker"); | 130 | strcpy(card->driver, "PC-Speaker"); |
133 | strcpy(card->shortname, "pcsp"); | 131 | strcpy(card->shortname, "pcsp"); |
134 | sprintf(card->longname, "Internal PC-Speaker at port 0x%x", | 132 | sprintf(card->longname, "Internal PC-Speaker at port 0x%x", |
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 991018df7131..78ccfa455527 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c | |||
@@ -748,7 +748,8 @@ static int snd_portman_probe(struct platform_device *pdev) | |||
748 | if ((err = snd_portman_probe_port(p)) < 0) | 748 | if ((err = snd_portman_probe_port(p)) < 0) |
749 | return err; | 749 | return err; |
750 | 750 | ||
751 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 751 | err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, |
752 | 0, &card); | ||
752 | if (err < 0) { | 753 | if (err < 0) { |
753 | snd_printd("Cannot create card\n"); | 754 | snd_printd("Cannot create card\n"); |
754 | return err; | 755 | return err; |
@@ -798,8 +799,6 @@ static int snd_portman_probe(struct platform_device *pdev) | |||
798 | 799 | ||
799 | platform_set_drvdata(pdev, card); | 800 | platform_set_drvdata(pdev, card); |
800 | 801 | ||
801 | snd_card_set_dev(card, &pdev->dev); | ||
802 | |||
803 | /* At this point card will be usable */ | 802 | /* At this point card will be usable */ |
804 | if ((err = snd_card_register(card)) < 0) { | 803 | if ((err = snd_card_register(card)) < 0) { |
805 | snd_printd("Cannot register card\n"); | 804 | snd_printd("Cannot register card\n"); |
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index e0bf5e77b43a..9ad4414fa25c 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c | |||
@@ -942,7 +942,8 @@ static int snd_serial_probe(struct platform_device *devptr) | |||
942 | return -ENODEV; | 942 | return -ENODEV; |
943 | } | 943 | } |
944 | 944 | ||
945 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 945 | err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, |
946 | 0, &card); | ||
946 | if (err < 0) | 947 | if (err < 0) |
947 | return err; | 948 | return err; |
948 | 949 | ||
@@ -969,8 +970,6 @@ static int snd_serial_probe(struct platform_device *devptr) | |||
969 | uart->base, | 970 | uart->base, |
970 | uart->irq); | 971 | uart->irq); |
971 | 972 | ||
972 | snd_card_set_dev(card, &devptr->dev); | ||
973 | |||
974 | if ((err = snd_card_register(card)) < 0) | 973 | if ((err = snd_card_register(card)) < 0) |
975 | goto _err; | 974 | goto _err; |
976 | 975 | ||
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index ace3879e8d96..b178724295f3 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c | |||
@@ -90,8 +90,8 @@ static int snd_virmidi_probe(struct platform_device *devptr) | |||
90 | int idx, err; | 90 | int idx, err; |
91 | int dev = devptr->id; | 91 | int dev = devptr->id; |
92 | 92 | ||
93 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 93 | err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, |
94 | sizeof(struct snd_card_virmidi), &card); | 94 | sizeof(struct snd_card_virmidi), &card); |
95 | if (err < 0) | 95 | if (err < 0) |
96 | return err; | 96 | return err; |
97 | vmidi = card->private_data; | 97 | vmidi = card->private_data; |
@@ -118,8 +118,6 @@ static int snd_virmidi_probe(struct platform_device *devptr) | |||
118 | strcpy(card->shortname, "VirMIDI"); | 118 | strcpy(card->shortname, "VirMIDI"); |
119 | sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); | 119 | sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); |
120 | 120 | ||
121 | snd_card_set_dev(card, &devptr->dev); | ||
122 | |||
123 | if ((err = snd_card_register(card)) == 0) { | 121 | if ((err = snd_card_register(card)) == 0) { |
124 | platform_set_drvdata(devptr, card); | 122 | platform_set_drvdata(devptr, card); |
125 | return 0; | 123 | return 0; |