diff options
Diffstat (limited to 'sound/isa/gus/gusmax.c')
-rw-r--r-- | sound/isa/gus/gusmax.c | 16 |
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."); | |||
72 | module_param_array(pcm_channels, int, NULL, 0444); | 72 | module_param_array(pcm_channels, int, NULL, 0444); |
73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); | 73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); |
74 | 74 | ||
75 | static struct platform_device *devices[SNDRV_CARDS]; | ||
76 | |||
75 | struct snd_gusmax { | 77 | struct 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 | ||
369 | static 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 | |||
367 | static int __init alsa_card_gusmax_init(void) | 378 | static 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 | ||
400 | static void __exit alsa_card_gusmax_exit(void) | 412 | static 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 | ||
405 | module_init(alsa_card_gusmax_init) | 417 | module_init(alsa_card_gusmax_init) |