aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/serial-u16550.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/drivers/serial-u16550.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/drivers/serial-u16550.c')
-rw-r--r--sound/drivers/serial-u16550.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 3381a43c592e..29676d800cae 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -168,6 +168,8 @@ typedef struct _snd_uart16550 {
168 168
169} snd_uart16550_t; 169} snd_uart16550_t;
170 170
171static struct platform_device *devices[SNDRV_CARDS];
172
171static inline void snd_uart16550_add_timer(snd_uart16550_t *uart) 173static inline void snd_uart16550_add_timer(snd_uart16550_t *uart)
172{ 174{
173 if (! uart->timer_running) { 175 if (! uart->timer_running) {
@@ -970,6 +972,15 @@ static struct platform_driver snd_serial_driver = {
970 }, 972 },
971}; 973};
972 974
975static void __init_or_module snd_serial_unregister_all(void)
976{
977 int i;
978
979 for (i = 0; i < ARRAY_SIZE(devices); ++i)
980 platform_device_unregister(devices[i]);
981 platform_driver_unregister(&snd_serial_driver);
982}
983
973static int __init alsa_card_serial_init(void) 984static int __init alsa_card_serial_init(void)
974{ 985{
975 int i, cards, err; 986 int i, cards, err;
@@ -986,6 +997,7 @@ static int __init alsa_card_serial_init(void)
986 err = PTR_ERR(device); 997 err = PTR_ERR(device);
987 goto errout; 998 goto errout;
988 } 999 }
1000 devices[i] = device;
989 cards++; 1001 cards++;
990 } 1002 }
991 if (! cards) { 1003 if (! cards) {
@@ -998,13 +1010,13 @@ static int __init alsa_card_serial_init(void)
998 return 0; 1010 return 0;
999 1011
1000 errout: 1012 errout:
1001 platform_driver_unregister(&snd_serial_driver); 1013 snd_serial_unregister_all();
1002 return err; 1014 return err;
1003} 1015}
1004 1016
1005static void __exit alsa_card_serial_exit(void) 1017static void __exit alsa_card_serial_exit(void)
1006{ 1018{
1007 platform_driver_unregister(&snd_serial_driver); 1019 snd_serial_unregister_all();
1008} 1020}
1009 1021
1010module_init(alsa_card_serial_init) 1022module_init(alsa_card_serial_init)