Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1543978

[PATCH v3 4/7] Revert "PM / Runtime: Remove the exported function pm_children_suspended()"

From Lukas Wunner <lukas@wunner.de>
Newsgroups linux.kernel
Subject [PATCH v3 4/7] Revert "PM / Runtime: Remove the exported function pm_children_suspended()"
Date 2016-12-17 15:50 +0100
Message-ID <sPotb-2qh-13@gated-at.bofh.it> (permalink)
References <sPojw-2mJ-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This reverts commit 62006c1702b3b1be0c0726949e0ee0ea2326be9c which
removed pm_children_suspended() because it had only a single caller.
We're about to add a second caller, so establish the status quo ante.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/base/power/runtime.c | 3 +--
 include/linux/pm_runtime.h   | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 872eac4..03293c3 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -243,8 +243,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 		retval = -EACCES;
 	else if (atomic_read(&dev->power.usage_count) > 0)
 		retval = -EAGAIN;
-	else if (!dev->power.ignore_children &&
-			atomic_read(&dev->power.child_count))
+	else if (!pm_children_suspended(dev))
 		retval = -EBUSY;
 
 	/* Pending resume requests take precedence over suspends. */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index ca4823e..7de2aa5c 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -66,6 +66,12 @@ static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
 	dev->power.ignore_children = enable;
 }
 
+static inline bool pm_children_suspended(struct device *dev)
+{
+	return dev->power.ignore_children
+		|| !atomic_read(&dev->power.child_count);
+}
+
 static inline void pm_runtime_get_noresume(struct device *dev)
 {
 	atomic_inc(&dev->power.usage_count);
@@ -161,6 +167,7 @@ static inline void pm_runtime_allow(struct device *dev) {}
 static inline void pm_runtime_forbid(struct device *dev) {}
 
 static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {}
+static inline bool pm_children_suspended(struct device *dev) { return false; }
 static inline void pm_runtime_get_noresume(struct device *dev) {}
 static inline void pm_runtime_put_noidle(struct device *dev) {}
 static inline bool device_run_wake(struct device *dev) { return false; }
-- 
2.10.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/7] Runtime PM for Thunderbolt on Macs Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:40 +0100
  [PATCH v3 5/7] PM: Make requirements of dev_pm_domain_set() more  precise Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
  [PATCH v3 4/7] Revert "PM / Runtime: Remove the exported function  pm_children_suspended()" Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
  [PATCH v3 6/7] thunderbolt: Power down controller when idle Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
    Re: [PATCH v3 6/7] thunderbolt: Power down controller when idle Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-12-19 00:10 +0100
      Re: [PATCH v3 6/7] thunderbolt: Power down controller when idle Lukas Wunner <lukas@wunner.de> - 2016-12-20 12:30 +0100
        Re: [PATCH v3 6/7] thunderbolt: Power down controller when idle Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-12-20 14:50 +0100
          Re: [PATCH v3 6/7] thunderbolt: Power down controller when idle Lukas Wunner <lukas@wunner.de> - 2016-12-21 12:00 +0100
  [PATCH v3 2/7] PCI: Allow runtime PM on Thunderbolt ports Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
  [PATCH v3 7/7] thunderbolt: Runtime suspend NHI when idle Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
  [PATCH v3 1/7] PCI: Recognize Thunderbolt devices Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100
  [PATCH v3 3/7] PCI: Don't block runtime PM for Thunderbolt host  hotplug ports Lukas Wunner <lukas@wunner.de> - 2016-12-17 15:50 +0100

csiph-web