From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586AbcHHUaT (ORCPT ); Mon, 8 Aug 2016 16:30:19 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35037 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751944AbcHHUaR (ORCPT ); Mon, 8 Aug 2016 16:30:17 -0400 From: "Felipe F. Tonello" To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Michal Nazarewicz Subject: [PATCH v4 00/10] Gadget endpoint request allocation and MIDI Date: Mon, 8 Aug 2016 21:30:03 +0100 Message-Id: <20160808203013.19283-1-eu@felipetonello.com> X-Mailer: git-send-email 2.9.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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