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


Groups > linux.kernel > #1479527

[RFC/RFT][PATCH v2 4/7] PM / runtime: Pass flags argument to __pm_runtime_disable()

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject [RFC/RFT][PATCH v2 4/7] PM / runtime: Pass flags argument to __pm_runtime_disable()
Date 2016-09-08 23:30 +0200
Message-ID <sff3s-2Cw-17@gated-at.bofh.it> (permalink)
References <sff3r-2Cw-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Modify __pm_runtime_disable() to take a flags argument instead of
the bool one it takes currently which will allow its behavior to
be modified in more than one way.  Introduce a flag
RPM_DISABLE_CHECK_RESUME to address the case currenty addressed by
passing 'true' to __pm_runtime_disable() as the second argument.

A subsequent change will add one more flag to use with
__pm_runtime_disable().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 Documentation/power/runtime_pm.txt |    2 +-
 drivers/base/power/main.c          |    2 +-
 drivers/base/power/runtime.c       |   10 +++++-----
 include/linux/pm_runtime.h         |    9 ++++++---
 4 files changed, 13 insertions(+), 10 deletions(-)

Index: linux-pm/drivers/base/power/runtime.c
===================================================================
--- linux-pm.orig/drivers/base/power/runtime.c
+++ linux-pm/drivers/base/power/runtime.c
@@ -1158,18 +1158,18 @@ EXPORT_SYMBOL_GPL(pm_runtime_barrier);
 /**
  * __pm_runtime_disable - Disable runtime PM of a device.
  * @dev: Device to handle.
- * @check_resume: If set, check if there's a resume request for the device.
+ * @flags: Behavior modifiers.
  *
  * Increment power.disable_depth for the device and if it was zero previously,
  * cancel all pending runtime PM requests for the device and wait for all
  * operations in progress to complete.  The device can be either active or
  * suspended after its runtime PM has been disabled.
  *
- * If @check_resume is set and there's a resume request pending when
+ * If the CHECK_RESUME flag is set and there's a resume request pending when
  * __pm_runtime_disable() is called and power.disable_depth is zero, the
  * function will wake up the device before disabling its runtime PM.
  */
