Commit 8cf9045b authored by Thinh Nguyen's avatar Thinh Nguyen Committed by Greg Kroah-Hartman

usb: dwc3: gadget: Remove check for bounded driver

The check for bounded gadget driver in dwc3_gadget_start() was to
prevent going through the initialization again without any cleanup. The
recent commit 49d08cfc ("usb: udc: core: Introduce started state")
updated the UDC framework and guarantees this won't happen while the UDC
is started. Also, this check doesn't prevent requesting threaded irq to
the same dev_id, which will mess up the irq freeing logic. Let's remove
it.
Signed-off-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/ccc90f316cf78bb5f7d46d3fd84f4c7f2c3020b1.1612518764.git.Thinh.Nguyen@synopsys.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 450b9e9f
...@@ -2411,7 +2411,7 @@ static int dwc3_gadget_start(struct usb_gadget *g, ...@@ -2411,7 +2411,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
{ {
struct dwc3 *dwc = gadget_to_dwc(g); struct dwc3 *dwc = gadget_to_dwc(g);
unsigned long flags; unsigned long flags;
int ret = 0; int ret;
int irq; int irq;
irq = dwc->irq_gadget; irq = dwc->irq_gadget;
...@@ -2420,29 +2420,14 @@ static int dwc3_gadget_start(struct usb_gadget *g, ...@@ -2420,29 +2420,14 @@ static int dwc3_gadget_start(struct usb_gadget *g,
if (ret) { if (ret) {
dev_err(dwc->dev, "failed to request irq #%d --> %d\n", dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
irq, ret); irq, ret);
goto err0; return ret;
} }
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
if (dwc->gadget_driver) {
dev_err(dwc->dev, "%s is already bound to %s\n",
dwc->gadget->name,
dwc->gadget_driver->driver.name);
ret = -EBUSY;
goto err1;
}
dwc->gadget_driver = driver; dwc->gadget_driver = driver;
spin_unlock_irqrestore(&dwc->lock, flags); spin_unlock_irqrestore(&dwc->lock, flags);
return 0; return 0;
err1:
spin_unlock_irqrestore(&dwc->lock, flags);
free_irq(irq, dwc);
err0:
return ret;
} }
static void __dwc3_gadget_stop(struct dwc3 *dwc) static void __dwc3_gadget_stop(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