Please consider using pci_choose_state() for translation
from message.event to pci_power_t. This function already 
calls pci_find_capability().
I'm not subscribed to this list.


--- linux-2.6.17-rc5/drivers/usb/core/hcd-pci.c.orig    2006-05-31 
09:00:34.000000000 +0200
+++ linux-2.6.17-rc5/drivers/usb/core/hcd-pci.c 2006-05-31 09:13:01.000000000 
+0200
@@ -196,7 +196,6 @@ int usb_hcd_pci_suspend (struct pci_dev 
 {
        struct usb_hcd          *hcd;
        int                     retval = 0;
-       int                     has_pci_pm;
 
        hcd = pci_get_drvdata(dev);
 
@@ -235,7 +234,6 @@ int usb_hcd_pci_suspend (struct pci_dev 
         * below, HCs can try global suspend and reduce DMA traffic.
         * PM-sensitive HCDs may already have done this.
         */
-       has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
 
        /* Downstream ports from this root hub should already be quiesced, so
         * there will be no DMA activity.  Now we can shut down the upstream
@@ -243,6 +241,8 @@ int usb_hcd_pci_suspend (struct pci_dev 
         * low power state, if the hardware allows.
         */
        if (hcd->state == HC_STATE_SUSPENDED) {
+               pci_power_t d;
+               d = pci_choose_state (dev, message);
 
                /* no DMA or IRQs except when HC is active */
                if (dev->current_state == PCI_D0) {
@@ -250,7 +250,7 @@ int usb_hcd_pci_suspend (struct pci_dev 
                        pci_disable_device (dev);
                }
 
-               if (!has_pci_pm) {
+               if (!d) {
                        dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n");
                        goto done;
                }
@@ -260,24 +260,23 @@ int usb_hcd_pci_suspend (struct pci_dev 
                 * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
                 * some device state (e.g. as part of clock reinit).
                 */
-               retval = pci_set_power_state (dev, PCI_D3hot);
+               retval = pci_set_power_state (dev, d);
                suspend_report_result(pci_set_power_state, retval);
                if (retval == 0) {
                        int wake = device_can_wakeup(&hcd->self.root_hub->dev);
 
                        wake = wake && device_may_wakeup(hcd->self.controller);
 
-                       dev_dbg (hcd->self.controller, "--> PCI D3%s\n",
+                       dev_dbg (hcd->self.controller, "--> PCI D%d%s\n", d,
                                        wake ? "/wakeup" : "");
 
                        /* Ignore these return values.  We rely on pci code to
                         * reject requests the hardware can't implement, rather
                         * than coding the same thing.
                         */
-                       (void) pci_enable_wake (dev, PCI_D3hot, wake);
-                       (void) pci_enable_wake (dev, PCI_D3cold, wake);
+                       (void) pci_enable_wake (dev, d, wake);
                } else {
-                       dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
+                       dev_dbg (&dev->dev, "PCI D%d suspend fail, %d\n", d,
                                        retval);
                        (void) usb_hcd_pci_resume (dev);
                }
@@ -291,7 +290,7 @@ int usb_hcd_pci_suspend (struct pci_dev 
 
 done:
        if (retval == 0) {
-               dev->dev.power.power_state = PMSG_SUSPEND;
+               dev->dev.power.power_state = message;
 
 #ifdef CONFIG_PPC_PMAC
                /* Disable ASIC clocks for USB */


----------------------------------------------------------------------
Poznaj Stefana! Zmien komunikator! >>> http://link.interia.pl/f1924



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to