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/drivers/dummy.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/drivers/dummy.c')
-rw-r--r-- | sound/drivers/dummy.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 186117571745..96d207051628 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -144,6 +144,8 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver."); | |||
144 | //module_param_array(midi_devs, int, NULL, 0444); | 144 | //module_param_array(midi_devs, int, NULL, 0444); |
145 | //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver."); | 145 | //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver."); |
146 | 146 | ||
147 | static struct platform_device *devices[SNDRV_CARDS]; | ||
148 | |||
147 | #define MIXER_ADDR_MASTER 0 | 149 | #define MIXER_ADDR_MASTER 0 |
148 | #define MIXER_ADDR_LINE 1 | 150 | #define MIXER_ADDR_LINE 1 |
149 | #define MIXER_ADDR_MIC 2 | 151 | #define MIXER_ADDR_MIC 2 |
@@ -634,6 +636,15 @@ static struct platform_driver snd_dummy_driver = { | |||
634 | }, | 636 | }, |
635 | }; | 637 | }; |
636 | 638 | ||
639 | static void __init_or_module snd_dummy_unregister_all(void) | ||
640 | { | ||
641 | int i; | ||
642 | |||
643 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
644 | platform_device_unregister(devices[i]); | ||
645 | platform_driver_unregister(&snd_dummy_driver); | ||
646 | } | ||
647 | |||
637 | static int __init alsa_card_dummy_init(void) | 648 | static int __init alsa_card_dummy_init(void) |
638 | { | 649 | { |
639 | int i, cards, err; | 650 | int i, cards, err; |
@@ -650,6 +661,7 @@ static int __init alsa_card_dummy_init(void) | |||
650 | err = PTR_ERR(device); | 661 | err = PTR_ERR(device); |
651 | goto errout; | 662 | goto errout; |
652 | } | 663 | } |
664 | devices[i] = device; | ||
653 | cards++; | 665 | cards++; |
654 | } | 666 | } |
655 | if (!cards) { | 667 | if (!cards) { |
@@ -662,13 +674,13 @@ static int __init alsa_card_dummy_init(void) | |||
662 | return 0; | 674 | return 0; |
663 | 675 | ||
664 | errout: | 676 | errout: |
665 | platform_driver_unregister(&snd_dummy_driver); | 677 | snd_dummy_unregister_all(); |
666 | return err; | 678 | return err; |
667 | } | 679 | } |
668 | 680 | ||
669 | static void __exit alsa_card_dummy_exit(void) | 681 | static void __exit alsa_card_dummy_exit(void) |
670 | { | 682 | { |
671 | platform_driver_unregister(&snd_dummy_driver); | 683 | snd_dummy_unregister_all(); |
672 | } | 684 | } |
673 | 685 | ||
674 | module_init(alsa_card_dummy_init) | 686 | module_init(alsa_card_dummy_init) |