Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457243

[PATCH v3 0/9] Gadget endpoint request allocation and MIDI

From "Felipe F. Tonello" <eu@felipetonello.com>
Newsgroups linux.kernel
Subject [PATCH v3 0/9] Gadget endpoint request allocation and MIDI
Date 2016-08-05 20:40 +0200
Message-ID <s2Sci-2Ir-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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  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 v2:
 * Simplified logic in patch 1
 * Added documentation to alloc_ep_req and free_ep_req
 * Improved commit message on patch 7

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                   |  17 +-
 include/linux/usb/gadget.h                 |  17 +-
 8 files changed, 188 insertions(+), 140 deletions(-)

-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/9] Gadget endpoint request allocation and MIDI "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:40 +0200
  [PATCH v3 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:50 +0200
  [PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:50 +0200
    Re: [PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Michal Nazarewicz <mina86@mina86.com> - 2016-08-06 23:00 +0200
  [PATCH v3 5/9] usb: gadget: f_midi: refactor state machine "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:50 +0200
  [PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:50 +0200

csiph-web