usb: gadget: move the global the_dev variable to their users
the u_ether.c file has a global variable named the_dev which keeps a
pointer to the network device after it has been created via
gether_setup_name(). It is only used internally by u_ether. This patches
moves the variable to its users and passes it via the port.ioport where
it is saved later anyway.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 20bbbf9..3442755 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -137,6 +137,7 @@
static unsigned char tty_line;
static struct usb_function_instance *fi_acm;
+static struct eth_dev *the_dev;
/********** RNDIS **********/
@@ -152,7 +153,7 @@
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
}
- ret = rndis_bind_config(c, hostaddr);
+ ret = rndis_bind_config(c, hostaddr, the_dev);
if (ret < 0)
return ret;
@@ -214,7 +215,7 @@
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
}
- ret = ecm_bind_config(c, hostaddr);
+ ret = ecm_bind_config(c, hostaddr, the_dev);
if (ret < 0)
return ret;
@@ -279,9 +280,9 @@
}
/* set up network link layer */
- status = gether_setup(cdev->gadget, hostaddr);
- if (status < 0)
- return status;
+ the_dev = gether_setup(cdev->gadget, hostaddr);
+ if (IS_ERR(the_dev))
+ return PTR_ERR(the_dev);
/* set up serial link layer */
status = gserial_alloc_line(&tty_line);
@@ -337,7 +338,7 @@
fail0dot5:
gserial_free_line(tty_line);
fail0:
- gether_cleanup();
+ gether_cleanup(the_dev);
return status;
}
@@ -351,7 +352,7 @@
#endif
usb_put_function_instance(fi_acm);
gserial_free_line(tty_line);
- gether_cleanup();
+ gether_cleanup(the_dev);
return 0;
}