Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1225225
| From | Robert Baldyga <r.baldyga@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 13/26] usb: gadget: f_obex: eliminate abuse of ep->driver data |
| Date | 2015-09-15 16:40 +0200 |
| Message-ID | <q8ZyP-7BR-43@gated-at.bofh.it> (permalink) |
| References | <q8Zp8-7qt-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Robert Baldyga <r.baldyga@samsung.com>
---
drivers/usb/gadget/function/f_obex.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c
index 5460426..1c3d30a 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -206,7 +206,7 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
if (alt > 1)
goto fail;
- if (obex->port.in->driver_data) {
+ if (obex->port.in->enabled) {
dev_dbg(&cdev->gadget->dev,
"reset obex ttyGS%d\n", obex->port_num);
gserial_disconnect(&obex->port);
@@ -348,13 +348,11 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
if (!ep)
goto fail;
obex->port.in = ep;
- ep->driver_data = cdev; /* claim */
ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_out_desc);
if (!ep)
goto fail;
obex->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
@@ -378,12 +376,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
return 0;
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);
return status;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/26] usb: gadget: encapsulate ep enable/disable Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:30 +0200
[PATCH 20/26] usb: gadget: f_uac1: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
[PATCH 21/26] usb: gadget: f_uac2: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
[PATCH 13/26] usb: gadget: f_obex: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
[PATCH 23/26] usb: gadget: u_ether: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
[PATCH 25/26] usb: gadget: legacy: dbgp: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
[PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Krzysztof Opasiak <k.opasiak@samsung.com> - 2015-09-15 17:40 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 17:50 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 18:00 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 18:10 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Krzysztof Opasiak <k.opasiak@samsung.com> - 2015-09-15 18:20 +0200
Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 18:40 +0200
[PATCH 02/26] usb: gadget: f_ncm: obtain cdev from function instead of driver_data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
[PATCH 01/26] usb: gadget: fix few outdated comments Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
[PATCH 07/26] usb: gadget: f_eem: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
csiph-web