Skip to contentSkip to conversation

PM: runtime: Drop status check from pm_runtime_force_resume()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Feb 27, 2025 – Mar 3, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PM: runtime: Drop status check from pm_runtime_force_resume()

From: Rafael J. Wysocki <[email protected]>

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.

---

The previous version of this patch is here:

https://lore.kernel.org/linux-pm/[email protected]/

v1 -> v2: Minor changelog edits.

---
 drivers/base/power/runtime.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -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;
 
 	/*
Reviewed-by on v2 1/1
#1 lore raw
Quoted 14 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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.

Quoted 4 lines

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

Seems reasonable to me! Please add:

Kind regards
Uffe

Quoted 26 lines

---

The previous version of this patch is here:

https://lore.kernel.org/linux-pm/[email protected]/

v1 -> v2: Minor changelog edits.

---
 drivers/base/power/runtime.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -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;
 
        /*