aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/ad1848
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/ad1848
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/ad1848')
-rw-r--r--sound/isa/ad1848/ad1848.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 1019e9fdff53..e091bbeffd2a 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -62,6 +62,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver.");
62module_param_array(thinkpad, bool, NULL, 0444); 62module_param_array(thinkpad, bool, NULL, 0444);
63MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); 63MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series.");
64 64
65static struct platform_device *devices[SNDRV_CARDS];
66
65 67
66static int __init snd_ad1848_probe(struct platform_device *pdev) 68static int __init snd_ad1848_probe(struct platform_device *pdev)
67{ 69{
@@ -167,6 +169,15 @@ static struct platform_driver snd_ad1848_driver = {
167 }, 169 },
168}; 170};
169 171
172static void __init_or_module snd_ad1848_unregister_all(void)
173{
174 int i;
175
176 for (i = 0; i < ARRAY_SIZE(devices); ++i)
177 platform_device_unregister(devices[i]);
178 platform_driver_unregister(&snd_ad1848_driver);
179}
180
170static int __init alsa_card_ad1848_init(void) 181static int __init alsa_card_ad1848_init(void)
171{ 182{
172 int i, cards, err; 183 int i, cards, err;
@@ -184,6 +195,7 @@ static int __init alsa_card_ad1848_init(void)
184 err = PTR_ERR(device); 195 err = PTR_ERR(device);
185 goto errout; 196 goto errout;
186 } 197 }
198 devices[i] = device;
187 cards++; 199 cards++;
188 } 200 }
189 if (!cards) { 201 if (!cards) {
@@ -196,13 +208,13 @@ static int __init alsa_card_ad1848_init(void)
196 return 0; 208 return 0;
197 209
198 errout: 210 errout:
199 platform_driver_unregister(&snd_ad1848_driver); 211 snd_ad1848_unregister_all();
200 return err; 212 return err;
201} 213}
202 214
203static void __exit alsa_card_ad1848_exit(void) 215static void __exit alsa_card_ad1848_exit(void)
204{ 216{
205 platform_driver_unregister(&snd_ad1848_driver); 217 snd_ad1848_unregister_all();
206} 218}
207 219
208module_init(alsa_card_ad1848_init) 220module_init(alsa_card_ad1848_init)