aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus/gusmax.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/gus/gusmax.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/gus/gusmax.c')
-rw-r--r--sound/isa/gus/gusmax.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index d1b70ee9b039..d4d2b2a517d5 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -72,6 +72,8 @@ MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver.");
72module_param_array(pcm_channels, int, NULL, 0444); 72module_param_array(pcm_channels, int, NULL, 0444);
73MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); 73MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver.");
74 74
75static struct platform_device *devices[SNDRV_CARDS];
76
75struct snd_gusmax { 77struct snd_gusmax {
76 int irq; 78 int irq;
77 struct snd_card *card; 79 struct snd_card *card;
@@ -364,6 +366,15 @@ static struct platform_driver snd_gusmax_driver = {
364 }, 366 },
365}; 367};
366 368
369static void __init_or_module snd_gusmax_unregister_all(void)
370{
371 int i;
372
373 for (i = 0; i < ARRAY_SIZE(devices); ++i)
374 platform_device_unregister(devices[i]);
375 platform_driver_unregister(&snd_gusmax_driver);
376}
377
367static int __init alsa_card_gusmax_init(void) 378static int __init alsa_card_gusmax_init(void)
368{ 379{
369 int i, cards, err; 380 int i, cards, err;
@@ -381,6 +392,7 @@ static int __init alsa_card_gusmax_init(void)
381 err = PTR_ERR(device); 392 err = PTR_ERR(device);
382 goto errout; 393 goto errout;
383 } 394 }
395 devices[i] = device;
384 cards++; 396 cards++;
385 } 397 }
386 if (!cards) { 398 if (!cards) {
@@ -393,13 +405,13 @@ static int __init alsa_card_gusmax_init(void)
393 return 0; 405 return 0;
394 406
395 errout: 407 errout:
396 platform_driver_unregister(&snd_gusmax_driver); 408 snd_gusmax_unregister_all();
397 return err; 409 return err;
398} 410}
399 411
400static void __exit alsa_card_gusmax_exit(void) 412static void __exit alsa_card_gusmax_exit(void)
401{ 413{
402 platform_driver_unregister(&snd_gusmax_driver); 414 snd_gusmax_unregister_all();
403} 415}
404 416
405module_init(alsa_card_gusmax_init) 417module_init(alsa_card_gusmax_init)