Commit d277e1a3 authored by Robert Baldyga's avatar Robert Baldyga Committed by Felipe Balbi

usb: gadget: f_obex: 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_obex, 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: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 6b4012a2
...@@ -206,7 +206,7 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) ...@@ -206,7 +206,7 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
if (alt > 1) if (alt > 1)
goto fail; goto fail;
if (obex->port.in->driver_data) { if (obex->port.in->enabled) {
dev_dbg(&cdev->gadget->dev, dev_dbg(&cdev->gadget->dev,
"reset obex ttyGS%d\n", obex->port_num); "reset obex ttyGS%d\n", obex->port_num);
gserial_disconnect(&obex->port); gserial_disconnect(&obex->port);
...@@ -348,13 +348,11 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -348,13 +348,11 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
if (!ep) if (!ep)
goto fail; goto fail;
obex->port.in = ep; obex->port.in = ep;
ep->driver_data = cdev; /* claim */
ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_out_desc); ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_out_desc);
if (!ep) if (!ep)
goto fail; goto fail;
obex->port.out = ep; obex->port.out = ep;
ep->driver_data = cdev; /* claim */
/* support all relevant hardware speeds... we expect that when /* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at * hardware is dual speed, all bulk-capable endpoints work at
...@@ -378,12 +376,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -378,12 +376,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
return 0; return 0;
fail: fail:
/* we might as well release our claims on endpoints */
if (obex->port.out)
obex->port.out->driver_data = NULL;
if (obex->port.in)
obex->port.in->driver_data = NULL;
ERROR(cdev, "%s/%p: can't bind, err %d\n", f->name, f, status); ERROR(cdev, "%s/%p: can't bind, err %d\n", f->name, f, status);
return status; return status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment