usb: dwc3: gadget: fix set_halt() bug with pending transfers
authorFelipe Balbi <balbi@ti.com>
Wed, 24 Sep 2014 19:19:52 +0000 (14:19 -0500)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:05:00 +0000 (17:05 +0800)
commit0169c97f99ba46668a0da5a650defa29c424b343
treeafb1343d6e9fdb24323a3372b7cb8237931382d5
parent37cccefbb8dd18738beb6df75c1537a86750c6ce
usb: dwc3: gadget: fix set_halt() bug with pending transfers

commit 7a60855972f0d3c014093046cb6f013a1ee5bb19 upstream.

According to our Gadget Framework API documentation,
->set_halt() *must* return -EAGAIN if we have pending
transfers (on either direction) or FIFO isn't empty (on
TX endpoints).

Fix this bug so that the mass storage gadget can be used
without stall=0 parameter.

This patch should be backported to all kernels since v3.2.

Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[lizf: Backported to 3.4:
 - adjust context
 - drop the change to dwc3_gadget_ep_set_wedge()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/gadget.h