[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9421808.CDJkKcVGEf@rjwysocki.net>
Date: Tue, 11 Feb 2025 22:05:51 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Alan Stern <stern@...land.harvard.edu>, Ulf Hansson <ulf.hansson@...aro.org>,
Johan Hovold <johan@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Jon Hunter <jonathanh@...dia.com>
Subject:
[PATCH v1 03/10] PM: runtime: Use pm_runtime_no_support() in
pm_runtime_force_suspend()
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Currently, pm_runtime_force_suspend() does not distinguish devices
without runtime PM enabled and it may be called for such devices
incidentally. In that case, it works inconsistently depending on
the device runtime PM status value which generally is not expected
to be meaningful for devices with runtime PM permanently disabled.
Namely, if the runtime PM status of the device is RPM_SUSPENDED, it
will be ignored as though it had been runtime-suspended, but if its
runtime PM status is RPM_ACTIVE, pm_runtime_force_suspend() will
attempt to suspend it which may not work.
Make pm_runtime_force_suspend() more consistent by adding a
pm_runtime_no_support() check to it that will cause it to skip
devices with no runtime PM support.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
drivers/base/power/runtime.c | 6 +++++-
include/linux/pm_runtime.h | 14 ++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1908,7 +1908,11 @@
int ret;
pm_runtime_disable(dev);
- if (pm_runtime_status_suspended(dev))
+ /*
+ * Do not attempt to suspend devices that have been suspended already or
+ * that have never had runtime PM enabled.
+ */
+ if (pm_runtime_status_suspended(dev) || pm_runtime_no_support(dev))
return 0;
callback = RPM_GET_CALLBACK(dev, runtime_suspend);
Powered by blists - more mailing lists