[PATCH v1 01/10] PM: runtime: Introduce pm_runtime_no_support()
From: Rafael J. Wysocki
Date: Tue Feb 11 2025 - 16:27:15 EST
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
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@xxxxxxxxx>
---
include/linux/pm_runtime.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- 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) {}