Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1225208
| From | Robert Baldyga <r.baldyga@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 00/26] usb: gadget: encapsulate ep enable/disable |
| Date | 2015-09-15 16:30 +0200 |
| Message-ID | <q8Zp8-7qt-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Hi Felipe, There is my next patches series containing few fixes and slightly reworking USB gadget function API. It introduces ep->enabled flag which indicates whether endpointis enabled or not, and encapsulates its checking and setting into usb_ep_enable() and usb_ep_disable() functions. So now these functions can be used more safely. Why is that needed? For example, it's very common pattern in USB functions to re-enable endpoints in set_alt(). Usually it looks like: usb_ep_disable() config_ep_by_speed() usb_ep_enable() So far to avoid disabling endpoint which was already disabled there was need to remember somehow which endpoints are enabled. Unfortunately for this purpose no new flag in struct usb_ep was introduced, but instead ep->driver_data was set and cleared to mark endpoints as enabled/disabled. This made code a little messy considering that the same ep->driver_data was used before in bind() to claim endpoints obtained from autoconfig, and moreover many functions use the same ep->driver_data to save some private pointer, accessible for example in complete() callback (what is, I believe, driver_data was designed for). So as now we have ep->claimed flag for marking claimed endpoints, and ep->enabled flag to remember its enabled/disabled state, we can finally use ep->driver_data to only contain pointer to private data. To achieve this, this patch set modifies all USB functions where abuse ep->driver_data had place, and leaves them in form, where internal endpoint state is handled by gadget framework functions, and ep->driver_data has no additional purpose over containing driver data pointer. Best regards, Robert Baldyga Robert Baldyga (26): usb: gadget: fix few outdated comments usb: gadget: f_ncm: obtain cdev from function instead of driver_data usb: gadget: epautoconf: add usb_ep_autoconfig_release() function usb: gadget: introduce 'enabled' flag in struct usb_ep usb: gadget: f_ecm: eliminate abuse of ep->driver data usb: gadget: f_acm: eliminate abuse of ep->driver data usb: gadget: f_eem: eliminate abuse of ep->driver data usb: gadget: f_hid: eliminate abuse of ep->driver data usb: gadget: f_loopback: eliminate abuse of ep->driver data usb: gadget: f_mass_storage: eliminate abuse of ep->driver data usb: gadget: f_midi: eliminate abuse of ep->driver data usb: gadget: f_ncm: eliminate abuse of ep->driver data usb: gadget: f_obex: eliminate abuse of ep->driver data usb: gadget: f_phonet: eliminate abuse of ep->driver data usb: gadget: f_printer: eliminate abuse of ep->driver data usb: gadget: f_rndis: eliminate abuse of ep->driver data usb: gadget: f_serial: eliminate abuse of ep->driver data usb: gadget: f_sourcesink: eliminate abuse of ep->driver data usb: gadget: f_subset: eliminate abuse of ep->driver data usb: gadget: f_uac1: eliminate abuse of ep->driver data usb: gadget: f_uac2: eliminate abuse of ep->driver data usb: gadget: f_uvc: eliminate abuse of ep->driver data usb: gadget: u_ether: eliminate abuse of ep->driver data usb: gadget: u_serial: eliminate abuse of ep->driver data usb: gadget: legacy: dbgp: eliminate abuse of ep->driver data usb: gadget: legacy: tcm: eliminate abuse of ep->driver data drivers/usb/gadget/composite.c | 4 +-- drivers/usb/gadget/epautoconf.c | 25 ++++++++++++++--- drivers/usb/gadget/function/f_acm.c | 23 +++------------ drivers/usb/gadget/function/f_ecm.c | 31 +++++--------------- drivers/usb/gadget/function/f_eem.c | 16 ++--------- drivers/usb/gadget/function/f_hid.c | 12 ++------ drivers/usb/gadget/function/f_loopback.c | 5 +--- drivers/usb/gadget/function/f_mass_storage.c | 4 --- drivers/usb/gadget/function/f_midi.c | 14 ++-------- drivers/usb/gadget/function/f_ncm.c | 29 +++++-------------- drivers/usb/gadget/function/f_obex.c | 10 +------ drivers/usb/gadget/function/f_phonet.c | 8 +----- drivers/usb/gadget/function/f_printer.c | 2 -- drivers/usb/gadget/function/f_rndis.c | 24 ++++------------ drivers/usb/gadget/function/f_serial.c | 10 +------ drivers/usb/gadget/function/f_sourcesink.c | 29 +++++-------------- drivers/usb/gadget/function/f_subset.c | 10 +------ drivers/usb/gadget/function/f_uac1.c | 4 --- drivers/usb/gadget/function/f_uac2.c | 11 -------- drivers/usb/gadget/function/f_uvc.c | 42 ++++++---------------------- drivers/usb/gadget/function/u_ether.c | 2 -- drivers/usb/gadget/function/u_serial.c | 5 ---- drivers/usb/gadget/legacy/dbgp.c | 18 ++---------- drivers/usb/gadget/legacy/tcm_usb_gadget.c | 18 ------------ include/linux/usb/gadget.h | 23 +++++++++++++-- 25 files changed, 95 insertions(+), 284 deletions(-) -- 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 — 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