aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es18xx.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-12-07 03:13:42 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:30:39 -0500
commitf7a9275d949cb0bf1f259a1546e52a0bf518151c (patch)
tree4d96d9b6196d43684903857ba676dc51bbde4026 /sound/isa/es18xx.c
parent416c1079d30f1a52399b96f6772e993274b774ae (diff)
[ALSA] unregister platform devices
Call platform_device_unregister() for all platform devices that we've registered. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/isa/es18xx.c')
-rw-r--r--sound/isa/es18xx.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 34d47132f082..bf5de0782eb0 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1877,6 +1877,9 @@ MODULE_PARM_DESC(dma1, "DMA 1 # for ES18xx driver.");
1877module_param_array(dma2, int, NULL, 0444); 1877module_param_array(dma2, int, NULL, 0444);
1878MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); 1878MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver.");
1879 1879
1880static struct platform_device *platform_devices[SNDRV_CARDS];
1881static int pnp_registered;
1882
1880#ifdef CONFIG_PNP 1883#ifdef CONFIG_PNP
1881 1884
1882static struct pnp_card_device_id snd_audiodrive_pnpids[] = { 1885static struct pnp_card_device_id snd_audiodrive_pnpids[] = {
@@ -2202,6 +2205,17 @@ static struct pnp_card_driver es18xx_pnpc_driver = {
2202}; 2205};
2203#endif /* CONFIG_PNP */ 2206#endif /* CONFIG_PNP */
2204 2207
2208static void __init_or_module snd_es18xx_unregister_all(void)
2209{
2210 int i;
2211
2212 if (pnp_registered)
2213 pnp_unregister_card_driver(&es18xx_pnpc_driver);
2214 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)
2215 platform_device_unregister(platform_devices[i]);
2216 platform_driver_unregister(&snd_es18xx_nonpnp_driver);
2217}
2218
2205static int __init alsa_card_es18xx_init(void) 2219static int __init alsa_card_es18xx_init(void)
2206{ 2220{
2207 int i, err, cards = 0; 2221 int i, err, cards = 0;
@@ -2217,31 +2231,35 @@ static int __init alsa_card_es18xx_init(void)
2217 i, NULL, 0); 2231 i, NULL, 0);
2218 if (IS_ERR(device)) { 2232 if (IS_ERR(device)) {
2219 err = PTR_ERR(device); 2233 err = PTR_ERR(device);
2220 platform_driver_unregister(&snd_es18xx_nonpnp_driver); 2234 goto errout;
2221 return err;
2222 } 2235 }
2236 platform_devices[i] = device;
2223 cards++; 2237 cards++;
2224 } 2238 }
2225 2239
2226 i = pnp_register_card_driver(&es18xx_pnpc_driver); 2240 i = pnp_register_card_driver(&es18xx_pnpc_driver);
2227 if (i > 0) 2241 if (i >= 0) {
2242 pnp_registered = 1;
2228 cards += i; 2243 cards += i;
2244 }
2229 2245
2230 if(!cards) { 2246 if(!cards) {
2231 pnp_unregister_card_driver(&es18xx_pnpc_driver);
2232 platform_driver_unregister(&snd_es18xx_nonpnp_driver);
2233#ifdef MODULE 2247#ifdef MODULE
2234 snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); 2248 snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n");
2235#endif 2249#endif
2236 return -ENODEV; 2250 err = -ENODEV;
2251 goto errout;
2237 } 2252 }
2238 return 0; 2253 return 0;
2254
2255 errout:
2256 snd_es18xx_unregister_all();
2257 return err;
2239} 2258}
2240 2259
2241static void __exit alsa_card_es18xx_exit(void) 2260static void __exit alsa_card_es18xx_exit(void)
2242{ 2261{
2243 pnp_unregister_card_driver(&es18xx_pnpc_driver); 2262 snd_es18xx_unregister_all();
2244 platform_driver_unregister(&snd_es18xx_nonpnp_driver);
2245} 2263}
2246 2264
2247module_init(alsa_card_es18xx_init) 2265module_init(alsa_card_es18xx_init)