public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Gadget endpoint request allocation and MIDI
@ 2016-07-26 19:11 Felipe F. Tonello
  2016-07-26 19:11 ` [PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Felipe F. Tonello
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Felipe F. Tonello @ 2016-07-26 19:11 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, Felipe Balbi, Baolin Wang, Michal Nazarewicz,
	Andrzej Pietrasiewicz

As discussed with Baolin Wang, Michal Nazarewicz and Felipe Balbi. I propose
the forced buffer alignment of OUT endpoints USB requests. This is implemented
by patches #1 and #2.

That not just simplifies the driver code, but it also prevents nasty bugs when
buflen is not aligned or even less than wMaxPacketSize.

Patch #9 is more of a POC. It removes direct calls to usb_ep_alloc_request()
and use alloc_ep_req() instead. If accepted, then we should apply to all other
gadgets that uses usb_ep_alloc_request() when possible and encorage drivers to
use it instead.

Everything else is self-explanatory.

Changes from v1:
 * Added patches 1, 2, 7, 8 ,9.
 * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize

Felipe F. Tonello (9):
  usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align
  usb: gadget: align buffer size when allocating for OUT endpoint
  usb: gadget: f_midi: remove alignment code for OUT endpoint
  usb: gadget: f_midi: defaults buflen sizes to 512
  usb: gadget: f_midi: refactor state machine
  usb: gadget: f_midi: drop substreams when disabling endpoint
  usb: gadget: remove useless parameter in alloc_ep_req()
  usb: gadget: f_hid: use free_ep_req()
  usb: gadget: f_hid: use alloc_ep_req()

 drivers/usb/gadget/function/f_hid.c        |  26 +---
 drivers/usb/gadget/function/f_loopback.c   |   9 +-
 drivers/usb/gadget/function/f_midi.c       | 240 +++++++++++++++++------------
 drivers/usb/gadget/function/f_sourcesink.c |  11 +-
 drivers/usb/gadget/legacy/gmidi.c          |   2 +-
 drivers/usb/gadget/u_f.c                   |   6 +-
 drivers/usb/gadget/u_f.h                   |   2 +-
 include/linux/usb/gadget.h                 |  17 +-
 8 files changed, 174 insertions(+), 139 deletions(-)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-08-02 17:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 19:11 [PATCH v2 0/9] Gadget endpoint request allocation and MIDI Felipe F. Tonello
2016-07-26 19:11 ` [PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Felipe F. Tonello
2016-07-27 19:37   ` Michal Nazarewicz
2016-08-02 15:05     ` Felipe Ferreri Tonello
2016-07-26 19:11 ` [PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint Felipe F. Tonello
2016-07-27 19:59   ` Michal Nazarewicz
2016-08-02 15:15     ` Felipe Ferreri Tonello
2016-07-26 19:11 ` [PATCH 3/9] usb: gadget: f_midi: remove alignment code " Felipe F. Tonello
2016-07-26 19:11 ` [PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512 Felipe F. Tonello
2016-07-27 19:38   ` Michal Nazarewicz
2016-07-26 19:11 ` [PATCH 5/9] usb: gadget: f_midi: refactor state machine Felipe F. Tonello
2016-07-26 19:11 ` [PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint Felipe F. Tonello
2016-07-26 19:11 ` [PATCH 7/9] usb: gadget: remove useless parameter in alloc_ep_req() Felipe F. Tonello
2016-07-26 19:18   ` [PATCH v2 " Felipe F. Tonello
2016-07-26 19:19     ` Felipe Ferreri Tonello
2016-07-27 20:02   ` [PATCH " Michal Nazarewicz
2016-08-02 15:08     ` Felipe Ferreri Tonello
2016-07-26 19:11 ` [PATCH 8/9] usb: gadget: f_hid: use free_ep_req() Felipe F. Tonello
2016-07-27 20:03   ` Michal Nazarewicz
2016-07-26 19:12 ` [PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req() Felipe F. Tonello
2016-07-27 20:34   ` Michal Nazarewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox