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/virmidi.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/virmidi.c')
-rw-r--r-- | sound/drivers/virmidi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 9f36a6472478..4258723de2ab 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c | |||
@@ -82,6 +82,8 @@ struct snd_card_virmidi { | |||
82 | struct snd_rawmidi *midi[MAX_MIDI_DEVICES]; | 82 | struct snd_rawmidi *midi[MAX_MIDI_DEVICES]; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct platform_device *devices[SNDRV_CARDS]; | ||
86 | |||
85 | 87 | ||
86 | static int __init snd_virmidi_probe(struct platform_device *devptr) | 88 | static int __init snd_virmidi_probe(struct platform_device *devptr) |
87 | { | 89 | { |
@@ -144,6 +146,15 @@ static struct platform_driver snd_virmidi_driver = { | |||
144 | }, | 146 | }, |
145 | }; | 147 | }; |
146 | 148 | ||
149 | static void __init_or_module snd_virmidi_unregister_all(void) | ||
150 | { | ||
151 | int i; | ||
152 | |||
153 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
154 | platform_device_unregister(devices[i]); | ||
155 | platform_driver_unregister(&snd_virmidi_driver); | ||
156 | } | ||
157 | |||
147 | static int __init alsa_card_virmidi_init(void) | 158 | static int __init alsa_card_virmidi_init(void) |
148 | { | 159 | { |
149 | int i, cards, err; | 160 | int i, cards, err; |
@@ -160,6 +171,7 @@ static int __init alsa_card_virmidi_init(void) | |||
160 | err = PTR_ERR(device); | 171 | err = PTR_ERR(device); |
161 | goto errout; | 172 | goto errout; |
162 | } | 173 | } |
174 | devices[i] = device; | ||
163 | cards++; | 175 | cards++; |
164 | } | 176 | } |
165 | if (!cards) { | 177 | if (!cards) { |
@@ -172,13 +184,13 @@ static int __init alsa_card_virmidi_init(void) | |||
172 | return 0; | 184 | return 0; |
173 | 185 | ||
174 | errout: | 186 | errout: |
175 | platform_driver_unregister(&snd_virmidi_driver); | 187 | snd_virmidi_unregister_all(); |
176 | return err; | 188 | return err; |
177 | } | 189 | } |
178 | 190 | ||
179 | static void __exit alsa_card_virmidi_exit(void) | 191 | static void __exit alsa_card_virmidi_exit(void) |
180 | { | 192 | { |
181 | platform_driver_unregister(&snd_virmidi_driver); | 193 | snd_virmidi_unregister_all(); |
182 | } | 194 | } |
183 | 195 | ||
184 | module_init(alsa_card_virmidi_init) | 196 | module_init(alsa_card_virmidi_init) |