diff options
Diffstat (limited to 'sound/isa/es1688')
-rw-r--r-- | sound/isa/es1688/es1688.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 68bd40a76f0..50d23cf3d7c 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -69,6 +69,8 @@ MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ESx688 driver."); module_param_array(dma8, int, NULL, 0444); MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver."); +static struct platform_device *devices[SNDRV_CARDS]; + #define PFX "es1688: " static int __init snd_es1688_probe(struct platform_device *pdev) @@ -187,6 +189,15 @@ static struct platform_driver snd_es1688_driver = { }, }; +static void __init_or_module snd_es1688_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_es1688_driver); +} + static int __init alsa_card_es1688_init(void) { int i, cards, err; @@ -204,6 +215,7 @@ static int __init alsa_card_es1688_init(void) err = PTR_ERR(device); goto errout; } + devices[i] = device; cards++; } if (!cards) { @@ -216,13 +228,13 @@ static int __init alsa_card_es1688_init(void) return 0; errout: - platform_driver_unregister(&snd_es1688_driver); + snd_es1688_unregister_all(); return err; } static void __exit alsa_card_es1688_exit(void) { - platform_driver_unregister(&snd_es1688_driver); + snd_es1688_unregister_all(); } module_init(alsa_card_es1688_init) |