diff options
Diffstat (limited to 'drivers/usb/gadget/mass_storage.c')
-rw-r--r-- | drivers/usb/gadget/mass_storage.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index 705cc1f7632..585f2559484 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c @@ -141,9 +141,14 @@ static int msg_thread_exits(struct fsg_common *common) return 0; } -static int __init msg_do_config(struct usb_configuration *c) +static int __ref msg_do_config(struct usb_configuration *c) { - struct fsg_common *common; + static const struct fsg_operations ops = { + .thread_exits = msg_thread_exits, + }; + static struct fsg_common common; + + struct fsg_common *retp; struct fsg_config config; int ret; @@ -153,13 +158,14 @@ static int __init msg_do_config(struct usb_configuration *c) } fsg_config_from_params(&config, &mod_data); - config.thread_exits = msg_thread_exits; - common = fsg_common_init(0, c->cdev, &config); - if (IS_ERR(common)) - return PTR_ERR(common); + config.ops = &ops; + + retp = fsg_common_init(&common, c->cdev, &config); + if (IS_ERR(retp)) + return PTR_ERR(retp); - ret = fsg_add(c->cdev, c, common); - fsg_common_put(common); + ret = fsg_bind_config(c->cdev, c, &common); + fsg_common_put(&common); return ret; } @@ -176,7 +182,7 @@ static struct usb_configuration msg_config_driver = { /****************************** Gadget Bind ******************************/ -static int __init msg_bind(struct usb_composite_dev *cdev) +static int __ref msg_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status; |