aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-04-10 18:14:21 -0400
committerFelipe Balbi <balbi@ti.com>2015-04-27 15:45:35 -0400
commitc94e289f195e0e13cf34d27f9338d28221a85751 (patch)
tree7f34ce1c30fe9197a5913112a882159943557abb
parent197d0bdf8b0168d69c400d3936d08066ab1499a7 (diff)
usb: gadget: remove incorrect __init/__exit annotations
A recent change introduced a link error for the composite printer gadget driver: `printer_unbind' referenced in section `.ref.data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o Evidently the unbind function should not be marked __exit here, because it is called through a callback pointer that is not necessarily discarded, __composite_unbind() is indeed called from the error path of composite_bind(), which can never work for a built-in driver. Looking at the surrounding code, I found the same problem in all other composite gadget drivers in both the bind and unbind functions, as well as the udc platform driver 'remove' functions. Those will break if anyone uses the 'unbind' sysfs attribute to detach a device from a built-in driver. This patch removes the incorrect annotations from all the gadget drivers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/legacy/acm_ms.c10
-rw-r--r--drivers/usb/gadget/legacy/audio.c10
-rw-r--r--drivers/usb/gadget/legacy/cdc2.c10
-rw-r--r--drivers/usb/gadget/legacy/dbgp.c4
-rw-r--r--drivers/usb/gadget/legacy/ether.c12
-rw-r--r--drivers/usb/gadget/legacy/g_ffs.c2
-rw-r--r--drivers/usb/gadget/legacy/gmidi.c10
-rw-r--r--drivers/usb/gadget/legacy/hid.c12
-rw-r--r--drivers/usb/gadget/legacy/mass_storage.c6
-rw-r--r--drivers/usb/gadget/legacy/multi.c10
-rw-r--r--drivers/usb/gadget/legacy/ncm.c10
-rw-r--r--drivers/usb/gadget/legacy/nokia.c10
-rw-r--r--drivers/usb/gadget/legacy/printer.c8
-rw-r--r--drivers/usb/gadget/legacy/serial.c4
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c2
-rw-r--r--drivers/usb/gadget/legacy/webcam.c8
-rw-r--r--drivers/usb/gadget/legacy/zero.c4
-rw-r--r--drivers/usb/gadget/udc/at91_udc.c4
-rw-r--r--drivers/usb/gadget/udc/atmel_usba_udc.c4
-rw-r--r--drivers/usb/gadget/udc/fsl_udc_core.c4
-rw-r--r--drivers/usb/gadget/udc/fusb300_udc.c4
-rw-r--r--drivers/usb/gadget/udc/m66592-udc.c4
-rw-r--r--drivers/usb/gadget/udc/r8a66597-udc.c4
23 files changed, 78 insertions, 78 deletions
diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c
index c30b7b572465..1194b09ae746 100644
--- a/drivers/usb/gadget/legacy/acm_ms.c
+++ b/drivers/usb/gadget/legacy/acm_ms.c
@@ -121,7 +121,7 @@ static struct usb_function *f_msg;
121/* 121/*
122 * We _always_ have both ACM and mass storage functions. 122 * We _always_ have both ACM and mass storage functions.
123 */ 123 */
124static int __init acm_ms_do_config(struct usb_configuration *c) 124static int acm_ms_do_config(struct usb_configuration *c)
125{ 125{
126 struct fsg_opts *opts; 126 struct fsg_opts *opts;
127 int status; 127 int status;
@@ -174,7 +174,7 @@ static struct usb_configuration acm_ms_config_driver = {
174 174
175/*-------------------------------------------------------------------------*/ 175/*-------------------------------------------------------------------------*/
176 176
177static int __init acm_ms_bind(struct usb_composite_dev *cdev) 177static int acm_ms_bind(struct usb_composite_dev *cdev)
178{ 178{
179 struct usb_gadget *gadget = cdev->gadget; 179 struct usb_gadget *gadget = cdev->gadget;
180 struct fsg_opts *opts; 180 struct fsg_opts *opts;
@@ -249,7 +249,7 @@ fail_get_msg:
249 return status; 249 return status;
250} 250}
251 251
252static int __exit acm_ms_unbind(struct usb_composite_dev *cdev) 252static int acm_ms_unbind(struct usb_composite_dev *cdev)
253{ 253{
254 usb_put_function(f_msg); 254 usb_put_function(f_msg);
255 usb_put_function_instance(fi_msg); 255 usb_put_function_instance(fi_msg);
@@ -258,13 +258,13 @@ static int __exit acm_ms_unbind(struct usb_composite_dev *cdev)
258 return 0; 258 return 0;
259} 259}
260 260
261static __refdata struct usb_composite_driver acm_ms_driver = { 261static struct usb_composite_driver acm_ms_driver = {
262 .name = "g_acm_ms", 262 .name = "g_acm_ms",
263 .dev = &device_desc, 263 .dev = &device_desc,
264 .max_speed = USB_SPEED_SUPER, 264 .max_speed = USB_SPEED_SUPER,
265 .strings = dev_strings, 265 .strings = dev_strings,
266 .bind = acm_ms_bind, 266 .bind = acm_ms_bind,
267 .unbind = __exit_p(acm_ms_unbind), 267 .unbind = acm_ms_unbind,
268}; 268};
269 269
270module_usb_composite_driver(acm_ms_driver); 270module_usb_composite_driver(acm_ms_driver);
diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
index f46a3956e43d..f289caf18a45 100644
--- a/drivers/usb/gadget/legacy/audio.c
+++ b/drivers/usb/gadget/legacy/audio.c
@@ -167,7 +167,7 @@ static const struct usb_descriptor_header *otg_desc[] = {
167 167
168/*-------------------------------------------------------------------------*/ 168/*-------------------------------------------------------------------------*/
169 169
170static int __init audio_do_config(struct usb_configuration *c) 170static int audio_do_config(struct usb_configuration *c)
171{ 171{
172 int status; 172 int status;
173 173
@@ -216,7 +216,7 @@ static struct usb_configuration audio_config_driver = {
216 216
217/*-------------------------------------------------------------------------*/ 217/*-------------------------------------------------------------------------*/
218 218
219static int __init audio_bind(struct usb_composite_dev *cdev) 219static int audio_bind(struct usb_composite_dev *cdev)
220{ 220{
221#ifndef CONFIG_GADGET_UAC1 221#ifndef CONFIG_GADGET_UAC1
222 struct f_uac2_opts *uac2_opts; 222 struct f_uac2_opts *uac2_opts;
@@ -276,7 +276,7 @@ fail:
276 return status; 276 return status;
277} 277}
278 278
279static int __exit audio_unbind(struct usb_composite_dev *cdev) 279static int audio_unbind(struct usb_composite_dev *cdev)
280{ 280{
281#ifdef CONFIG_GADGET_UAC1 281#ifdef CONFIG_GADGET_UAC1
282 if (!IS_ERR_OR_NULL(f_uac1)) 282 if (!IS_ERR_OR_NULL(f_uac1))
@@ -292,13 +292,13 @@ static int __exit audio_unbind(struct usb_composite_dev *cdev)
292 return 0; 292 return 0;
293} 293}
294 294
295static __refdata struct usb_composite_driver audio_driver = { 295static struct usb_composite_driver audio_driver = {
296 .name = "g_audio", 296 .name = "g_audio",
297 .dev = &device_desc, 297 .dev = &device_desc,
298 .strings = audio_strings, 298 .strings = audio_strings,
299 .max_speed = USB_SPEED_HIGH, 299 .max_speed = USB_SPEED_HIGH,
300 .bind = audio_bind, 300 .bind = audio_bind,
301 .unbind = __exit_p(audio_unbind), 301 .unbind = audio_unbind,
302}; 302};
303 303
304module_usb_composite_driver(audio_driver); 304module_usb_composite_driver(audio_driver);
diff --git a/drivers/usb/gadget/legacy/cdc2.c b/drivers/usb/gadget/legacy/cdc2.c
index 2e85d9473478..afd3e37921a7 100644
--- a/drivers/usb/gadget/legacy/cdc2.c
+++ b/drivers/usb/gadget/legacy/cdc2.c
@@ -104,7 +104,7 @@ static struct usb_function_instance *fi_ecm;
104/* 104/*
105 * We _always_ have both CDC ECM and CDC ACM functions. 105 * We _always_ have both CDC ECM and CDC ACM functions.
106 */ 106 */
107static int __init cdc_do_config(struct usb_configuration *c) 107static int cdc_do_config(struct usb_configuration *c)
108{ 108{
109 int status; 109 int status;
110 110
@@ -153,7 +153,7 @@ static struct usb_configuration cdc_config_driver = {
153 153
154/*-------------------------------------------------------------------------*/ 154/*-------------------------------------------------------------------------*/
155 155
156static int __init cdc_bind(struct usb_composite_dev *cdev) 156static int cdc_bind(struct usb_composite_dev *cdev)
157{ 157{
158 struct usb_gadget *gadget = cdev->gadget; 158 struct usb_gadget *gadget = cdev->gadget;
159 struct f_ecm_opts *ecm_opts; 159 struct f_ecm_opts *ecm_opts;
@@ -211,7 +211,7 @@ fail:
211 return status; 211 return status;
212} 212}
213 213
214static int __exit cdc_unbind(struct usb_composite_dev *cdev) 214static int cdc_unbind(struct usb_composite_dev *cdev)
215{ 215{
216 usb_put_function(f_acm); 216 usb_put_function(f_acm);
217 usb_put_function_instance(fi_serial); 217 usb_put_function_instance(fi_serial);
@@ -222,13 +222,13 @@ static int __exit cdc_unbind(struct usb_composite_dev *cdev)
222 return 0; 222 return 0;
223} 223}
224 224
225static __refdata struct usb_composite_driver cdc_driver = { 225static struct usb_composite_driver cdc_driver = {
226 .name = "g_cdc", 226 .name = "g_cdc",
227 .dev = &device_desc, 227 .dev = &device_desc,
228 .strings = dev_strings, 228 .strings = dev_strings,
229 .max_speed = USB_SPEED_HIGH, 229 .max_speed = USB_SPEED_HIGH,
230 .bind = cdc_bind, 230 .bind = cdc_bind,
231 .unbind = __exit_p(cdc_unbind), 231 .unbind = cdc_unbind,
232}; 232};
233 233
234module_usb_composite_driver(cdc_driver); 234module_usb_composite_driver(cdc_driver);
diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c
index 633683a72a11..204b10b1a7e7 100644
--- a/drivers/usb/gadget/legacy/dbgp.c
+++ b/drivers/usb/gadget/legacy/dbgp.c
@@ -284,7 +284,7 @@ fail_1:
284 return -ENODEV; 284 return -ENODEV;
285} 285}
286 286
287static int __init dbgp_bind(struct usb_gadget *gadget, 287static int dbgp_bind(struct usb_gadget *gadget,
288 struct usb_gadget_driver *driver) 288 struct usb_gadget_driver *driver)
289{ 289{
290 int err, stp; 290 int err, stp;
@@ -406,7 +406,7 @@ fail:
406 return err; 406 return err;
407} 407}
408 408
409static __refdata struct usb_gadget_driver dbgp_driver = { 409static struct usb_gadget_driver dbgp_driver = {
410 .function = "dbgp", 410 .function = "dbgp",
411 .max_speed = USB_SPEED_HIGH, 411 .max_speed = USB_SPEED_HIGH,
412 .bind = dbgp_bind, 412 .bind = dbgp_bind,
diff --git a/drivers/usb/gadget/legacy/ether.c b/drivers/usb/gadget/legacy/ether.c
index c5fdc61cdc4a..a3323dca218f 100644
--- a/drivers/usb/gadget/legacy/ether.c
+++ b/drivers/usb/gadget/legacy/ether.c
@@ -222,7 +222,7 @@ static struct usb_function *f_rndis;
222 * the first one present. That's to make Microsoft's drivers happy, 222 * the first one present. That's to make Microsoft's drivers happy,
223 * and to follow DOCSIS 1.0 (cable modem standard). 223 * and to follow DOCSIS 1.0 (cable modem standard).
224 */ 224 */
225static int __init rndis_do_config(struct usb_configuration *c) 225static int rndis_do_config(struct usb_configuration *c)
226{ 226{
227 int status; 227 int status;
228 228
@@ -264,7 +264,7 @@ MODULE_PARM_DESC(use_eem, "use CDC EEM mode");
264/* 264/*
265 * We _always_ have an ECM, CDC Subset, or EEM configuration. 265 * We _always_ have an ECM, CDC Subset, or EEM configuration.
266 */ 266 */
267static int __init eth_do_config(struct usb_configuration *c) 267static int eth_do_config(struct usb_configuration *c)
268{ 268{
269 int status = 0; 269 int status = 0;
270 270
@@ -318,7 +318,7 @@ static struct usb_configuration eth_config_driver = {
318 318
319/*-------------------------------------------------------------------------*/ 319/*-------------------------------------------------------------------------*/
320 320
321static int __init eth_bind(struct usb_composite_dev *cdev) 321static int eth_bind(struct usb_composite_dev *cdev)
322{ 322{
323 struct usb_gadget *gadget = cdev->gadget; 323 struct usb_gadget *gadget = cdev->gadget;
324 struct f_eem_opts *eem_opts = NULL; 324 struct f_eem_opts *eem_opts = NULL;
@@ -447,7 +447,7 @@ fail:
447 return status; 447 return status;
448} 448}
449 449
450static int __exit eth_unbind(struct usb_composite_dev *cdev) 450static int eth_unbind(struct usb_composite_dev *cdev)
451{ 451{
452 if (has_rndis()) { 452 if (has_rndis()) {
453 usb_put_function(f_rndis); 453 usb_put_function(f_rndis);
@@ -466,13 +466,13 @@ static int __exit eth_unbind(struct usb_composite_dev *cdev)
466 return 0; 466 return 0;
467} 467}
468 468
469static __refdata struct usb_composite_driver eth_driver = { 469static struct usb_composite_driver eth_driver = {
470 .name = "g_ether", 470 .name = "g_ether",
471 .dev = &device_desc, 471 .dev = &device_desc,
472 .strings = dev_strings, 472 .strings = dev_strings,
473 .max_speed = USB_SPEED_SUPER, 473 .max_speed = USB_SPEED_SUPER,
474 .bind = eth_bind, 474 .bind = eth_bind,
475 .unbind = __exit_p(eth_unbind), 475 .unbind = eth_unbind,
476}; 476};
477 477
478module_usb_composite_driver(eth_driver); 478module_usb_composite_driver(eth_driver);
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c
index b01b88e1b716..7b9ef7e257d2 100644
--- a/drivers/usb/gadget/legacy/g_ffs.c
+++ b/drivers/usb/gadget/legacy/g_ffs.c
@@ -163,7 +163,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev);
163static int gfs_do_config(struct usb_configuration *c); 163static int gfs_do_config(struct usb_configuration *c);
164 164
165 165
166static __refdata struct usb_composite_driver gfs_driver = { 166static struct usb_composite_driver gfs_driver = {
167 .name = DRIVER_NAME, 167 .name = DRIVER_NAME,
168 .dev = &gfs_dev_desc, 168 .dev = &gfs_dev_desc,
169 .strings = gfs_dev_strings, 169 .strings = gfs_dev_strings,
diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c
index e02a095294ac..da19c486b61e 100644
--- a/drivers/usb/gadget/legacy/gmidi.c
+++ b/drivers/usb/gadget/legacy/gmidi.c
@@ -118,7 +118,7 @@ static struct usb_gadget_strings *dev_strings[] = {
118static struct usb_function_instance *fi_midi; 118static struct usb_function_instance *fi_midi;
119static struct usb_function *f_midi; 119static struct usb_function *f_midi;
120 120
121static int __exit midi_unbind(struct usb_composite_dev *dev) 121static int midi_unbind(struct usb_composite_dev *dev)
122{ 122{
123 usb_put_function(f_midi); 123 usb_put_function(f_midi);
124 usb_put_function_instance(fi_midi); 124 usb_put_function_instance(fi_midi);
@@ -133,7 +133,7 @@ static struct usb_configuration midi_config = {
133 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, 133 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW,
134}; 134};
135 135
136static int __init midi_bind_config(struct usb_configuration *c) 136static int midi_bind_config(struct usb_configuration *c)
137{ 137{
138 int status; 138 int status;
139 139
@@ -150,7 +150,7 @@ static int __init midi_bind_config(struct usb_configuration *c)
150 return 0; 150 return 0;
151} 151}
152 152
153static int __init midi_bind(struct usb_composite_dev *cdev) 153static int midi_bind(struct usb_composite_dev *cdev)
154{ 154{
155 struct f_midi_opts *midi_opts; 155 struct f_midi_opts *midi_opts;
156 int status; 156 int status;
@@ -185,13 +185,13 @@ put:
185 return status; 185 return status;
186} 186}
187 187
188static __refdata struct usb_composite_driver midi_driver = { 188static struct usb_composite_driver midi_driver = {
189 .name = (char *) longname, 189 .name = (char *) longname,
190 .dev = &device_desc, 190 .dev = &device_desc,
191 .strings = dev_strings, 191 .strings = dev_strings,
192 .max_speed = USB_SPEED_HIGH, 192 .max_speed = USB_SPEED_HIGH,
193 .bind = midi_bind, 193 .bind = midi_bind,
194 .unbind = __exit_p(midi_unbind), 194 .unbind = midi_unbind,
195}; 195};
196 196
197module_usb_composite_driver(midi_driver); 197module_usb_composite_driver(midi_driver);
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
index 614b06d80b41..2baa572686c6 100644
--- a/drivers/usb/gadget/legacy/hid.c
+++ b/drivers/usb/gadget/legacy/hid.c
@@ -106,7 +106,7 @@ static struct usb_gadget_strings *dev_strings[] = {
106 106
107/****************************** Configurations ******************************/ 107/****************************** Configurations ******************************/
108 108
109static int __init do_config(struct usb_configuration *c) 109static int do_config(struct usb_configuration *c)
110{ 110{
111 struct hidg_func_node *e, *n; 111 struct hidg_func_node *e, *n;
112 int status = 0; 112 int status = 0;
@@ -147,7 +147,7 @@ static struct usb_configuration config_driver = {
147 147
148/****************************** Gadget Bind ******************************/ 148/****************************** Gadget Bind ******************************/
149 149
150static int __init hid_bind(struct usb_composite_dev *cdev) 150static int hid_bind(struct usb_composite_dev *cdev)
151{ 151{
152 struct usb_gadget *gadget = cdev->gadget; 152 struct usb_gadget *gadget = cdev->gadget;
153 struct list_head *tmp; 153 struct list_head *tmp;
@@ -205,7 +205,7 @@ put:
205 return status; 205 return status;
206} 206}
207 207
208static int __exit hid_unbind(struct usb_composite_dev *cdev) 208static int hid_unbind(struct usb_composite_dev *cdev)
209{ 209{
210 struct hidg_func_node *n; 210 struct hidg_func_node *n;
211 211
@@ -216,7 +216,7 @@ static int __exit hid_unbind(struct usb_composite_dev *cdev)
216 return 0; 216 return 0;
217} 217}
218 218
219static int __init hidg_plat_driver_probe(struct platform_device *pdev) 219static int hidg_plat_driver_probe(struct platform_device *pdev)
220{ 220{
221 struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev); 221 struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev);
222 struct hidg_func_node *entry; 222 struct hidg_func_node *entry;
@@ -252,13 +252,13 @@ static int hidg_plat_driver_remove(struct platform_device *pdev)
252/****************************** Some noise ******************************/ 252/****************************** Some noise ******************************/
253 253
254 254
255static __refdata struct usb_composite_driver hidg_driver = { 255static struct usb_composite_driver hidg_driver = {
256 .name = "g_hid", 256 .name = "g_hid",
257 .dev = &device_desc, 257 .dev = &device_desc,
258 .strings = dev_strings, 258 .strings = dev_strings,
259 .max_speed = USB_SPEED_HIGH, 259 .max_speed = USB_SPEED_HIGH,
260 .bind = hid_bind, 260 .bind = hid_bind,
261 .unbind = __exit_p(hid_unbind), 261 .unbind = hid_unbind,
262}; 262};
263 263
264static struct platform_driver hidg_plat_driver = { 264static struct platform_driver hidg_plat_driver = {
diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c
index 8e27a8c96444..e7bfb081f111 100644
--- a/drivers/usb/gadget/legacy/mass_storage.c
+++ b/drivers/usb/gadget/legacy/mass_storage.c
@@ -130,7 +130,7 @@ static int msg_thread_exits(struct fsg_common *common)
130 return 0; 130 return 0;
131} 131}
132 132
133static int __init msg_do_config(struct usb_configuration *c) 133static int msg_do_config(struct usb_configuration *c)
134{ 134{
135 struct fsg_opts *opts; 135 struct fsg_opts *opts;
136 int ret; 136 int ret;
@@ -170,7 +170,7 @@ static struct usb_configuration msg_config_driver = {
170 170
171/****************************** Gadget Bind ******************************/ 171/****************************** Gadget Bind ******************************/
172 172
173static int __init msg_bind(struct usb_composite_dev *cdev) 173static int msg_bind(struct usb_composite_dev *cdev)
174{ 174{
175 static const struct fsg_operations ops = { 175 static const struct fsg_operations ops = {
176 .thread_exits = msg_thread_exits, 176 .thread_exits = msg_thread_exits,
@@ -248,7 +248,7 @@ static int msg_unbind(struct usb_composite_dev *cdev)
248 248
249/****************************** Some noise ******************************/ 249/****************************** Some noise ******************************/
250 250
251static __refdata struct usb_composite_driver msg_driver = { 251static struct usb_composite_driver msg_driver = {
252 .name = "g_mass_storage", 252 .name = "g_mass_storage",
253 .dev = &msg_device_desc, 253 .dev = &msg_device_desc,
254 .max_speed = USB_SPEED_SUPER, 254 .max_speed = USB_SPEED_SUPER,
diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c
index 39d27bb343b4..b21b51f0c9fa 100644
--- a/drivers/usb/gadget/legacy/multi.c
+++ b/drivers/usb/gadget/legacy/multi.c
@@ -149,7 +149,7 @@ static struct usb_function *f_acm_rndis;
149static struct usb_function *f_rndis; 149static struct usb_function *f_rndis;
150static struct usb_function *f_msg_rndis; 150static struct usb_function *f_msg_rndis;
151 151
152static __init int rndis_do_config(struct usb_configuration *c) 152static int rndis_do_config(struct usb_configuration *c)
153{ 153{
154 struct fsg_opts *fsg_opts; 154 struct fsg_opts *fsg_opts;
155 int ret; 155 int ret;
@@ -237,7 +237,7 @@ static struct usb_function *f_acm_multi;
237static struct usb_function *f_ecm; 237static struct usb_function *f_ecm;
238static struct usb_function *f_msg_multi; 238static struct usb_function *f_msg_multi;
239 239
240static __init int cdc_do_config(struct usb_configuration *c) 240static int cdc_do_config(struct usb_configuration *c)
241{ 241{
242 struct fsg_opts *fsg_opts; 242 struct fsg_opts *fsg_opts;
243 int ret; 243 int ret;
@@ -466,7 +466,7 @@ fail:
466 return status; 466 return status;
467} 467}
468 468
469static int __exit multi_unbind(struct usb_composite_dev *cdev) 469static int multi_unbind(struct usb_composite_dev *cdev)
470{ 470{
471#ifdef CONFIG_USB_G_MULTI_CDC 471#ifdef CONFIG_USB_G_MULTI_CDC
472 usb_put_function(f_msg_multi); 472 usb_put_function(f_msg_multi);
@@ -497,13 +497,13 @@ static int __exit multi_unbind(struct usb_composite_dev *cdev)
497/****************************** Some noise ******************************/ 497/****************************** Some noise ******************************/
498 498
499 499
500static __refdata struct usb_composite_driver multi_driver = { 500static struct usb_composite_driver multi_driver = {
501 .name = "g_multi", 501 .name = "g_multi",
502 .dev = &device_desc, 502 .dev = &device_desc,
503 .strings = dev_strings, 503 .strings = dev_strings,
504 .max_speed = USB_SPEED_HIGH, 504 .max_speed = USB_SPEED_HIGH,
505 .bind = multi_bind, 505 .bind = multi_bind,
506 .unbind = __exit_p(multi_unbind), 506 .unbind = multi_unbind,
507 .needs_serial = 1, 507 .needs_serial = 1,
508}; 508};
509 509
diff --git a/drivers/usb/gadget/legacy/ncm.c b/drivers/usb/gadget/legacy/ncm.c
index e90e23db2acb..6ce7421412e9 100644
--- a/drivers/usb/gadget/legacy/ncm.c
+++ b/drivers/usb/gadget/legacy/ncm.c
@@ -107,7 +107,7 @@ static struct usb_function *f_ncm;
107 107
108/*-------------------------------------------------------------------------*/ 108/*-------------------------------------------------------------------------*/
109 109
110static int __init ncm_do_config(struct usb_configuration *c) 110static int ncm_do_config(struct usb_configuration *c)
111{ 111{
112 int status; 112 int status;
113 113
@@ -143,7 +143,7 @@ static struct usb_configuration ncm_config_driver = {
143 143
144/*-------------------------------------------------------------------------*/ 144/*-------------------------------------------------------------------------*/
145 145
146static int __init gncm_bind(struct usb_composite_dev *cdev) 146static int gncm_bind(struct usb_composite_dev *cdev)
147{ 147{
148 struct usb_gadget *gadget = cdev->gadget; 148 struct usb_gadget *gadget = cdev->gadget;
149 struct f_ncm_opts *ncm_opts; 149 struct f_ncm_opts *ncm_opts;
@@ -186,7 +186,7 @@ fail:
186 return status; 186 return status;
187} 187}
188 188
189static int __exit gncm_unbind(struct usb_composite_dev *cdev) 189static int gncm_unbind(struct usb_composite_dev *cdev)
190{ 190{
191 if (!IS_ERR_OR_NULL(f_ncm)) 191 if (!IS_ERR_OR_NULL(f_ncm))
192 usb_put_function(f_ncm); 192 usb_put_function(f_ncm);
@@ -195,13 +195,13 @@ static int __exit gncm_unbind(struct usb_composite_dev *cdev)
195 return 0; 195 return 0;
196} 196}
197 197
198static __refdata struct usb_composite_driver ncm_driver = { 198static struct usb_composite_driver ncm_driver = {
199 .name = "g_ncm", 199 .name = "g_ncm",
200 .dev = &device_desc, 200 .dev = &device_desc,
201 .strings = dev_strings, 201 .strings = dev_strings,
202 .max_speed = USB_SPEED_HIGH, 202 .max_speed = USB_SPEED_HIGH,
203 .bind = gncm_bind, 203 .bind = gncm_bind,
204 .unbind = __exit_p(gncm_unbind), 204 .unbind = gncm_unbind,
205}; 205};
206 206
207module_usb_composite_driver(ncm_driver); 207module_usb_composite_driver(ncm_driver);
diff --git a/drivers/usb/gadget/legacy/nokia.c b/drivers/usb/gadget/legacy/nokia.c
index 9b8fd701648c..4bb498a38a1c 100644
--- a/drivers/usb/gadget/legacy/nokia.c
+++ b/drivers/usb/gadget/legacy/nokia.c
@@ -118,7 +118,7 @@ static struct usb_function_instance *fi_obex1;
118static struct usb_function_instance *fi_obex2; 118static struct usb_function_instance *fi_obex2;
119static struct usb_function_instance *fi_phonet; 119static struct usb_function_instance *fi_phonet;
120 120
121static int __init nokia_bind_config(struct usb_configuration *c) 121static int nokia_bind_config(struct usb_configuration *c)
122{ 122{
123 struct usb_function *f_acm; 123 struct usb_function *f_acm;
124 struct usb_function *f_phonet = NULL; 124 struct usb_function *f_phonet = NULL;
@@ -224,7 +224,7 @@ err_get_acm:
224 return status; 224 return status;
225} 225}
226 226
227static int __init nokia_bind(struct usb_composite_dev *cdev) 227static int nokia_bind(struct usb_composite_dev *cdev)
228{ 228{
229 struct usb_gadget *gadget = cdev->gadget; 229 struct usb_gadget *gadget = cdev->gadget;
230 int status; 230 int status;
@@ -307,7 +307,7 @@ err_usb:
307 return status; 307 return status;
308} 308}
309 309
310static int __exit nokia_unbind(struct usb_composite_dev *cdev) 310static int nokia_unbind(struct usb_composite_dev *cdev)
311{ 311{
312 if (!IS_ERR_OR_NULL(f_obex1_cfg2)) 312 if (!IS_ERR_OR_NULL(f_obex1_cfg2))
313 usb_put_function(f_obex1_cfg2); 313 usb_put_function(f_obex1_cfg2);
@@ -338,13 +338,13 @@ static int __exit nokia_unbind(struct usb_composite_dev *cdev)
338 return 0; 338 return 0;
339} 339}
340 340
341static __refdata struct usb_composite_driver nokia_driver = { 341static struct usb_composite_driver nokia_driver = {
342 .name = "g_nokia", 342 .name = "g_nokia",
343 .dev = &device_desc, 343 .dev = &device_desc,
344 .strings = dev_strings, 344 .strings = dev_strings,
345 .max_speed = USB_SPEED_HIGH, 345 .max_speed = USB_SPEED_HIGH,
346 .bind = nokia_bind, 346 .bind = nokia_bind,
347 .unbind = __exit_p(nokia_unbind), 347 .unbind = nokia_unbind,
348}; 348};
349 349
350module_usb_composite_driver(nokia_driver); 350module_usb_composite_driver(nokia_driver);
diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
index d5b6ee725a2a..1ce7df1060a5 100644
--- a/drivers/usb/gadget/legacy/printer.c
+++ b/drivers/usb/gadget/legacy/printer.c
@@ -126,7 +126,7 @@ static struct usb_configuration printer_cfg_driver = {
126 .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, 126 .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
127}; 127};
128 128
129static int __init printer_do_config(struct usb_configuration *c) 129static int printer_do_config(struct usb_configuration *c)
130{ 130{
131 struct usb_gadget *gadget = c->cdev->gadget; 131 struct usb_gadget *gadget = c->cdev->gadget;
132 int status = 0; 132 int status = 0;
@@ -152,7 +152,7 @@ static int __init printer_do_config(struct usb_configuration *c)
152 return status; 152 return status;
153} 153}
154 154
155static int __init printer_bind(struct usb_composite_dev *cdev) 155static int printer_bind(struct usb_composite_dev *cdev)
156{ 156{
157 struct f_printer_opts *opts; 157 struct f_printer_opts *opts;
158 int ret, len; 158 int ret, len;
@@ -191,7 +191,7 @@ static int __init printer_bind(struct usb_composite_dev *cdev)
191 return ret; 191 return ret;
192} 192}
193 193
194static int __exit printer_unbind(struct usb_composite_dev *cdev) 194static int printer_unbind(struct usb_composite_dev *cdev)
195{ 195{
196 usb_put_function(f_printer); 196 usb_put_function(f_printer);
197 usb_put_function_instance(fi_printer); 197 usb_put_function_instance(fi_printer);
@@ -199,7 +199,7 @@ static int __exit printer_unbind(struct usb_composite_dev *cdev)
199 return 0; 199 return 0;
200} 200}
201 201
202static __refdata struct usb_composite_driver printer_driver = { 202static struct usb_composite_driver printer_driver = {
203 .name = shortname, 203 .name = shortname,
204 .dev = &device_desc, 204 .dev = &device_desc,
205 .strings = dev_strings, 205 .strings = dev_strings,
diff --git a/drivers/usb/gadget/legacy/serial.c b/drivers/usb/gadget/legacy/serial.c
index 1f5f978d35d5..8b7528f9b78e 100644
--- a/drivers/usb/gadget/legacy/serial.c
+++ b/drivers/usb/gadget/legacy/serial.c
@@ -174,7 +174,7 @@ out:
174 return ret; 174 return ret;
175} 175}
176 176
177static int __init gs_bind(struct usb_composite_dev *cdev) 177static int gs_bind(struct usb_composite_dev *cdev)
178{ 178{
179 int status; 179 int status;
180 180
@@ -230,7 +230,7 @@ static int gs_unbind(struct usb_composite_dev *cdev)
230 return 0; 230 return 0;
231} 231}
232 232
233static __refdata struct usb_composite_driver gserial_driver = { 233static struct usb_composite_driver gserial_driver = {
234 .name = "g_serial", 234 .name = "g_serial",
235 .dev = &device_desc, 235 .dev = &device_desc,
236 .strings = dev_strings, 236 .strings = dev_strings,
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 8b80addc4ce6..f9b4882fce52 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -2397,7 +2397,7 @@ static int usb_target_bind(struct usb_composite_dev *cdev)
2397 return 0; 2397 return 0;
2398} 2398}
2399 2399
2400static __refdata struct usb_composite_driver usbg_driver = { 2400static struct usb_composite_driver usbg_driver = {
2401 .name = "g_target", 2401 .name = "g_target",
2402 .dev = &usbg_device_desc, 2402 .dev = &usbg_device_desc,
2403 .strings = usbg_strings, 2403 .strings = usbg_strings,
diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
index 04a3da20f742..72c976bf3530 100644
--- a/drivers/usb/gadget/legacy/webcam.c
+++ b/drivers/usb/gadget/legacy/webcam.c
@@ -334,7 +334,7 @@ static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = {
334 * USB configuration 334 * USB configuration
335 */ 335 */
336 336
337static int __init 337static int
338webcam_config_bind(struct usb_configuration *c) 338webcam_config_bind(struct usb_configuration *c)
339{ 339{
340 int status = 0; 340 int status = 0;
@@ -358,7 +358,7 @@ static struct usb_configuration webcam_config_driver = {
358 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, 358 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW,
359}; 359};
360 360
361static int /* __init_or_exit */ 361static int
362webcam_unbind(struct usb_composite_dev *cdev) 362webcam_unbind(struct usb_composite_dev *cdev)
363{ 363{
364 if (!IS_ERR_OR_NULL(f_uvc)) 364 if (!IS_ERR_OR_NULL(f_uvc))
@@ -368,7 +368,7 @@ webcam_unbind(struct usb_composite_dev *cdev)
368 return 0; 368 return 0;
369} 369}
370 370
371static int __init 371static int
372webcam_bind(struct usb_composite_dev *cdev) 372webcam_bind(struct usb_composite_dev *cdev)
373{ 373{
374 struct f_uvc_opts *uvc_opts; 374 struct f_uvc_opts *uvc_opts;
@@ -422,7 +422,7 @@ error:
422 * Driver 422 * Driver
423 */ 423 */
424 424
425static __refdata struct usb_composite_driver webcam_driver = { 425static struct usb_composite_driver webcam_driver = {
426 .name = "g_webcam", 426 .name = "g_webcam",
427 .dev = &webcam_device_descriptor, 427 .dev = &webcam_device_descriptor,
428 .strings = webcam_device_strings, 428 .strings = webcam_device_strings,
diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c
index 5ee95152493c..c986e8addb90 100644
--- a/drivers/usb/gadget/legacy/zero.c
+++ b/drivers/usb/gadget/legacy/zero.c
@@ -272,7 +272,7 @@ static struct usb_function_instance *func_inst_lb;
272module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR); 272module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR);
273MODULE_PARM_DESC(qlen, "depth of loopback queue"); 273MODULE_PARM_DESC(qlen, "depth of loopback queue");
274 274
275static int __init zero_bind(struct usb_composite_dev *cdev) 275static int zero_bind(struct usb_composite_dev *cdev)
276{ 276{
277 struct f_ss_opts *ss_opts; 277 struct f_ss_opts *ss_opts;
278 struct f_lb_opts *lb_opts; 278 struct f_lb_opts *lb_opts;
@@ -400,7 +400,7 @@ static int zero_unbind(struct usb_composite_dev *cdev)
400 return 0; 400 return 0;
401} 401}
402 402
403static __refdata struct usb_composite_driver zero_driver = { 403static struct usb_composite_driver zero_driver = {
404 .name = "zero", 404 .name = "zero",
405 .dev = &device_desc, 405 .dev = &device_desc,
406 .strings = dev_strings, 406 .strings = dev_strings,
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
index 2fbedca3c2b4..fc4226462f8f 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -1942,7 +1942,7 @@ err_unprepare_fclk:
1942 return retval; 1942 return retval;
1943} 1943}
1944 1944
1945static int __exit at91udc_remove(struct platform_device *pdev) 1945static int at91udc_remove(struct platform_device *pdev)
1946{ 1946{
1947 struct at91_udc *udc = platform_get_drvdata(pdev); 1947 struct at91_udc *udc = platform_get_drvdata(pdev);
1948 unsigned long flags; 1948 unsigned long flags;
@@ -2018,7 +2018,7 @@ static int at91udc_resume(struct platform_device *pdev)
2018#endif 2018#endif
2019 2019
2020static struct platform_driver at91_udc_driver = { 2020static struct platform_driver at91_udc_driver = {
2021 .remove = __exit_p(at91udc_remove), 2021 .remove = at91udc_remove,
2022 .shutdown = at91udc_shutdown, 2022 .shutdown = at91udc_shutdown,
2023 .suspend = at91udc_suspend, 2023 .suspend = at91udc_suspend,
2024 .resume = at91udc_resume, 2024 .resume = at91udc_resume,
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 4c01953a0869..351d48550c33 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2186,7 +2186,7 @@ static int usba_udc_probe(struct platform_device *pdev)
2186 return 0; 2186 return 0;
2187} 2187}
2188 2188
2189static int __exit usba_udc_remove(struct platform_device *pdev) 2189static int usba_udc_remove(struct platform_device *pdev)
2190{ 2190{
2191 struct usba_udc *udc; 2191 struct usba_udc *udc;
2192 int i; 2192 int i;
@@ -2258,7 +2258,7 @@ static int usba_udc_resume(struct device *dev)
2258static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume); 2258static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume);
2259 2259
2260static struct platform_driver udc_driver = { 2260static struct platform_driver udc_driver = {
2261 .remove = __exit_p(usba_udc_remove), 2261 .remove = usba_udc_remove,
2262 .driver = { 2262 .driver = {
2263 .name = "atmel_usba_udc", 2263 .name = "atmel_usba_udc",
2264 .pm = &usba_udc_pm_ops, 2264 .pm = &usba_udc_pm_ops,
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 55fcb930f92e..c60022b46a48 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2525,7 +2525,7 @@ err_kfree:
2525/* Driver removal function 2525/* Driver removal function
2526 * Free resources and finish pending transactions 2526 * Free resources and finish pending transactions
2527 */ 2527 */
2528static int __exit fsl_udc_remove(struct platform_device *pdev) 2528static int fsl_udc_remove(struct platform_device *pdev)
2529{ 2529{
2530 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2530 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2531 struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); 2531 struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
@@ -2663,7 +2663,7 @@ static const struct platform_device_id fsl_udc_devtype[] = {
2663}; 2663};
2664MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); 2664MODULE_DEVICE_TABLE(platform, fsl_udc_devtype);
2665static struct platform_driver udc_driver = { 2665static struct platform_driver udc_driver = {
2666 .remove = __exit_p(fsl_udc_remove), 2666 .remove = fsl_udc_remove,
2667 /* Just for FSL i.mx SoC currently */ 2667 /* Just for FSL i.mx SoC currently */
2668 .id_table = fsl_udc_devtype, 2668 .id_table = fsl_udc_devtype,
2669 /* these suspend and resume are not usb suspend and resume */ 2669 /* these suspend and resume are not usb suspend and resume */
diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c
index fb4df159d32d..3970f453de49 100644
--- a/drivers/usb/gadget/udc/fusb300_udc.c
+++ b/drivers/usb/gadget/udc/fusb300_udc.c
@@ -1342,7 +1342,7 @@ static const struct usb_gadget_ops fusb300_gadget_ops = {
1342 .udc_stop = fusb300_udc_stop, 1342 .udc_stop = fusb300_udc_stop,
1343}; 1343};
1344 1344
1345static int __exit fusb300_remove(struct platform_device *pdev) 1345static int fusb300_remove(struct platform_device *pdev)
1346{ 1346{
1347 struct fusb300 *fusb300 = platform_get_drvdata(pdev); 1347 struct fusb300 *fusb300 = platform_get_drvdata(pdev);
1348 1348
@@ -1492,7 +1492,7 @@ clean_up:
1492} 1492}
1493 1493
1494static struct platform_driver fusb300_driver = { 1494static struct platform_driver fusb300_driver = {
1495 .remove = __exit_p(fusb300_remove), 1495 .remove = fusb300_remove,
1496 .driver = { 1496 .driver = {
1497 .name = (char *) udc_name, 1497 .name = (char *) udc_name,
1498 }, 1498 },
diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
index 8c7c83c93713..309706fe4bf0 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1528,7 +1528,7 @@ static const struct usb_gadget_ops m66592_gadget_ops = {
1528 .pullup = m66592_pullup, 1528 .pullup = m66592_pullup,
1529}; 1529};
1530 1530
1531static int __exit m66592_remove(struct platform_device *pdev) 1531static int m66592_remove(struct platform_device *pdev)
1532{ 1532{
1533 struct m66592 *m66592 = platform_get_drvdata(pdev); 1533 struct m66592 *m66592 = platform_get_drvdata(pdev);
1534 1534
@@ -1695,7 +1695,7 @@ clean_up:
1695 1695
1696/*-------------------------------------------------------------------------*/ 1696/*-------------------------------------------------------------------------*/
1697static struct platform_driver m66592_driver = { 1697static struct platform_driver m66592_driver = {
1698 .remove = __exit_p(m66592_remove), 1698 .remove = m66592_remove,
1699 .driver = { 1699 .driver = {
1700 .name = (char *) udc_name, 1700 .name = (char *) udc_name,
1701 }, 1701 },
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
index 2495fe9c95c5..0293f7169dee 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1820,7 +1820,7 @@ static const struct usb_gadget_ops r8a66597_gadget_ops = {
1820 .set_selfpowered = r8a66597_set_selfpowered, 1820 .set_selfpowered = r8a66597_set_selfpowered,
1821}; 1821};
1822 1822
1823static int __exit r8a66597_remove(struct platform_device *pdev) 1823static int r8a66597_remove(struct platform_device *pdev)
1824{ 1824{
1825 struct r8a66597 *r8a66597 = platform_get_drvdata(pdev); 1825 struct r8a66597 *r8a66597 = platform_get_drvdata(pdev);
1826 1826
@@ -1974,7 +1974,7 @@ clean_up2:
1974 1974
1975/*-------------------------------------------------------------------------*/ 1975/*-------------------------------------------------------------------------*/
1976static struct platform_driver r8a66597_driver = { 1976static struct platform_driver r8a66597_driver = {
1977 .remove = __exit_p(r8a66597_remove), 1977 .remove = r8a66597_remove,
1978 .driver = { 1978 .driver = {
1979 .name = (char *) udc_name, 1979 .name = (char *) udc_name,
1980 }, 1980 },