diff options
Diffstat (limited to 'sound/drivers/serial-u16550.c')
-rw-r--r-- | sound/drivers/serial-u16550.c | 16 |
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 | ||
171 | static struct platform_device *devices[SNDRV_CARDS]; | ||
172 | |||
171 | static inline void snd_uart16550_add_timer(snd_uart16550_t *uart) | 173 | static 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 | ||
975 | static 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 | |||
973 | static int __init alsa_card_serial_init(void) | 984 | static 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 | ||
1005 | static void __exit alsa_card_serial_exit(void) | 1017 | static 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 | ||
1010 | module_init(alsa_card_serial_init) | 1022 | module_init(alsa_card_serial_init) |