aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/gadget/function/f_serial.c
diff options
context:
space:
mode:
authorRobert Baldyga <r.baldyga@samsung.com>2015-09-16 12:10:55 +0200
committerFelipe Balbi <balbi@ti.com>2015-09-27 10:54:31 -0500
commit885d22eb84a5f634e3776676e5d42f9931899d06 (patch)
tree21d85e54b837f17f3efea410b3842ba71d98d2b5 /drivers/usb/gadget/function/f_serial.c
parentusb: gadget: f_rndis: eliminate abuse of ep->driver data (diff)
downloadwireguard-linux-885d22eb84a5f634e3776676e5d42f9931899d06.tar.xz
wireguard-linux-885d22eb84a5f634e3776676e5d42f9931899d06.zip
usb: gadget: f_serial: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for enabled/disabled state storing, we can reduce number of places where we read or modify it's value, as now it has no particular meaning for function or framework logic. In case of f_serial, ep->driver_data was used only for endpoint claiming and marking endpoints as enabled, so we can simplify code by reducing it. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_serial.c')
-rw-r--r--drivers/usb/gadget/function/f_serial.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c
index 1d162e200e83..ba705e047d7e 100644
--- a/drivers/usb/gadget/function/f_serial.c
+++ b/drivers/usb/gadget/function/f_serial.c
@@ -153,7 +153,7 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
/* we know alt == 0, so this is an activation or a reset */
- if (gser->port.in->driver_data) {
+ if (gser->port.in->enabled) {
dev_dbg(&cdev->gadget->dev,
"reset generic ttyGS%d\n", gser->port_num);
gserial_disconnect(&gser->port);
@@ -219,13 +219,11 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f)
if (!ep)
goto fail;
gser->port.in = ep;
- ep->driver_data = cdev; /* claim */
ep = usb_ep_autoconfig(cdev->gadget, &gser_fs_out_desc);
if (!ep)
goto fail;
gser->port.out = ep;
- ep->driver_data = cdev; /* claim */
/* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
@@ -249,12 +247,6 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f)
return 0;
fail:
- /* we might as well release our claims on endpoints */
- if (gser->port.out)
- gser->port.out->driver_data = NULL;
- if (gser->port.in)
- gser->port.in->driver_data = NULL;
-
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status;