diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-12-07 03:13:42 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:30:39 -0500 |
commit | f7a9275d949cb0bf1f259a1546e52a0bf518151c (patch) | |
tree | 4d96d9b6196d43684903857ba676dc51bbde4026 /sound/isa/sgalaxy.c | |
parent | 416c1079d30f1a52399b96f6772e993274b774ae (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/sgalaxy.c')
-rw-r--r-- | sound/isa/sgalaxy.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 2e1d4677fe12..0dbbb35b242c 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -64,6 +64,8 @@ MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver."); | |||
64 | module_param_array(dma1, int, NULL, 0444); | 64 | module_param_array(dma1, int, NULL, 0444); |
65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); | 65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); |
66 | 66 | ||
67 | static struct platform_device *devices[SNDRV_CARDS]; | ||
68 | |||
67 | #define SGALAXY_AUXC_LEFT 18 | 69 | #define SGALAXY_AUXC_LEFT 18 |
68 | #define SGALAXY_AUXC_RIGHT 19 | 70 | #define SGALAXY_AUXC_RIGHT 19 |
69 | 71 | ||
@@ -340,6 +342,15 @@ static struct platform_driver snd_sgalaxy_driver = { | |||
340 | }, | 342 | }, |
341 | }; | 343 | }; |
342 | 344 | ||
345 | static void __init_or_module snd_sgalaxy_unregister_all(void) | ||
346 | { | ||
347 | int i; | ||
348 | |||
349 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
350 | platform_device_unregister(devices[i]); | ||
351 | platform_driver_unregister(&snd_sgalaxy_driver); | ||
352 | } | ||
353 | |||
343 | static int __init alsa_card_sgalaxy_init(void) | 354 | static int __init alsa_card_sgalaxy_init(void) |
344 | { | 355 | { |
345 | int i, cards, err; | 356 | int i, cards, err; |
@@ -357,6 +368,7 @@ static int __init alsa_card_sgalaxy_init(void) | |||
357 | err = PTR_ERR(device); | 368 | err = PTR_ERR(device); |
358 | goto errout; | 369 | goto errout; |
359 | } | 370 | } |
371 | devices[i] = device; | ||
360 | cards++; | 372 | cards++; |
361 | } | 373 | } |
362 | if (!cards) { | 374 | if (!cards) { |
@@ -369,13 +381,13 @@ static int __init alsa_card_sgalaxy_init(void) | |||
369 | return 0; | 381 | return 0; |
370 | 382 | ||
371 | errout: | 383 | errout: |
372 | platform_driver_unregister(&snd_sgalaxy_driver); | 384 | snd_sgalaxy_unregister_all(); |
373 | return err; | 385 | return err; |
374 | } | 386 | } |
375 | 387 | ||
376 | static void __exit alsa_card_sgalaxy_exit(void) | 388 | static void __exit alsa_card_sgalaxy_exit(void) |
377 | { | 389 | { |
378 | platform_driver_unregister(&snd_sgalaxy_driver); | 390 | snd_sgalaxy_unregister_all(); |
379 | } | 391 | } |
380 | 392 | ||
381 | module_init(alsa_card_sgalaxy_init) | 393 | module_init(alsa_card_sgalaxy_init) |