[PATCH][Karmic] SRU: pci: Ensure we re-enable devices on resume

Alex Chiang achiang at canonical.com
Tue Apr 27 03:27:46 UTC 2010


BugLink: http://bugs.launchpad.net/bugs/566149

SRU justification:
The original patch which added the check in pci_set_power_state was a
minor thinko, and prevented platform resume code from running. This patch
removes the incorrect check, allowing platform resume code to run, thus
re-enabling devices such as USB ports.

Backport of upstream commit:

commit cc2893b6af5265baa1d68b17b136cffca9e40cfa
Author: Matthew Garrett <mjg at redhat.com>
Date:   Thu Apr 22 09:30:51 2010 -0400

    PCI: Ensure we re-enable devices on resume
    
    If the firmware puts a device back into D0 state at resume time, we'll
    update its state in resume_noirq and thus skip the platform resume code.
    Calling that code twice should be safe and we ought to avoid getting to
    that point anyway, so remove the check and also allow the platform pci
    code to be called for D0.
    
    Fixes USB not being powered after resume on recent Lenovo machines.
    
    Acked-by: Alex Chiang <achiang at canonical.com>
    Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
    Signed-off-by: Matthew Garrett <mjg at redhat.com>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

Signed-off-by: Alex Chiang <achiang at canonical.com>
---
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e5f3f1c..579dcf5 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -591,7 +591,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
  */
 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
 {
-	return state > PCI_D0 ?
+	return state >= PCI_D0 ?
 			pci_platform_power_transition(dev, state) : -EINVAL;
 }
 EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
@@ -628,10 +628,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 		 */
 		return 0;
 
-	/* Check if we're already there */
-	if (dev->current_state == state)
-		return 0;
-
 	__pci_start_power_transition(dev, state);
 
 	/* This device is quirked not to be put into D3, so




More information about the kernel-team mailing list