aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/cs423x/cs4231.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/cs423x/cs4231.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/cs423x/cs4231.c')
-rw-r--r--sound/isa/cs423x/cs4231.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index b5252a5d7412..ab67b5c2590d 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -66,6 +66,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for CS4231 driver.");
66module_param_array(dma2, int, NULL, 0444); 66module_param_array(dma2, int, NULL, 0444);
67MODULE_PARM_DESC(dma2, "DMA2 # for CS4231 driver."); 67MODULE_PARM_DESC(dma2, "DMA2 # for CS4231 driver.");
68 68
69static struct platform_device *devices[SNDRV_CARDS];
70
69 71
70static int __init snd_cs4231_probe(struct platform_device *pdev) 72static int __init snd_cs4231_probe(struct platform_device *pdev)
71{ 73{
@@ -183,6 +185,15 @@ static struct platform_driver snd_cs4231_driver = {
183 }, 185 },
184}; 186};
185 187
188static void __init_or_module snd_cs4231_unregister_all(void)
189{
190 int i;
191
192 for (i = 0; i < ARRAY_SIZE(devices); ++i)
193 platform_device_unregister(devices[i]);
194 platform_driver_unregister(&snd_cs4231_driver);
195}
196
186static int __init alsa_card_cs4231_init(void) 197static int __init alsa_card_cs4231_init(void)
187{ 198{
188 int i, cards, err; 199 int i, cards, err;
@@ -200,6 +211,7 @@ static int __init alsa_card_cs4231_init(void)
200 err = PTR_ERR(device); 211 err = PTR_ERR(device);
201 goto errout; 212 goto errout;
202 } 213 }
214 devices[i] = device;
203 cards++; 215 cards++;
204 } 216 }
205 if (!cards) { 217 if (!cards) {
@@ -212,13 +224,13 @@ static int __init alsa_card_cs4231_init(void)
212 return 0; 224 return 0;
213 225
214 errout: 226 errout:
215 platform_driver_unregister(&snd_cs4231_driver); 227 snd_cs4231_unregister_all();
216 return err; 228 return err;
217} 229}
218 230
219static void __exit alsa_card_cs4231_exit(void) 231static void __exit alsa_card_cs4231_exit(void)
220{ 232{
221 platform_driver_unregister(&snd_cs4231_driver); 233 snd_cs4231_unregister_all();
222} 234}
223 235
224module_init(alsa_card_cs4231_init) 236module_init(alsa_card_cs4231_init)