diff options
Diffstat (limited to 'sound/isa/sb/sb8.c')
-rw-r--r-- | sound/isa/sb/sb8.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 0a3d55d639a9..60ee79cd14a3 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -56,6 +56,8 @@ MODULE_PARM_DESC(irq, "IRQ # for SB8 driver."); | |||
56 | module_param_array(dma8, int, NULL, 0444); | 56 | module_param_array(dma8, int, NULL, 0444); |
57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); | 57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); |
58 | 58 | ||
59 | static struct platform_device *devices[SNDRV_CARDS]; | ||
60 | |||
59 | struct snd_sb8 { | 61 | struct snd_sb8 { |
60 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ | 62 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ |
61 | struct snd_sb *chip; | 63 | struct snd_sb *chip; |
@@ -238,6 +240,15 @@ static struct platform_driver snd_sb8_driver = { | |||
238 | }, | 240 | }, |
239 | }; | 241 | }; |
240 | 242 | ||
243 | static void __init_or_module snd_sb8_unregister_all(void) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
248 | platform_device_unregister(devices[i]); | ||
249 | platform_driver_unregister(&snd_sb8_driver); | ||
250 | } | ||
251 | |||
241 | static int __init alsa_card_sb8_init(void) | 252 | static int __init alsa_card_sb8_init(void) |
242 | { | 253 | { |
243 | int i, cards, err; | 254 | int i, cards, err; |
@@ -255,6 +266,7 @@ static int __init alsa_card_sb8_init(void) | |||
255 | err = PTR_ERR(device); | 266 | err = PTR_ERR(device); |
256 | goto errout; | 267 | goto errout; |
257 | } | 268 | } |
269 | devices[i] = device; | ||
258 | cards++; | 270 | cards++; |
259 | } | 271 | } |
260 | if (!cards) { | 272 | if (!cards) { |
@@ -267,13 +279,13 @@ static int __init alsa_card_sb8_init(void) | |||
267 | return 0; | 279 | return 0; |
268 | 280 | ||
269 | errout: | 281 | errout: |
270 | platform_driver_unregister(&snd_sb8_driver); | 282 | snd_sb8_unregister_all(); |
271 | return err; | 283 | return err; |
272 | } | 284 | } |
273 | 285 | ||
274 | static void __exit alsa_card_sb8_exit(void) | 286 | static void __exit alsa_card_sb8_exit(void) |
275 | { | 287 | { |
276 | platform_driver_unregister(&snd_sb8_driver); | 288 | snd_sb8_unregister_all(); |
277 | } | 289 | } |
278 | 290 | ||
279 | module_init(alsa_card_sb8_init) | 291 | module_init(alsa_card_sb8_init) |