diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2011-12-21 03:19:40 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-01-24 08:41:57 -0500 |
commit | 37fd37108449d574da11aa9055c5c8afb39ff226 (patch) | |
tree | d3ffd76832f21aaed75f3403d787d6edd32742c8 | |
parent | 28bd6222544d7559edf9ff487172e45ce46e2578 (diff) |
usb: gadget: langwell: don't call gadget's disconnect()
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: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: stable@vger.kernel.org # v3.2
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/langwell_udc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index 34e3bf877341..e2293c1588ee 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c | |||
@@ -1517,8 +1517,7 @@ static void langwell_udc_stop(struct langwell_udc *dev) | |||
1517 | 1517 | ||
1518 | 1518 | ||
1519 | /* stop all USB activities */ | 1519 | /* stop all USB activities */ |
1520 | static void stop_activity(struct langwell_udc *dev, | 1520 | static void stop_activity(struct langwell_udc *dev) |
1521 | struct usb_gadget_driver *driver) | ||
1522 | { | 1521 | { |
1523 | struct langwell_ep *ep; | 1522 | struct langwell_ep *ep; |
1524 | dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__); | 1523 | dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__); |
@@ -1530,9 +1529,9 @@ static void stop_activity(struct langwell_udc *dev, | |||
1530 | } | 1529 | } |
1531 | 1530 | ||
1532 | /* report disconnect; the driver is already quiesced */ | 1531 | /* report disconnect; the driver is already quiesced */ |
1533 | if (driver) { | 1532 | if (dev->driver) { |
1534 | spin_unlock(&dev->lock); | 1533 | spin_unlock(&dev->lock); |
1535 | driver->disconnect(&dev->gadget); | 1534 | dev->driver->disconnect(&dev->gadget); |
1536 | spin_lock(&dev->lock); | 1535 | spin_lock(&dev->lock); |
1537 | } | 1536 | } |
1538 | 1537 | ||
@@ -1920,11 +1919,10 @@ static int langwell_stop(struct usb_gadget *g, | |||
1920 | 1919 | ||
1921 | /* stop all usb activities */ | 1920 | /* stop all usb activities */ |
1922 | dev->gadget.speed = USB_SPEED_UNKNOWN; | 1921 | dev->gadget.speed = USB_SPEED_UNKNOWN; |
1923 | stop_activity(dev, driver); | ||
1924 | spin_unlock_irqrestore(&dev->lock, flags); | ||
1925 | |||
1926 | dev->gadget.dev.driver = NULL; | 1922 | dev->gadget.dev.driver = NULL; |
1927 | dev->driver = NULL; | 1923 | dev->driver = NULL; |
1924 | stop_activity(dev); | ||
1925 | spin_unlock_irqrestore(&dev->lock, flags); | ||
1928 | 1926 | ||
1929 | device_remove_file(&dev->pdev->dev, &dev_attr_function); | 1927 | device_remove_file(&dev->pdev->dev, &dev_attr_function); |
1930 | 1928 | ||
@@ -2724,7 +2722,7 @@ static void handle_usb_reset(struct langwell_udc *dev) | |||
2724 | dev->bus_reset = 1; | 2722 | dev->bus_reset = 1; |
2725 | 2723 | ||
2726 | /* reset all the queues, stop all USB activities */ | 2724 | /* reset all the queues, stop all USB activities */ |
2727 | stop_activity(dev, dev->driver); | 2725 | stop_activity(dev); |
2728 | dev->usb_state = USB_STATE_DEFAULT; | 2726 | dev->usb_state = USB_STATE_DEFAULT; |
2729 | } else { | 2727 | } else { |
2730 | dev_vdbg(&dev->pdev->dev, "device controller reset\n"); | 2728 | dev_vdbg(&dev->pdev->dev, "device controller reset\n"); |
@@ -2732,7 +2730,7 @@ static void handle_usb_reset(struct langwell_udc *dev) | |||
2732 | langwell_udc_reset(dev); | 2730 | langwell_udc_reset(dev); |
2733 | 2731 | ||
2734 | /* reset all the queues, stop all USB activities */ | 2732 | /* reset all the queues, stop all USB activities */ |
2735 | stop_activity(dev, dev->driver); | 2733 | stop_activity(dev); |
2736 | 2734 | ||
2737 | /* reset ep0 dQH and endptctrl */ | 2735 | /* reset ep0 dQH and endptctrl */ |
2738 | ep0_reset(dev); | 2736 | ep0_reset(dev); |
@@ -3290,7 +3288,7 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3290 | 3288 | ||
3291 | spin_lock_irq(&dev->lock); | 3289 | spin_lock_irq(&dev->lock); |
3292 | /* stop all usb activities */ | 3290 | /* stop all usb activities */ |
3293 | stop_activity(dev, dev->driver); | 3291 | stop_activity(dev); |
3294 | spin_unlock_irq(&dev->lock); | 3292 | spin_unlock_irq(&dev->lock); |
3295 | 3293 | ||
3296 | /* free dTD dma_pool and dQH */ | 3294 | /* free dTD dma_pool and dQH */ |