diff options
author | Rene Herman <rene.herman@keyaccess.nl> | 2006-04-11 08:09:37 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-04-12 05:55:32 -0400 |
commit | dcccdd938ef0c5d96145957217b814b14bd46cdc (patch) | |
tree | 8522ad7957ee85a7f0ab53f776afee8a05795be7 /sound | |
parent | d0ac642d76c79c5cc673c4cdfe43e926379784e1 (diff) |
[ALSA] unregister platform device again if probe was unsuccessful
Unregister the platform device again if the probe was unsuccessful.
This restores the behaviour of not loading the driver on probe() failure.
Signed-off-by: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 4 | ||||
-rw-r--r-- | sound/isa/adlib.c | 11 | ||||
-rw-r--r-- | sound/isa/cmi8330.c | 4 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231.c | 4 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 4 | ||||
-rw-r--r-- | sound/isa/es1688/es1688.c | 4 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusclassic.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusextreme.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 4 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 4 | ||||
-rw-r--r-- | sound/isa/opti9xx/miro.c | 7 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 7 | ||||
-rw-r--r-- | sound/isa/sb/sb16.c | 4 | ||||
-rw-r--r-- | sound/isa/sb/sb8.c | 4 | ||||
-rw-r--r-- | sound/isa/sgalaxy.c | 4 | ||||
-rw-r--r-- | sound/isa/sscape.c | 4 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 4 |
19 files changed, 81 insertions, 8 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 1f460eb402a3..99908e44124d 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c | |||
@@ -195,6 +195,10 @@ static int __init alsa_card_ad1848_init(void) | |||
195 | i, NULL, 0); | 195 | i, NULL, 0); |
196 | if (IS_ERR(device)) | 196 | if (IS_ERR(device)) |
197 | continue; | 197 | continue; |
198 | if (!platform_get_drvdata(device)) { | ||
199 | platform_device_unregister(device); | ||
200 | continue; | ||
201 | } | ||
198 | devices[i] = device; | 202 | devices[i] = device; |
199 | cards++; | 203 | cards++; |
200 | } | 204 | } |
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index a253a14e6a45..1124344ed948 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c | |||
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device) | |||
43 | struct snd_card *card; | 43 | struct snd_card *card; |
44 | struct snd_opl3 *opl3; | 44 | struct snd_opl3 *opl3; |
45 | 45 | ||
46 | int error; | 46 | int error, i = device->id; |
47 | int i = device->id; | ||
48 | 47 | ||
49 | if (port[i] == SNDRV_AUTO_PORT) { | 48 | if (port[i] == SNDRV_AUTO_PORT) { |
50 | snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); | 49 | snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); |
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device) | |||
95 | return 0; | 94 | return 0; |
96 | 95 | ||
97 | out1: snd_card_free(card); | 96 | out1: snd_card_free(card); |
98 | out0: error = -EINVAL; /* FIXME: should be the original error code */ | 97 | out0: return error; |
99 | return error; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | static int __devexit snd_adlib_remove(struct platform_device *device) | 100 | static int __devexit snd_adlib_remove(struct platform_device *device) |
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(void) | |||
134 | if (IS_ERR(device)) | 132 | if (IS_ERR(device)) |
135 | continue; | 133 | continue; |
136 | 134 | ||
135 | if (!platform_get_drvdata(device)) { | ||
136 | platform_device_unregister(device); | ||
137 | continue; | ||
138 | } | ||
139 | |||
137 | devices[i] = device; | 140 | devices[i] = device; |
138 | cards++; | 141 | cards++; |
139 | } | 142 | } |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 35780b811d16..3c1e9fd56fe0 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -701,6 +701,10 @@ static int __init alsa_card_cmi8330_init(void) | |||
701 | i, NULL, 0); | 701 | i, NULL, 0); |
702 | if (IS_ERR(device)) | 702 | if (IS_ERR(device)) |
703 | continue; | 703 | continue; |
704 | if (!platform_get_drvdata(device)) { | ||
705 | platform_device_unregister(device); | ||
706 | continue; | ||
707 | } | ||
704 | platform_devices[i] = device; | 708 | platform_devices[i] = device; |
705 | cards++; | 709 | cards++; |
706 | } | 710 | } |
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 073dac975679..397310f358b7 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c | |||
@@ -211,6 +211,10 @@ static int __init alsa_card_cs4231_init(void) | |||
211 | i, NULL, 0); | 211 | i, NULL, 0); |
212 | if (IS_ERR(device)) | 212 | if (IS_ERR(device)) |
213 | continue; | 213 | continue; |
214 | if (!platform_get_drvdata(device)) { | ||
215 | platform_device_unregister(device); | ||
216 | continue; | ||
217 | } | ||
214 | devices[i] = device; | 218 | devices[i] = device; |
215 | cards++; | 219 | cards++; |
216 | } | 220 | } |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index b07a62b76175..f7fa779347ff 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -782,6 +782,10 @@ static int __init alsa_card_cs423x_init(void) | |||
782 | i, NULL, 0); | 782 | i, NULL, 0); |
783 | if (IS_ERR(device)) | 783 | if (IS_ERR(device)) |
784 | continue; | 784 | continue; |
785 | if (!platform_get_drvdata(device)) { | ||
786 | platform_device_unregister(device); | ||
787 | continue; | ||
788 | } | ||
785 | platform_devices[i] = device; | 789 | platform_devices[i] = device; |
786 | snd_cs423x_devices++; | 790 | snd_cs423x_devices++; |
787 | } | 791 | } |
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index d83d7104958f..e90689ee162f 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c | |||
@@ -215,6 +215,10 @@ static int __init alsa_card_es1688_init(void) | |||
215 | i, NULL, 0); | 215 | i, NULL, 0); |
216 | if (IS_ERR(device)) | 216 | if (IS_ERR(device)) |
217 | continue; | 217 | continue; |
218 | if (!platform_get_drvdata(device)) { | ||
219 | platform_device_unregister(device); | ||
220 | continue; | ||
221 | } | ||
218 | devices[i] = device; | 222 | devices[i] = device; |
219 | cards++; | 223 | cards++; |
220 | } | 224 | } |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 0da249bcf02b..a36ec1daa5cb 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -2393,6 +2393,10 @@ static int __init alsa_card_es18xx_init(void) | |||
2393 | i, NULL, 0); | 2393 | i, NULL, 0); |
2394 | if (IS_ERR(device)) | 2394 | if (IS_ERR(device)) |
2395 | continue; | 2395 | continue; |
2396 | if (!platform_get_drvdata(device)) { | ||
2397 | platform_device_unregister(device); | ||
2398 | continue; | ||
2399 | } | ||
2396 | platform_devices[i] = device; | 2400 | platform_devices[i] = device; |
2397 | cards++; | 2401 | cards++; |
2398 | } | 2402 | } |
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index ed34427c49db..37057a37dc30 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c | |||
@@ -255,6 +255,10 @@ static int __init alsa_card_gusclassic_init(void) | |||
255 | i, NULL, 0); | 255 | i, NULL, 0); |
256 | if (IS_ERR(device)) | 256 | if (IS_ERR(device)) |
257 | continue; | 257 | continue; |
258 | if (!platform_get_drvdata(device)) { | ||
259 | platform_device_unregister(device); | ||
260 | continue; | ||
261 | } | ||
258 | devices[i] = device; | 262 | devices[i] = device; |
259 | cards++; | 263 | cards++; |
260 | } | 264 | } |
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index aa312dee99c8..05852fcc613b 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c | |||
@@ -365,6 +365,10 @@ static int __init alsa_card_gusextreme_init(void) | |||
365 | i, NULL, 0); | 365 | i, NULL, 0); |
366 | if (IS_ERR(device)) | 366 | if (IS_ERR(device)) |
367 | continue; | 367 | continue; |
368 | if (!platform_get_drvdata(device)) { | ||
369 | platform_device_unregister(device); | ||
370 | continue; | ||
371 | } | ||
368 | devices[i] = device; | 372 | devices[i] = device; |
369 | cards++; | 373 | cards++; |
370 | } | 374 | } |
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index a733fabf653a..fcf2c8fe6f94 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -392,6 +392,10 @@ static int __init alsa_card_gusmax_init(void) | |||
392 | i, NULL, 0); | 392 | i, NULL, 0); |
393 | if (IS_ERR(device)) | 393 | if (IS_ERR(device)) |
394 | continue; | 394 | continue; |
395 | if (!platform_get_drvdata(device)) { | ||
396 | platform_device_unregister(device); | ||
397 | continue; | ||
398 | } | ||
395 | devices[i] = device; | 399 | devices[i] = device; |
396 | cards++; | 400 | cards++; |
397 | } | 401 | } |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 4be472ea99d2..4298d339e786 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -949,6 +949,10 @@ static int __init alsa_card_interwave_init(void) | |||
949 | i, NULL, 0); | 949 | i, NULL, 0); |
950 | if (IS_ERR(device)) | 950 | if (IS_ERR(device)) |
951 | continue; | 951 | continue; |
952 | if (!platform_get_drvdata(device)) { | ||
953 | platform_device_unregister(device); | ||
954 | continue; | ||
955 | } | ||
952 | platform_devices[i] = device; | 956 | platform_devices[i] = device; |
953 | cards++; | 957 | cards++; |
954 | } | 958 | } |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 02ae73ea0bad..6d889052c32c 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -964,6 +964,10 @@ static int __init alsa_card_opl3sa2_init(void) | |||
964 | i, NULL, 0); | 964 | i, NULL, 0); |
965 | if (IS_ERR(device)) | 965 | if (IS_ERR(device)) |
966 | continue; | 966 | continue; |
967 | if (!platform_get_drvdata(device)) { | ||
968 | platform_device_unregister(device); | ||
969 | continue; | ||
970 | } | ||
967 | platform_devices[i] = device; | 971 | platform_devices[i] = device; |
968 | snd_opl3sa2_devices++; | 972 | snd_opl3sa2_devices++; |
969 | } | 973 | } |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 09384d03dc31..83d64bc07ff0 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1436,8 +1436,11 @@ static int __init alsa_card_miro_init(void) | |||
1436 | if ((error = platform_driver_register(&snd_miro_driver)) < 0) | 1436 | if ((error = platform_driver_register(&snd_miro_driver)) < 0) |
1437 | return error; | 1437 | return error; |
1438 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | 1438 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); |
1439 | if (! IS_ERR(device)) | 1439 | if (! IS_ERR(device)) { |
1440 | return 0; | 1440 | if (platform_get_drvdata(device)) |
1441 | return 0; | ||
1442 | platform_device_unregister(device); | ||
1443 | } | ||
1441 | #ifdef MODULE | 1444 | #ifdef MODULE |
1442 | printk(KERN_ERR "no miro soundcard found\n"); | 1445 | printk(KERN_ERR "no miro soundcard found\n"); |
1443 | #endif | 1446 | #endif |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 65b28cbc0ebd..8ee0d70536f9 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -2099,8 +2099,11 @@ static int __init alsa_card_opti9xx_init(void) | |||
2099 | return error; | 2099 | return error; |
2100 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | 2100 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); |
2101 | if (!IS_ERR(device)) { | 2101 | if (!IS_ERR(device)) { |
2102 | snd_opti9xx_platform_device = device; | 2102 | if (platform_get_drvdata(device)) { |
2103 | return 0; | 2103 | snd_opti9xx_platform_device = device; |
2104 | return 0; | ||
2105 | } | ||
2106 | platform_device_unregister(device); | ||
2104 | } | 2107 | } |
2105 | platform_driver_unregister(&snd_opti9xx_driver); | 2108 | platform_driver_unregister(&snd_opti9xx_driver); |
2106 | } | 2109 | } |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 24fa190f33ac..6333f900eaee 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -722,6 +722,10 @@ static int __init alsa_card_sb16_init(void) | |||
722 | i, NULL, 0); | 722 | i, NULL, 0); |
723 | if (IS_ERR(device)) | 723 | if (IS_ERR(device)) |
724 | continue; | 724 | continue; |
725 | if (!platform_get_drvdata(device)) { | ||
726 | platform_device_unregister(device); | ||
727 | continue; | ||
728 | } | ||
725 | platform_devices[i] = device; | 729 | platform_devices[i] = device; |
726 | cards++; | 730 | cards++; |
727 | } | 731 | } |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index f75eeb05c1fa..141400c01426 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -266,6 +266,10 @@ static int __init alsa_card_sb8_init(void) | |||
266 | i, NULL, 0); | 266 | i, NULL, 0); |
267 | if (IS_ERR(device)) | 267 | if (IS_ERR(device)) |
268 | continue; | 268 | continue; |
269 | if (!platform_get_drvdata(device)) { | ||
270 | platform_device_unregister(device); | ||
271 | continue; | ||
272 | } | ||
269 | devices[i] = device; | 273 | devices[i] = device; |
270 | cards++; | 274 | cards++; |
271 | } | 275 | } |
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index f01a80a97ab8..09c8e8c6b5e3 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -368,6 +368,10 @@ static int __init alsa_card_sgalaxy_init(void) | |||
368 | i, NULL, 0); | 368 | i, NULL, 0); |
369 | if (IS_ERR(device)) | 369 | if (IS_ERR(device)) |
370 | continue; | 370 | continue; |
371 | if (!platform_get_drvdata(device)) { | ||
372 | platform_device_unregister(device); | ||
373 | continue; | ||
374 | } | ||
371 | devices[i] = device; | 375 | devices[i] = device; |
372 | cards++; | 376 | cards++; |
373 | } | 377 | } |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 532f6e0eff0b..d2a856f0fde2 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -1438,6 +1438,10 @@ static int __init sscape_manual_probe(void) | |||
1438 | i, NULL, 0); | 1438 | i, NULL, 0); |
1439 | if (IS_ERR(device)) | 1439 | if (IS_ERR(device)) |
1440 | continue; | 1440 | continue; |
1441 | if (!platform_get_drvdata(device)) { | ||
1442 | platform_device_unregister(device); | ||
1443 | continue; | ||
1444 | } | ||
1441 | platform_devices[i] = device; | 1445 | platform_devices[i] = device; |
1442 | } | 1446 | } |
1443 | return 0; | 1447 | return 0; |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index ed9d0173e80f..7ae86f82c3fa 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -724,6 +724,10 @@ static int __init alsa_card_wavefront_init(void) | |||
724 | i, NULL, 0); | 724 | i, NULL, 0); |
725 | if (IS_ERR(device)) | 725 | if (IS_ERR(device)) |
726 | continue; | 726 | continue; |
727 | if (!platform_get_drvdata(device)) { | ||
728 | platform_device_unregister(device); | ||
729 | continue; | ||
730 | } | ||
727 | platform_devices[i] = device; | 731 | platform_devices[i] = device; |
728 | cards++; | 732 | cards++; |
729 | } | 733 | } |