[PATCH 3/5] usb: dwc3: fix SETSTALL for control EP pair

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SETSTALL for control EP pair must always be sent to OUT EP

Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx>
---
 drivers/usb/dwc3/gadget.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index b86d1eb..29d9e4a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -871,12 +871,17 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
 {
 	struct dwc3_gadget_ep_cmd_params	params;
 	struct dwc3				*dwc = dep->dwc;
-	int					ret;
+	int					number, ret;
 
 	memset(&params, 0x00, sizeof(params));
 
+	if (dep->number == 1)
+		number = 0;
+	else
+		number = dep->number;
+
 	if (value) {
-		if (dep->number == 0 || dep->number == 1) {
+		if (number == 0) {
 			/*
 			 * Whenever EP0 is stalled, we will restart
 			 * the state machine, thus moving back to
@@ -885,7 +890,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
 			dwc->ep0state = EP0_SETUP_PHASE;
 		}
 
-		ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
+		ret = dwc3_send_gadget_ep_cmd(dwc, number,
 			DWC3_DEPCMD_SETSTALL, &params);
 		if (ret)
 			dev_err(dwc->dev, "failed to %s STALL on %s\n",
@@ -894,7 +899,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
 		else
 			dep->flags |= DWC3_EP_STALL;
 	} else {
-		ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
+		ret = dwc3_send_gadget_ep_cmd(dwc, number,
 			DWC3_DEPCMD_CLEARSTALL, &params);
 		if (ret)
 			dev_err(dwc->dev, "failed to %s STALL on %s\n",
-- 
1.7.6.233.gd79bc

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux