USB: mark USB drivers as being GPL only
[profile/ivi/kernel-adaptation-intel-automotive.git] / drivers / usb / core / hcd-pci.c
index 5078fb3..851d5e1 100644 (file)
@@ -125,7 +125,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
 
        pci_set_master (dev);
 
-       retval = usb_add_hcd (hcd, dev->irq, IRQF_SHARED);
+       retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
                goto err4;
        return retval;
@@ -144,7 +144,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
        dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
        return retval;
 } 
-EXPORT_SYMBOL (usb_hcd_pci_probe);
+EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
 
 
 /* may be called without controller electrically present */
@@ -179,7 +179,7 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
        usb_put_hcd (hcd);
        pci_disable_device(dev);
 }
-EXPORT_SYMBOL (usb_hcd_pci_remove);
+EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
 
 
 #ifdef CONFIG_PM
@@ -207,7 +207,8 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
         * We must ignore the FREEZE vs SUSPEND distinction here, because
         * otherwise the swsusp will save (and restore) garbage state.
         */
-       if (hcd->self.root_hub->dev.power.power_state.event == PM_EVENT_ON)
+       if (!(hcd->state == HC_STATE_SUSPENDED ||
+                       hcd->state == HC_STATE_HALT))
                return -EBUSY;
 
        if (hcd->driver->suspend) {
@@ -249,6 +250,12 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
                        pci_disable_device (dev);
                }
 
+               if (message.event == PM_EVENT_FREEZE ||
+                               message.event == PM_EVENT_PRETHAW) {
+                       dev_dbg(hcd->self.controller, "--> no state change\n");
+                       goto done;
+               }
+
                if (!has_pci_pm) {
                        dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n");
                        goto done;
@@ -281,7 +288,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
                        (void) usb_hcd_pci_resume (dev);
                }
 
-       } else {
+       } else if (hcd->state != HC_STATE_HALT) {
                dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",
                        hcd->state);
                WARN_ON(1);
@@ -307,7 +314,7 @@ done:
 
        return retval;
 }
-EXPORT_SYMBOL (usb_hcd_pci_suspend);
+EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
 
 /**
  * usb_hcd_pci_resume - power management resume of a PCI-based HCD
@@ -409,8 +416,24 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
 
        return retval;
 }
-EXPORT_SYMBOL (usb_hcd_pci_resume);
+EXPORT_SYMBOL_GPL(usb_hcd_pci_resume);
 
 #endif /* CONFIG_PM */
 
+/**
+ * usb_hcd_pci_shutdown - shutdown host controller
+ * @dev: USB Host Controller being shutdown
+ */
+void usb_hcd_pci_shutdown (struct pci_dev *dev)
+{
+       struct usb_hcd          *hcd;
+
+       hcd = pci_get_drvdata(dev);
+       if (!hcd)
+               return;
+
+       if (hcd->driver->shutdown)
+               hcd->driver->shutdown(hcd);
+}
+EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);