Re: [PATCH 2/2] USB: hub: change the locking in hub_activate

2016-08-05 Thread Viresh Kumar
On 05-08-16, 11:51, Alan Stern wrote: > The locking in hub_activate() is not adequate to provide full mutual > exclusion with hub_quiesce(). The subroutine locks the hub's > usb_interface, but the callers of hub_quiesce() (such as > hub_pre_reset() and hub_event()) hold the lock to the hub's >

Re: [PATCH 1/2] USB: hub: fix up early-exit pathway in hub_activate

2016-08-05 Thread Viresh Kumar
On 05-08-16, 11:49, Alan Stern wrote: > The early-exit pathway in hub_activate, added by commit e50293ef9775 > ("USB: fix invalid memory access in hub_activate()") needs > improvement. It duplicates code that is already present at the end of > the subroutine, and it neglects to undo the effect of

[PATCH 00/11] use of_property_read_bool

2016-08-05 Thread Julia Lawall
Use of_property_read_bool to check for the existence of a property. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2; statement S2,S1; @@ - if (of_get_property(e1,e2,NULL)) + if (of_property_read_bool(e1,e2)) S1

[PATCH 02/11 v2] usb: host: fsl-mph-dr-of: use of_property_read_bool

2016-08-05 Thread Julia Lawall
Use of_property_read_bool to check for the existence of a property. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,x; @@ - if (of_get_property(e1,e2,NULL)) - x = true; - else - x = false; +

[PATCH 02/11] usb: host: fsl-mph-dr-of: use of_property_read_bool

2016-08-05 Thread Julia Lawall
Use of_property_read_bool to check for the existence of a property. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2; statement S2,S1; @@ - if (of_get_property(e1,e2,NULL)) + if (of_property_read_bool(e1,e2)) S1

[PATCH v3 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-05 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +-

[PATCH v3 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-05 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello ---

[PATCH v3 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git

[PATCH v3 5/9] usb: gadget: f_midi: refactor state machine

2016-08-05 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello ---

[PATCH v3 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello

[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

2016-08-05 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c

Re: [PATCH 10/11] soc: ti: knav_qmss_queue: use of_property_read_bool

2016-08-05 Thread Julia Lawall
On Fri, 5 Aug 2016, Robin Murphy wrote: > Hi Julia, > > On 05/08/16 09:56, Julia Lawall wrote: > > Use of_property_read_bool to check for the existence of a property. > > This caught my eye since Rob told me off for doing the same recently[1]. > > > The semantic patch that makes this change is

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

2016-08-05 Thread Felipe F. Tonello
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

[PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3

[PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-05 Thread Felipe F. Tonello
USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. This patch also introduces usb_ep_align() which does always returns the aligned buffer size for an endpoint. This is

[PATCH v3 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git

Re: [PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-05 Thread kbuild test robot
Hi Felipe, [auto build test ERROR on balbi-usb/next] [also build test ERROR on v4.7 next-20160805] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Felipe-F-Tonello/Gadget-endpoint-request

Re: [Letux-kernel] [PATCH v2] musb: omap2430: do not assume balanced enable()/disable()

2016-08-05 Thread Tony Lindgren
* Andreas Kemnade [160804 09:44]: > Nothing happens here, so the previous state of the phy remains. > It would be disabled by the generic phy layer in drivers/phy/phy-core.c > > > gadget driver is loaded. > > musb_start() is called > > omap2430_musb_enable() is called >

[GIT PULL] More USB driver patches for 4.8-rc1

2016-08-05 Thread Greg KH
The following changes since commit e65805251f2db69c9f67ed8062ab82526be5a374: Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2016-07-25 21:35:03 -0700) are available in the git repository at:

Re: [Letux-kernel] [PATCH v2] musb: omap2430: do not assume balanced enable()/disable()

2016-08-05 Thread Andreas Kemnade
On Fri, 5 Aug 2016 06:55:01 -0700 Tony Lindgren wrote: > * Andreas Kemnade [160804 09:44]: > > Nothing happens here, so the previous state of the phy remains. > > It would be disabled by the generic phy layer in > > drivers/phy/phy-core.c > > > > > gadget

[PATCH 1/2] USB: hub: fix up early-exit pathway in hub_activate

2016-08-05 Thread Alan Stern
The early-exit pathway in hub_activate, added by commit e50293ef9775 ("USB: fix invalid memory access in hub_activate()") needs improvement. It duplicates code that is already present at the end of the subroutine, and it neglects to undo the effect of a usb_autopm_get_interface_no_resume() call.

[PATCH 2/2] USB: hub: change the locking in hub_activate

2016-08-05 Thread Alan Stern
The locking in hub_activate() is not adequate to provide full mutual exclusion with hub_quiesce(). The subroutine locks the hub's usb_interface, but the callers of hub_quiesce() (such as hub_pre_reset() and hub_event()) hold the lock to the hub's usb_device. This patch changes hub_activate() to