Commit e64e861c authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Greg Kroah-Hartman

usb: gadget: langwell: don't call gadget's disconnect()

commit 37fd3710 upstream.

UDC core will call disconnect() and unbind() for us upon the gadget
removal, so we should not do it ourselves. Otherwise, a composite
gadget will explode, for example. Others might too.

This was introduced during conversion to new style gadget in 2c7f0989
(usb: gadget: langwell: convert to new style).
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b70ce052
...@@ -1522,8 +1522,7 @@ static void langwell_udc_stop(struct langwell_udc *dev) ...@@ -1522,8 +1522,7 @@ static void langwell_udc_stop(struct langwell_udc *dev)
/* stop all USB activities */ /* stop all USB activities */
static void stop_activity(struct langwell_udc *dev, static void stop_activity(struct langwell_udc *dev)
struct usb_gadget_driver *driver)
{ {
struct langwell_ep *ep; struct langwell_ep *ep;
dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__); dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
...@@ -1535,9 +1534,9 @@ static void stop_activity(struct langwell_udc *dev, ...@@ -1535,9 +1534,9 @@ static void stop_activity(struct langwell_udc *dev,
} }
/* report disconnect; the driver is already quiesced */ /* report disconnect; the driver is already quiesced */
if (driver) { if (dev->driver) {
spin_unlock(&dev->lock); spin_unlock(&dev->lock);
driver->disconnect(&dev->gadget); dev->driver->disconnect(&dev->gadget);
spin_lock(&dev->lock); spin_lock(&dev->lock);
} }
...@@ -1925,11 +1924,10 @@ static int langwell_stop(struct usb_gadget *g, ...@@ -1925,11 +1924,10 @@ static int langwell_stop(struct usb_gadget *g,
/* stop all usb activities */ /* stop all usb activities */
dev->gadget.speed = USB_SPEED_UNKNOWN; dev->gadget.speed = USB_SPEED_UNKNOWN;
stop_activity(dev, driver);
spin_unlock_irqrestore(&dev->lock, flags);
dev->gadget.dev.driver = NULL; dev->gadget.dev.driver = NULL;
dev->driver = NULL; dev->driver = NULL;
stop_activity(dev);
spin_unlock_irqrestore(&dev->lock, flags);
device_remove_file(&dev->pdev->dev, &dev_attr_function); device_remove_file(&dev->pdev->dev, &dev_attr_function);
...@@ -2733,7 +2731,7 @@ static void handle_usb_reset(struct langwell_udc *dev) ...@@ -2733,7 +2731,7 @@ static void handle_usb_reset(struct langwell_udc *dev)
dev->bus_reset = 1; dev->bus_reset = 1;
/* reset all the queues, stop all USB activities */ /* reset all the queues, stop all USB activities */
stop_activity(dev, dev->driver); stop_activity(dev);
dev->usb_state = USB_STATE_DEFAULT; dev->usb_state = USB_STATE_DEFAULT;
} else { } else {
dev_vdbg(&dev->pdev->dev, "device controller reset\n"); dev_vdbg(&dev->pdev->dev, "device controller reset\n");
...@@ -2741,7 +2739,7 @@ static void handle_usb_reset(struct langwell_udc *dev) ...@@ -2741,7 +2739,7 @@ static void handle_usb_reset(struct langwell_udc *dev)
langwell_udc_reset(dev); langwell_udc_reset(dev);
/* reset all the queues, stop all USB activities */ /* reset all the queues, stop all USB activities */
stop_activity(dev, dev->driver); stop_activity(dev);
/* reset ep0 dQH and endptctrl */ /* reset ep0 dQH and endptctrl */
ep0_reset(dev); ep0_reset(dev);
...@@ -3367,7 +3365,7 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -3367,7 +3365,7 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
spin_lock_irq(&dev->lock); spin_lock_irq(&dev->lock);
/* stop all usb activities */ /* stop all usb activities */
stop_activity(dev, dev->driver); stop_activity(dev);
spin_unlock_irq(&dev->lock); spin_unlock_irq(&dev->lock);
/* free dTD dma_pool and dQH */ /* free dTD dma_pool and dQH */
......
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