diff mbox

[2/4] PM / Runtime: Prevent re-resuming devices in pm_runtime_force_resume()

Message ID 1463485296-22742-3-git-send-email-ulf.hansson@linaro.org
State Superseded
Headers show

Commit Message

Ulf Hansson May 17, 2016, 11:41 a.m. UTC
If the device has already been resumed before pm_runtime_force_resume() is
invoked, prevent calling the ->runtime_resume() callback for the device,
as it's not the expected behaviour from the subsystem/driver.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 drivers/base/power/runtime.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
1.9.1

Comments

Ulf Hansson May 24, 2016, 6:30 a.m. UTC | #1
On 23 May 2016 at 23:30, Kevin Hilman <khilman@baylibre.com> wrote:
> Ulf Hansson <ulf.hansson@linaro.org> writes:

>

>> If the device has already been resumed before pm_runtime_force_resume() is

>> invoked, prevent calling the ->runtime_resume() callback for the device,

>> as it's not the expected behaviour from the subsystem/driver.

>

> I'm not following how this description matches the code.

>

> Based on the code, it seems like it should say "If the device has not

> been runtime suspended, don't runtime resume it."   IOW, "device has

> already been resumed" is not what pm_runtime_status_suspended() is

> checking for.


Hmm, these helpers are executed during the system PM sequence to
re-use the ->runtime_suspend|resume() callbacks to suspend and resume
the device.
The message is the change log do become a bit confusing because of
that, what do you think about the below instead?

If the runtime PM status of the device isn't runtime suspended, prevent
pm_runtime_force_resume() to call the ->runtime_resume() callback for the
device, as it's not the expected behaviour from the subsystem/driver.

[...]

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index b746904..09e4eb1 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1506,6 +1506,9 @@  int pm_runtime_force_resume(struct device *dev)
 		goto out;
 	}
 
+	if (!pm_runtime_status_suspended(dev))
+		goto out;
+
 	ret = pm_runtime_set_active(dev);
 	if (ret)
 		goto out;