summaryrefslogtreecommitdiffstats
path: root/sound/drivers/mpu401
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-12-07 09:13:42 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:30:39 +0100
commitf7a9275d949cb0bf1f259a1546e52a0bf518151c (patch)
tree4d96d9b6196d43684903857ba676dc51bbde4026 /sound/drivers/mpu401
parent416c1079d30f1a52399b96f6772e993274b774ae (diff)
downloadtalos-op-linux-f7a9275d949cb0bf1f259a1546e52a0bf518151c.tar.gz
talos-op-linux-f7a9275d949cb0bf1f259a1546e52a0bf518151c.zip
[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/mpu401')
-rw-r--r--sound/drivers/mpu401/mpu401.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index ec817a86d3dd..915589a402ab 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -58,6 +58,7 @@ MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
+static struct platform_device *platform_devices[SNDRV_CARDS];
static int pnp_registered = 0;
static int snd_mpu401_create(int dev, struct snd_card **rcard)
@@ -220,6 +221,17 @@ static struct pnp_driver snd_mpu401_pnp_driver = {
static struct pnp_driver snd_mpu401_pnp_driver;
#endif
+static void __init_or_module snd_mpu401_unregister_all(void)
+{
+ int i;
+
+ if (pnp_registered)
+ pnp_unregister_driver(&snd_mpu401_pnp_driver);
+ for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)
+ platform_device_unregister(platform_devices[i]);
+ platform_driver_unregister(&snd_mpu401_driver);
+}
+
static int __init alsa_card_mpu401_init(void)
{
int i, err, devices;
@@ -240,6 +252,7 @@ static int __init alsa_card_mpu401_init(void)
err = PTR_ERR(device);
goto errout;
}
+ platform_devices[i] = device;
devices++;
}
if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) {
@@ -257,17 +270,13 @@ static int __init alsa_card_mpu401_init(void)
return 0;
errout:
- if (pnp_registered)
- pnp_unregister_driver(&snd_mpu401_pnp_driver);
- platform_driver_unregister(&snd_mpu401_driver);
+ snd_mpu401_unregister_all();
return err;
}
static void __exit alsa_card_mpu401_exit(void)
{
- if (pnp_registered)
- pnp_unregister_driver(&snd_mpu401_pnp_driver);
- platform_driver_unregister(&snd_mpu401_driver);
+ snd_mpu401_unregister_all();
}
module_init(alsa_card_mpu401_init)
OpenPOWER on IntegriCloud