Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 49d08cfc7830 ("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: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/ccc90f316cf78bb5f7d46d3fd84f4c7f2c3020b1.1612518764.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thinh Nguyen and committed by
Greg Kroah-Hartman
8cf9045b 450b9e9f

+2 -17
+2 -17
drivers/usb/dwc3/gadget.c
··· 2411 2411 { 2412 2412 struct dwc3 *dwc = gadget_to_dwc(g); 2413 2413 unsigned long flags; 2414 - int ret = 0; 2414 + int ret; 2415 2415 int irq; 2416 2416 2417 2417 irq = dwc->irq_gadget; ··· 2420 2420 if (ret) { 2421 2421 dev_err(dwc->dev, "failed to request irq #%d --> %d\n", 2422 2422 irq, ret); 2423 - goto err0; 2423 + return ret; 2424 2424 } 2425 2425 2426 2426 spin_lock_irqsave(&dwc->lock, flags); 2427 - if (dwc->gadget_driver) { 2428 - dev_err(dwc->dev, "%s is already bound to %s\n", 2429 - dwc->gadget->name, 2430 - dwc->gadget_driver->driver.name); 2431 - ret = -EBUSY; 2432 - goto err1; 2433 - } 2434 - 2435 2427 dwc->gadget_driver = driver; 2436 2428 spin_unlock_irqrestore(&dwc->lock, flags); 2437 2429 2438 2430 return 0; 2439 - 2440 - err1: 2441 - spin_unlock_irqrestore(&dwc->lock, flags); 2442 - free_irq(irq, dwc); 2443 - 2444 - err0: 2445 - return ret; 2446 2431 } 2447 2432 2448 2433 static void __dwc3_gadget_stop(struct dwc3 *dwc)