diff mbox series

[v1,01/10] PM: runtime: Introduce pm_runtime_no_support()

Message ID 22608556.EfDdHjke4D@rjwysocki.net
State New
Headers show
Series PM: Make the core and pm_runtime_force_suspend/resume() agree more | expand

Commit Message

Rafael J. Wysocki Feb. 11, 2025, 9:02 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Introduce a new helper function called pm_runtime_no_support() for
checking the power.last_status value indicating whether or not runtime
PM has ever been enabled for the given device.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/linux/pm_runtime.h |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -182,6 +182,19 @@ 
 }
 
 /**
+ * pm_runtime_no_support - Check runtime PM support.
+ * @dev: Target device.
+ *
+ * Return %true if runtime PM is currently disabled for @dev and its last
+ * runtime PM status value is %RPM_INVALID, which means that runtime PM has
+ * never been enabled for it, or %false otherwise.
+ */
+static inline bool pm_runtime_no_support(struct device *dev)
+{
+	return dev->power.disable_depth && dev->power.last_status == RPM_INVALID;
+}
+
+/**
  * pm_runtime_enabled - Check if runtime PM is enabled.
  * @dev: Target device.
  *
@@ -284,6 +297,7 @@ 
 static inline bool pm_runtime_suspended(struct device *dev) { return false; }
 static inline bool pm_runtime_active(struct device *dev) { return true; }
 static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
+static inline bool pm_runtime_no_support(struct device *dev) { return true; }
 static inline bool pm_runtime_enabled(struct device *dev) { return false; }
 
 static inline void pm_runtime_no_callbacks(struct device *dev) {}