linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] Gadget endpoint request allocation and MIDI
@ 2016-08-08 20:30 Felipe F. Tonello
  2016-08-08 20:30 ` [PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Felipe F. Tonello
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Felipe F. Tonello @ 2016-08-08 20:30 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-kernel, Felipe Balbi, Michal Nazarewicz

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 #3.

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

Patch #10 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.

Changes from v3:
 * Added patch #2 which uses size_t on alloc_ep_req() instead of int.

Changes from v2:
 * Simplified logic in patch #1;
 * Added documentation to alloc_ep_req and free_ep_req;
 * Improved commit message on patch #8.

Changes from v1:
 * Added patches #1, #3, #8, #9 ,#10;
 * Patch #4 removes max_t() for buffer alignment with wMaxPacketSize.

Felipe F. Tonello (10):
  usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align
  usb: gadget: change len to size_t on alloc_ep_req()
  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                   |  17 +-
 include/linux/usb/gadget.h                 |  17 +-
 8 files changed, 188 insertions(+), 140 deletions(-)

-- 
2.9.2

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

end of thread, other threads:[~2016-08-30 16:13 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 20:30 [PATCH v4 00/10] Gadget endpoint request allocation and MIDI Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 02/10] usb: gadget: change len to size_t on alloc_ep_req() Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 03/10] usb: gadget: align buffer size when allocating for OUT endpoint Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 04/10] usb: gadget: f_midi: remove alignment code " Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 05/10] usb: gadget: f_midi: defaults buflen sizes to 512 Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 06/10] usb: gadget: f_midi: refactor state machine Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 07/10] usb: gadget: f_midi: drop substreams when disabling endpoint Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req() Felipe F. Tonello
2016-08-18  7:12   ` Felipe Balbi
2016-08-23 10:18     ` Felipe Ferreri Tonello
2016-08-23 11:01       ` Felipe Balbi
2016-08-23 11:33         ` Felipe Ferreri Tonello
2016-08-29  7:55           ` Felipe Balbi
2016-08-30 16:13             ` Felipe Ferreri Tonello
2016-08-08 20:30 ` [PATCH v4 09/10] usb: gadget: f_hid: use free_ep_req() Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 10/10] usb: gadget: f_hid: use alloc_ep_req() Felipe F. Tonello
2016-08-19 19:07   ` John Youn
2016-08-22  7:45     ` Felipe Balbi
2016-08-23 10:20       ` Felipe Ferreri Tonello
2016-08-23 11:03         ` Felipe Balbi
2016-08-23 11:34           ` Felipe Ferreri Tonello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).