usb: langwell_udc: cancel pending requests when controller is suspended.
authorPhilippe Skowronski <philippe.skowronski@intel.com>
Thu, 25 Aug 2011 11:20:33 +0000 (12:20 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:38:19 +0000 (12:38 -0800)
It is safer to cancel pending requests before free dTD and dQH when
controller enters suspend state.

Change-Id: I5cb342093934af111ce70911908f492914c3001e
Signed-off-by: Philippe Skowronski <philippe.skowronski@intel.com>
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
drivers/usb/gadget/langwell_udc.c

index 0db94bb..663679a 100644 (file)
@@ -3363,6 +3363,7 @@ error:
 static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct langwell_udc     *dev = the_controller;
+       unsigned long           flags;
 
        dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
@@ -3375,6 +3376,11 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
                free_irq(pdev->irq, dev);
        dev->got_irq = 0;
 
+       spin_lock_irqsave(&dev->lock, flags);
+       /* stop all usb activities */
+       stop_activity(dev, dev->driver);
+       spin_unlock_irqrestore(&dev->lock, flags);
+
        /* save PCI state */
        pci_save_state(pdev);