-void __pm_runtime_disable(struct device *dev, bool check_resume)
+void __pm_runtime_disable(struct device *dev, unsigned int flags)
 {
 	spin_lock_irq(&dev->power.lock);
 
@@ -1183,7 +1183,7 @@ void __pm_runtime_disable(struct device
 	 * means there probably is some I/O to process and disabling runtime PM
 	 * shouldn't prevent the device from processing the I/O.
 	 */
-	if (check_resume && dev->power.request_pending
+	if ((flags & RPM_DISABLE_CHECK_RESUME) && dev->power.request_pending
 	    && dev->power.request == RPM_REQ_RESUME) {
 		/*
 		 * Prevent suspends and idle notifications from being carried
@@ -1442,7 +1442,7 @@ void pm_runtime_reinit(struct device *de
  */
 void pm_runtime_remove(struct device *dev)
 {
-	__pm_runtime_disable(dev, false);
+	__pm_runtime_disable(dev, 0);
 	pm_runtime_reinit(dev);
 }
 
Index: linux-pm/include/linux/pm_runtime.h
===================================================================
--- linux-pm.orig/include/linux/pm_runtime.h
+++ linux-pm/include/linux/pm_runtime.h
@@ -23,6 +23,9 @@
 					    usage_count */
 #define RPM_AUTO		0x08	/* Use autosuspend_delay */
 
+/* Runtime PM disable/enable flags */
+#define RPM_DISABLE_CHECK_RESUME	(1 << 0)
+
 #ifdef CONFIG_PM
 extern struct workqueue_struct *pm_wq;
 
@@ -44,7 +47,7 @@ extern int pm_schedule_suspend(struct de
 extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
 extern int pm_runtime_barrier(struct device *dev);
 extern void pm_runtime_enable(struct device *dev);
-extern void __pm_runtime_disable(struct device *dev, bool check_resume);
+extern void __pm_runtime_disable(struct device *dev, unsigned int flags);
 extern void pm_runtime_allow(struct device *dev);
 extern void pm_runtime_forbid(struct device *dev);
 extern void pm_runtime_no_callbacks(struct device *dev);
@@ -157,7 +160,7 @@ static inline int __pm_runtime_set_statu
 					    unsigned int status) { return 0; }
 static inline int pm_runtime_barrier(struct device *dev) { return 0; }
 static inline void pm_runtime_enable(struct device *dev) {}
-static inline void __pm_runtime_disable(struct device *dev, bool c) {}
+static inline void __pm_runtime_disable(struct device *dev, unsigned int flags) {}
 static inline void pm_runtime_allow(struct device *dev) {}
 static inline void pm_runtime_forbid(struct device *dev) {}
 
@@ -272,7 +275,7 @@ static inline void pm_runtime_set_suspen
 
 static inline void pm_runtime_disable(struct device *dev)
 {
-	__pm_runtime_disable(dev, true);
+	__pm_runtime_disable(dev, RPM_DISABLE_CHECK_RESUME);
 }
 
 static inline void pm_runtime_use_autosuspend(struct device *dev)
Index: linux-pm/drivers/base/power/main.c
===================================================================
--- linux-pm.orig/drivers/base/power/main.c
+++ linux-pm/drivers/base/power/main.c
@@ -1228,7 +1228,7 @@ static int __device_suspend_late(struct
 	TRACE_DEVICE(dev);
 	TRACE_SUSPEND(0);
 
-	__pm_runtime_disable(dev, false);
+	__pm_runtime_disable(dev, 0);
 
 	if (async_error)
 		goto Complete;
Index: linux-pm/Documentation/power/runtime_pm.txt
===================================================================
--- linux-pm.orig/Documentation/power/runtime_pm.txt
+++ linux-pm/Documentation/power/runtime_pm.txt
@@ -685,7 +685,7 @@ out the following operations:
     right before executing the subsystem-level .prepare() callback for it and
     pm_runtime_barrier() is called for every device right before executing the
     subsystem-level .suspend() callback for it.  In addition to that the PM core
-    calls  __pm_runtime_disable() with 'false' as the second argument for every
+    calls  __pm_runtime_disable() with 0 as the second argument for every
     device right before executing the subsystem-level .suspend_late() callback
     for it.
 

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


Thread

[RFC/RFT][PATCH v2 0/7] Functional dependencies between devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
  [RFC/RFT][PATCH v2 7/7] PM / runtime: Optimize the use of device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
  [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep transitions in progress "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
    Re: [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep  transitions in progress Lukas Wunner <lukas@wunner.de> - 2016-09-12 16:10 +0200
      Re: [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep transitions in progress "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-12 23:20 +0200
        Re: [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep  transitions in progress Lukas Wunner <lukas@wunner.de> - 2016-09-13 01:00 +0200
        Re: [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep  transitions in progress Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-13 09:30 +0200
          Re: [RFC/RFT][PATCH v2 5/7] PM / runtime: Flag to indicate PM sleep transitions in progress "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 02:00 +0200
  [RFC/RFT][PATCH v2 4/7] PM / runtime: Pass flags argument to __pm_runtime_disable() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
  Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
  [RFC/RFT][PATCH v2 1/7] driver core: Add a wrapper around __device_release_driver() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
  [RFC/RFT][PATCH v2 3/7] PM / sleep: Make async suspend/resume of devices use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
    Re: [RFC/RFT][PATCH v2 3/7] PM / sleep: Make async suspend/resume of  devices use device links Lukas Wunner <lukas@wunner.de> - 2016-09-10 15:40 +0200
      Re: [RFC/RFT][PATCH v2 3/7] PM / sleep: Make async suspend/resume of  devices use device links "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-11 00:20 +0200
  [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
    Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Ulf Hansson <ulf.hansson@linaro.org> - 2016-09-09 10:30 +0200
      Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Mark Brown <broonie@kernel.org> - 2016-09-09 14:10 +0200
        Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Ulf Hansson <ulf.hansson@linaro.org> - 2016-09-09 16:20 +0200
      Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-15 03:10 +0200
    Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-11 15:50 +0200
      Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-11 22:50 +0200
        Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 03:20 +0200
          Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies  tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-14 10:30 +0200
            Re: [RFC/RFT][PATCH v2 2/7] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 15:20 +0200
  [RFC/RFT][PATCH v2 6/7] PM / runtime: Use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 23:30 +0200
    Re: [RFC/RFT][PATCH v2 6/7] PM / runtime: Use device links Lukas Wunner <lukas@wunner.de> - 2016-09-12 11:50 +0200
      Re: [RFC/RFT][PATCH v2 6/7] PM / runtime: Use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-12 16:00 +0200
        Re: [RFC/RFT][PATCH v2 6/7] PM / runtime: Use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 03:20 +0200
  Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices Lukas Wunner <lukas@wunner.de> - 2016-09-10 13:40 +0200
    Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-11 00:10 +0200
      Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices Lukas Wunner <lukas@wunner.de> - 2016-09-13 20:00 +0200
        Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 01:20 +0200
          Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices Lukas Wunner <lukas@wunner.de> - 2016-09-18 14:40 +0200
  Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-13 12:00 +0200
    Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 00:40 +0200
      Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices Lukas Wunner <lukas@wunner.de> - 2016-09-18 13:30 +0200
  [RFC/RFT][PATCH v3 5/5] PM / runtime: Optimize the use of device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
  [Resend][RFC/RFT][PATCH v3 1/5] driver core: Add a wrapper around __device_release_driver() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
  [RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
    Re: [RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies  tracking support Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-16 10:00 +0200
      Re: [RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies  tracking support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-16 14:10 +0200
    [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 14:30 +0200
      Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional  dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-20 00:50 +0200
  [RFC/RFT][PATCH v3 3/5] PM / sleep: Make async suspend/resume of devices use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
  [RFC/RFT][PATCH v3 0/5] Functional dependencies between devices "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
    [RFC/RFT][PATCH v3 4/5] PM / runtime: Use device links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
    Re: [RFC/RFT][PATCH v3 0/5] Functional dependencies between devices Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-16 09:30 +0200
      Re: [RFC/RFT][PATCH v3 0/5] Functional dependencies between devices Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-16 10:00 +0200
        Re: [RFC/RFT][PATCH v3 0/5] Functional dependencies between devices "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-16 14:10 +0200

csiph-web