aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/nokia.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 21:10:12 +0100
committerFelipe Balbi <balbi@ti.com>2013-04-03 14:43:31 +0300
commitd6a0143985489e470a118605352f4b18df0ce142 (patch)
tree9fe2505807f5d5a721914dcb175542d4e342e414 /drivers/usb/gadget/nokia.c
parentusb: gadget: nokia: use function framework for ACM (diff)
downloadlinux-dev-d6a0143985489e470a118605352f4b18df0ce142.tar.xz
linux-dev-d6a0143985489e470a118605352f4b18df0ce142.zip
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>
Diffstat (limited to 'drivers/usb/gadget/nokia.c')
-rw-r--r--drivers/usb/gadget/nokia.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index c3ad777a2bd1..0c13ddd78bef 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -99,6 +99,7 @@ MODULE_LICENSE("GPL");
static struct usb_function *f_acm_cfg1;
static struct usb_function *f_acm_cfg2;
static u8 hostaddr[ETH_ALEN];
+static struct eth_dev *the_dev;
enum {
TTY_PORT_OBEX0,
@@ -152,7 +153,7 @@ static int __init nokia_bind_config(struct usb_configuration *c)
if (status)
goto err_conf;
- status = ecm_bind_config(c, hostaddr);
+ status = ecm_bind_config(c, hostaddr, the_dev);
if (status) {
pr_debug("could not bind ecm config %d\n", status);
goto err_ecm;
@@ -187,9 +188,11 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
goto err_ether;
}
- status = gether_setup(cdev->gadget, hostaddr);
- if (status < 0)
+ the_dev = gether_setup(cdev->gadget, hostaddr);
+ if (IS_ERR(the_dev)) {
+ status = PTR_ERR(the_dev);
goto err_ether;
+ }
status = usb_string_ids_tab(cdev, strings_dev);
if (status < 0)
@@ -230,7 +233,7 @@ err_put_cfg1:
err_acm_inst:
usb_put_function_instance(fi_acm);
err_usb:
- gether_cleanup();
+ gether_cleanup(the_dev);
err_ether:
cur_line--;
while (cur_line >= 0)
@@ -253,7 +256,7 @@ static int __exit nokia_unbind(struct usb_composite_dev *cdev)
for (i = 0; i < TTY_PORTS_MAX; i++)
gserial_free_line(tty_lines[i]);
- gether_cleanup();
+ gether_cleanup(the_dev);
return 0;
}