usb: gadget: rndis: init & exit rndis at module load/unload
This is required in preparation for using usb_gstrings_attach.
The rndis initialization so far has been performed on the first
occurence of rndis_bind(), but the condition to check it (first
or not first) was "borrowed" from strings handling.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index 437198b..e5c6aee 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -698,11 +698,6 @@
#endif
if (rndis_string_defs[0].id == 0) {
- /* ... and setup RNDIS itself */
- status = rndis_init();
- if (status < 0)
- return status;
-
status = usb_string_ids_tab(c->cdev, rndis_string_defs);
if (status)
return status;
@@ -844,7 +839,6 @@
struct f_rndis *rndis = func_to_rndis(f);
rndis_deregister(rndis->config);
- rndis_exit();
rndis_string_defs[0].id = 0;
usb_free_all_descriptors(f);
@@ -891,11 +885,9 @@
rndis->port.func.disable = rndis_disable;
status = usb_add_function(c, &rndis->port.func);
- if (status) {
+ if (status)
kfree(rndis);
fail:
- rndis_exit();
- }
return status;
}
@@ -958,7 +950,6 @@
{
struct f_rndis *rndis = func_to_rndis(f);
- rndis_exit();
rndis_string_defs[0].id = 0;
usb_free_all_descriptors(f);
@@ -974,10 +965,8 @@
/* allocate and initialize one new instance */
rndis = kzalloc(sizeof(*rndis), GFP_KERNEL);
- if (!rndis) {
- rndis_exit();
+ if (!rndis)
return ERR_PTR(-ENOMEM);
- }
opts = container_of(fi, struct f_rndis_opts, func_inst);