aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/sscape.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/sscape.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/sscape.c')
-rw-r--r--sound/isa/sscape.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 6271efe689d..5fb981c0a28 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -67,6 +67,9 @@ MODULE_PARM_DESC(mpu_irq, "MPU401 IRQ # for SoundScape driver.");
67 67
68module_param_array(dma, int, NULL, 0444); 68module_param_array(dma, int, NULL, 0444);
69MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); 69MODULE_PARM_DESC(dma, "DMA # for SoundScape driver.");
70
71static struct platform_device *platform_devices[SNDRV_CARDS];
72static int pnp_registered;
70 73
71#ifdef CONFIG_PNP 74#ifdef CONFIG_PNP
72static struct pnp_card_device_id sscape_pnpids[] = { 75static struct pnp_card_device_id sscape_pnpids[] = {
@@ -1384,6 +1387,17 @@ static struct pnp_card_driver sscape_pnpc_driver = {
1384 1387
1385#endif /* CONFIG_PNP */ 1388#endif /* CONFIG_PNP */
1386 1389
1390static void __init_or_module sscape_unregister_all(void)
1391{
1392 int i;
1393
1394 if (pnp_registered)
1395 pnp_unregister_card_driver(&sscape_pnpc_driver);
1396 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)
1397 platform_device_unregister(platform_devices[i]);
1398 platform_driver_unregister(&snd_sscape_driver);
1399}
1400
1387static int __init sscape_manual_probe(void) 1401static int __init sscape_manual_probe(void)
1388{ 1402{
1389 struct platform_device *device; 1403 struct platform_device *device;
@@ -1411,8 +1425,8 @@ static int __init sscape_manual_probe(void)
1411 dma[i] == SNDRV_AUTO_DMA) { 1425 dma[i] == SNDRV_AUTO_DMA) {
1412 printk(KERN_INFO 1426 printk(KERN_INFO
1413 "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); 1427 "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n");
1414 platform_driver_unregister(&snd_sscape_driver); 1428 ret = -ENXIO;
1415 return -ENXIO; 1429 goto errout;
1416 } 1430 }
1417 1431
1418 /* 1432 /*
@@ -1421,17 +1435,21 @@ static int __init sscape_manual_probe(void)
1421 device = platform_device_register_simple(SSCAPE_DRIVER, 1435 device = platform_device_register_simple(SSCAPE_DRIVER,
1422 i, NULL, 0); 1436 i, NULL, 0);
1423 if (IS_ERR(device)) { 1437 if (IS_ERR(device)) {
1424 platform_driver_unregister(&snd_sscape_driver); 1438 ret = PTR_ERR(device);
1425 return PTR_ERR(device); 1439 goto errout;
1426 } 1440 }
1441 platform_devices[i] = device;
1427 } 1442 }
1428 return 0; 1443 return 0;
1444
1445 errout:
1446 sscape_unregister_all();
1447 return ret;
1429} 1448}
1430 1449
1431static void sscape_exit(void) 1450static void sscape_exit(void)
1432{ 1451{
1433 pnp_unregister_card_driver(&sscape_pnpc_driver); 1452 sscape_unregister_all();
1434 platform_driver_unregister(&snd_sscape_driver);
1435} 1453}
1436 1454
1437 1455
@@ -1448,7 +1466,8 @@ static int __init sscape_init(void)
1448 ret = sscape_manual_probe(); 1466 ret = sscape_manual_probe();
1449 if (ret < 0) 1467 if (ret < 0)
1450 return ret; 1468 return ret;
1451 pnp_register_card_driver(&sscape_pnpc_driver); 1469 if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0)
1470 pnp_registered = 1;
1452 return 0; 1471 return 0;
1453} 1472}
1454 1473