diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-20 20:17:42 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-23 16:13:54 -0500 |
commit | bac2a909a096c9110525c18cbb8ce73c660d5f71 (patch) | |
tree | 59bd2a6efea9c9cb4cca404f35ae94c67f0dd988 /drivers/pci/pci-driver.c | |
parent | ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff) |
PCI / PM: Avoid resuming PCI devices during system suspend
Commit f25c0ae2b4c4 (ACPI / PM: Avoid resuming devices in ACPI PM
domain during system suspend) modified the ACPI PM domain's system
suspend callbacks to allow devices attached to it to be left in the
runtime-suspended state during system suspend so as to optimize
the suspend process.
This was based on the general mechanism introduced by commit
aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended
devices unnecessarily).
Extend that approach to PCI devices by modifying the PCI bus type's
->prepare callback to return 1 for devices that are runtime-suspended
when it is being executed and that are in a suitable power state and
need not be resumed going forward.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 887e6bd95af7..741023e94008 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -653,7 +653,6 @@ static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev) | |||
653 | static int pci_pm_prepare(struct device *dev) | 653 | static int pci_pm_prepare(struct device *dev) |
654 | { | 654 | { |
655 | struct device_driver *drv = dev->driver; | 655 | struct device_driver *drv = dev->driver; |
656 | int error = 0; | ||
657 | 656 | ||
658 | /* | 657 | /* |
659 | * Devices having power.ignore_children set may still be necessary for | 658 | * Devices having power.ignore_children set may still be necessary for |
@@ -662,10 +661,12 @@ static int pci_pm_prepare(struct device *dev) | |||
662 | if (dev->power.ignore_children) | 661 | if (dev->power.ignore_children) |
663 | pm_runtime_resume(dev); | 662 | pm_runtime_resume(dev); |
664 | 663 | ||
665 | if (drv && drv->pm && drv->pm->prepare) | 664 | if (drv && drv->pm && drv->pm->prepare) { |
666 | error = drv->pm->prepare(dev); | 665 | int error = drv->pm->prepare(dev); |
667 | 666 | if (error) | |
668 | return error; | 667 | return error; |
668 | } | ||
669 | return pci_dev_keep_suspended(to_pci_dev(dev)); | ||
669 | } | 670 | } |
670 | 671 | ||
671 | 672 | ||