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) | |||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
143 | 143 | ||
144 | static int __init msg_do_config(struct usb_configuration *c) | 144 | static int __ref msg_do_config(struct usb_configuration *c) |
145 | { | 145 | { |
146 | struct fsg_common *common; | 146 | static const struct fsg_operations ops = { |
147 | .thread_exits = msg_thread_exits, | ||
148 | }; | ||
149 | static struct fsg_common common; | ||
150 | |||
151 | struct fsg_common *retp; | ||
147 | struct fsg_config config; | 152 | struct fsg_config config; |
148 | int ret; | 153 | int ret; |
149 | 154 | ||
@@ -153,13 +158,14 @@ static int __init msg_do_config(struct usb_configuration *c) | |||
153 | } | 158 | } |
154 | 159 | ||
155 | fsg_config_from_params(&config, &mod_data); | 160 | fsg_config_from_params(&config, &mod_data); |
156 | config.thread_exits = msg_thread_exits; | 161 | config.ops = &ops; |
157 | common = fsg_common_init(0, c->cdev, &config); | 162 | |
158 | if (IS_ERR(common)) | 163 | retp = fsg_common_init(&common, c->cdev, &config); |
159 | return PTR_ERR(common); | 164 | if (IS_ERR(retp)) |
165 | return PTR_ERR(retp); | ||
160 | 166 | ||
161 | ret = fsg_add(c->cdev, c, common); | 167 | ret = fsg_bind_config(c->cdev, c, &common); |
162 | fsg_common_put(common); | 168 | fsg_common_put(&common); |
163 | return ret; | 169 | return ret; |
164 | } | 170 | } |
165 | 171 | ||
@@ -176,7 +182,7 @@ static struct usb_configuration msg_config_driver = { | |||
176 | /****************************** Gadget Bind ******************************/ | 182 | /****************************** Gadget Bind ******************************/ |
177 | 183 | ||
178 | 184 | ||
179 | static int __init msg_bind(struct usb_composite_dev *cdev) | 185 | static int __ref msg_bind(struct usb_composite_dev *cdev) |
180 | { | 186 | { |
181 | struct usb_gadget *gadget = cdev->gadget; | 187 | struct usb_gadget *gadget = cdev->gadget; |
182 | int status; | 188 | int status; |