aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/multi.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 15:10:12 -0500
committerFelipe Balbi <balbi@ti.com>2013-04-03 07:43:31 -0400
commitd6a0143985489e470a118605352f4b18df0ce142 (patch)
tree9fe2505807f5d5a721914dcb175542d4e342e414 /drivers/usb/gadget/multi.c
parent15761826eecda192f4d1527e08c32193a03e94b7 (diff)
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/multi.c')
-rw-r--r--drivers/usb/gadget/multi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 20bbbf917fc2..34427553271e 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -137,6 +137,7 @@ static u8 hostaddr[ETH_ALEN];
137 137
138static unsigned char tty_line; 138static unsigned char tty_line;
139static struct usb_function_instance *fi_acm; 139static struct usb_function_instance *fi_acm;
140static struct eth_dev *the_dev;
140 141
141/********** RNDIS **********/ 142/********** RNDIS **********/
142 143
@@ -152,7 +153,7 @@ static __init int rndis_do_config(struct usb_configuration *c)
152 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; 153 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
153 } 154 }
154 155
155 ret = rndis_bind_config(c, hostaddr); 156 ret = rndis_bind_config(c, hostaddr, the_dev);
156 if (ret < 0) 157 if (ret < 0)
157 return ret; 158 return ret;
158 159
@@ -214,7 +215,7 @@ static __init int cdc_do_config(struct usb_configuration *c)
214 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; 215 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
215 } 216 }
216 217
217 ret = ecm_bind_config(c, hostaddr); 218 ret = ecm_bind_config(c, hostaddr, the_dev);
218 if (ret < 0) 219 if (ret < 0)
219 return ret; 220 return ret;
220 221
@@ -279,9 +280,9 @@ static int __ref multi_bind(struct usb_composite_dev *cdev)
279 } 280 }
280 281
281 /* set up network link layer */ 282 /* set up network link layer */
282 status = gether_setup(cdev->gadget, hostaddr); 283 the_dev = gether_setup(cdev->gadget, hostaddr);
283 if (status < 0) 284 if (IS_ERR(the_dev))
284 return status; 285 return PTR_ERR(the_dev);
285 286
286 /* set up serial link layer */ 287 /* set up serial link layer */
287 status = gserial_alloc_line(&tty_line); 288 status = gserial_alloc_line(&tty_line);
@@ -337,7 +338,7 @@ fail1:
337fail0dot5: 338fail0dot5:
338 gserial_free_line(tty_line); 339 gserial_free_line(tty_line);
339fail0: 340fail0:
340 gether_cleanup(); 341 gether_cleanup(the_dev);
341 return status; 342 return status;
342} 343}
343 344
@@ -351,7 +352,7 @@ static int __exit multi_unbind(struct usb_composite_dev *cdev)
351#endif 352#endif
352 usb_put_function_instance(fi_acm); 353 usb_put_function_instance(fi_acm);
353 gserial_free_line(tty_line); 354 gserial_free_line(tty_line);
354 gether_cleanup(); 355 gether_cleanup(the_dev);
355 return 0; 356 return 0;
356} 357}
357 358