linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] PM / Runtime: Fix error path for prepare
@ 2013-11-15 11:40 Ulf Hansson
  2013-11-15 11:40 ` [RFC PATCH 2/2] PM / Runtime: Allow devices to become inactive during system suspend Ulf Hansson
  2013-11-15 15:14 ` [PATCH 1/2] PM / Runtime: Fix error path for prepare Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Ulf Hansson @ 2013-11-15 11:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Pavel Machek, linux-pm
  Cc: Greg Kroah-Hartman, linux-pci, linux-usb, Ulf Hansson,
	Kevin Hilman, Alan Stern

If a device prepare callback for some reason would fail, the PM core
prevented the device from going inactive forever.

In this case, to reverse the pm_runtime_get_noresume() we invokes the
asyncronous pm_runtime_put(), thus restoring the usage count.

Cc: Kevin Hilman <khilman@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/main.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ee039af..2a1b06a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
 
 	device_unlock(dev);
 
+	if (error)
+		pm_runtime_put(dev);
+
 	return error;
 }
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-11-15 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 11:40 [PATCH 1/2] PM / Runtime: Fix error path for prepare Ulf Hansson
2013-11-15 11:40 ` [RFC PATCH 2/2] PM / Runtime: Allow devices to become inactive during system suspend Ulf Hansson
2013-11-15 15:14 ` [PATCH 1/2] PM / Runtime: Fix error path for prepare Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).