The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] PM: runtime: Drop status check from pm_runtime_force_resume()
@ 2025-02-27 10:56 Rafael J. Wysocki
  2025-03-03 11:47 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2025-02-27 10:56 UTC (permalink / raw)
  To: Linux PM, Ulf Hansson
  Cc: LKML, Alan Stern, Johan Hovold, Manivannan Sadhasivam, Jon Hunter

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

Since pm_runtime_force_resume() requires pm_runtime_force_suspend() to
be called before it on the same device, the runtime PM status of the
device is RPM_SUSPENDED when it is called unless the device's runtime
PM status is changed somewhere else in the meantime.

However, even if that happens, the power.needs_force_resume
check is still required to pass and that flag is only set by
pm_runtime_force_suspend() once and it is cleared at the end of
pm_runtime_force_resume(), so it cannot be taken into account
twice in a row.

According to the above, the pm_runtime_status_suspended(dev) check in
pm_runtime_force_resume() is redundant, so drop it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

The previous version of this patch is here:

https://lore.kernel.org/linux-pm/6038511.MhkbZ0Pkbq@rjwysocki.net/

v1 -> v2: Minor changelog edits.

---
 drivers/base/power/runtime.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1982,7 +1982,7 @@
 	int (*callback)(struct device *);
 	int ret = 0;
 
-	if (!pm_runtime_status_suspended(dev) || !dev->power.needs_force_resume)
+	if (!dev->power.needs_force_resume)
 		goto out;
 
 	/*




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-03 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 10:56 [PATCH v2] PM: runtime: Drop status check from pm_runtime_force_resume() Rafael J. Wysocki
2025-03-03 11:47 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox