diff options
Diffstat (limited to 'net/irda/irmod.c')
-rw-r--r-- | net/irda/irmod.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/net/irda/irmod.c b/net/irda/irmod.c index c7fad2c5b9f3..1900937b3328 100644 --- a/net/irda/irmod.c +++ b/net/irda/irmod.c | |||
@@ -88,16 +88,23 @@ EXPORT_SYMBOL(irda_notify_init); | |||
88 | */ | 88 | */ |
89 | static int __init irda_init(void) | 89 | static int __init irda_init(void) |
90 | { | 90 | { |
91 | int ret = 0; | ||
92 | |||
91 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__); | 93 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__); |
92 | 94 | ||
93 | /* Lower layer of the stack */ | 95 | /* Lower layer of the stack */ |
94 | irlmp_init(); | 96 | irlmp_init(); |
95 | irlap_init(); | 97 | irlap_init(); |
96 | 98 | ||
99 | /* Driver/dongle support */ | ||
100 | irda_device_init(); | ||
101 | |||
97 | /* Higher layers of the stack */ | 102 | /* Higher layers of the stack */ |
98 | iriap_init(); | 103 | iriap_init(); |
99 | irttp_init(); | 104 | irttp_init(); |
100 | irsock_init(); | 105 | ret = irsock_init(); |
106 | if (ret < 0) | ||
107 | goto out_err_1; | ||
101 | 108 | ||
102 | /* Add IrDA packet type (Start receiving packets) */ | 109 | /* Add IrDA packet type (Start receiving packets) */ |
103 | dev_add_pack(&irda_packet_type); | 110 | dev_add_pack(&irda_packet_type); |
@@ -107,13 +114,44 @@ static int __init irda_init(void) | |||
107 | irda_proc_register(); | 114 | irda_proc_register(); |
108 | #endif | 115 | #endif |
109 | #ifdef CONFIG_SYSCTL | 116 | #ifdef CONFIG_SYSCTL |
110 | irda_sysctl_register(); | 117 | ret = irda_sysctl_register(); |
118 | if (ret < 0) | ||
119 | goto out_err_2; | ||
111 | #endif | 120 | #endif |
112 | 121 | ||
113 | /* Driver/dongle support */ | 122 | ret = irda_nl_register(); |
114 | irda_device_init(); | 123 | if (ret < 0) |
124 | goto out_err_3; | ||
115 | 125 | ||
116 | return 0; | 126 | return 0; |
127 | |||
128 | out_err_3: | ||
129 | #ifdef CONFIG_SYSCTL | ||
130 | irda_sysctl_unregister(); | ||
131 | #endif | ||
132 | out_err_2: | ||
133 | #ifdef CONFIG_PROC_FS | ||
134 | irda_proc_unregister(); | ||
135 | #endif | ||
136 | |||
137 | /* Remove IrDA packet type (stop receiving packets) */ | ||
138 | dev_remove_pack(&irda_packet_type); | ||
139 | |||
140 | /* Remove higher layers */ | ||
141 | irsock_cleanup(); | ||
142 | out_err_1: | ||
143 | irttp_cleanup(); | ||
144 | iriap_cleanup(); | ||
145 | |||
146 | /* Remove lower layers */ | ||
147 | irda_device_cleanup(); | ||
148 | irlap_cleanup(); /* Must be done before irlmp_cleanup()! DB */ | ||
149 | |||
150 | /* Remove middle layer */ | ||
151 | irlmp_cleanup(); | ||
152 | |||
153 | |||
154 | return ret; | ||
117 | } | 155 | } |
118 | 156 | ||
119 | /* | 157 | /* |
@@ -125,6 +163,8 @@ static int __init irda_init(void) | |||
125 | static void __exit irda_cleanup(void) | 163 | static void __exit irda_cleanup(void) |
126 | { | 164 | { |
127 | /* Remove External APIs */ | 165 | /* Remove External APIs */ |
166 | irda_nl_unregister(); | ||
167 | |||
128 | #ifdef CONFIG_SYSCTL | 168 | #ifdef CONFIG_SYSCTL |
129 | irda_sysctl_unregister(); | 169 | irda_sysctl_unregister(); |
130 | #endif | 170 | #endif |