Commit 0fe886cd authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: single return point on generic commands

Just like we did for endpoint commands, let's use a
single return point for generic commands as
well. This aids readability.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 0933df15
...@@ -207,6 +207,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, ...@@ -207,6 +207,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param)
{ {
u32 timeout = 500; u32 timeout = 500;
int ret = 0;
u32 reg; u32 reg;
trace_dwc3_gadget_generic_cmd(cmd, param); trace_dwc3_gadget_generic_cmd(cmd, param);
...@@ -221,22 +222,20 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) ...@@ -221,22 +222,20 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param)
"Command Complete --> %d", "Command Complete --> %d",
DWC3_DGCMD_STATUS(reg)); DWC3_DGCMD_STATUS(reg));
if (DWC3_DGCMD_STATUS(reg)) if (DWC3_DGCMD_STATUS(reg))
return -EINVAL; ret = -EINVAL;
return 0; break;
} }
/*
* We can't sleep here, because it's also called from
* interrupt context.
*/
timeout--;
if (!timeout) {
dwc3_trace(trace_dwc3_gadget,
"Command Timed Out");
return -ETIMEDOUT;
}
udelay(1); udelay(1);
} while (1); } while (timeout--);
if (!timeout) {
dwc3_trace(trace_dwc3_gadget,
"Command Timed Out");
ret = -ETIMEDOUT;
}
return ret;
} }
static int __dwc3_gadget_wakeup(struct dwc3 *dwc); static int __dwc3_gadget_wakeup(struct dwc3 *dwc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment