Merge branch 'pm-core'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 13 Nov 2017 00:41:26 +0000 (01:41 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 13 Nov 2017 00:41:26 +0000 (01:41 +0100)
* pm-core:
  ACPI / PM: Take SMART_SUSPEND driver flag into account
  PCI / PM: Take SMART_SUSPEND driver flag into account
  PCI / PM: Drop unnecessary invocations of pcibios_pm_ops callbacks
  PM / core: Add SMART_SUSPEND driver flag
  PCI / PM: Use the NEVER_SKIP driver flag
  PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
  PM / core: Convert timers to use timer_setup()
  PM / core: Fix kerneldoc comments of four functions
  PM / core: Drop legacy class suspend/resume operations

1  2 
Documentation/driver-api/pm/devices.rst
drivers/acpi/device_pm.c
drivers/base/power/runtime.c
drivers/misc/mei/pci-me.c
drivers/misc/mei/pci-txe.c
drivers/pci/pci-driver.c
include/linux/pci.h

Simple merge
Simple merge
index 78b3172c8e6e298fa8f74c93db2850c4f96b95a8,f17e4b435fa974bf93eb3c80fa29d44a1302de36..f4f17552c9b804c3667c6d3a7c702ac30a4eaac0
@@@ -225,18 -223,15 +225,18 @@@ static int mei_me_probe(struct pci_dev 
         * MEI requires to resume from runtime suspend mode
         * in order to perform link reset flow upon system suspend.
         */
-       pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
+       dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP);
  
        /*
 -      * For not wake-able HW runtime pm framework
 -      * can't be used on pci device level.
 -      * Use domain runtime pm callbacks instead.
 -      */
 -      if (!pci_dev_run_wake(pdev))
 -              mei_me_set_pm_domain(dev);
 +       * ME maps runtime suspend/resume to D0i states,
 +       * hence we need to go around native PCI runtime service which
 +       * eventually brings the device into D3cold/hot state,
 +       * but the mei device cannot wake up from D3 unlike from D0i3.
 +       * To get around the PCI device native runtime pm,
 +       * ME uses runtime pm domain handlers which take precedence
 +       * over the driver's pm handlers.
 +       */
 +      mei_me_set_pm_domain(dev);
  
        if (mei_pg_is_enabled(dev))
                pm_runtime_put_noidle(&pdev->dev);
index 0566f9bfa7de6c68c44d245e7e1deec84c345f71,f911a08e3579fadd1b5b577bd4ee1f4d0fb56429..e1b909123fb02d25539c8645cc51e4f4960035ff
@@@ -141,17 -141,15 +141,17 @@@ static int mei_txe_probe(struct pci_de
         * MEI requires to resume from runtime suspend mode
         * in order to perform link reset flow upon system suspend.
         */
-       pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
+       dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP);
  
        /*
 -      * For not wake-able HW runtime pm framework
 -      * can't be used on pci device level.
 -      * Use domain runtime pm callbacks instead.
 -      */
 -      if (!pci_dev_run_wake(pdev))
 -              mei_txe_set_pm_domain(dev);
 +       * TXE maps runtime suspend/resume to own power gating states,
 +       * hence we need to go around native PCI runtime service which
 +       * eventually brings the device into D3cold/hot state.
 +       * But the TXE device cannot wake up from D3 unlike from own
 +       * power gating. To get around PCI device native runtime pm,
 +       * TXE uses runtime pm domain handlers which take precedence.
 +       */
 +      mei_txe_set_pm_domain(dev);
  
        pm_runtime_put_noidle(&pdev->dev);
  
index 9be563067c0cd2c149b7b8ff5fe04791ba85b5bb,d19bd54d337e4a5175c74411b62e910b40b7c829..07b8a9b385abcb43506e42625204b0734d26e3d0
@@@ -680,10 -680,20 +680,13 @@@ static int pci_pm_prepare(struct devic
  {
        struct device_driver *drv = dev->driver;
  
 -      /*
 -       * Devices having power.ignore_children set may still be necessary for
 -       * suspending their children in the next phase of device suspend.
 -       */
 -      if (dev->power.ignore_children)
 -              pm_runtime_resume(dev);
 -
        if (drv && drv->pm && drv->pm->prepare) {
                int error = drv->pm->prepare(dev);
-               if (error)
+               if (error < 0)
                        return error;
+               if (!error && dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_PREPARE))
+                       return 0;
        }
        return pci_dev_keep_suspended(to_pci_dev(dev));
  }
Simple merge