All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] PM: check for complete cb before device lock in dpm_complete
@ 2015-10-16 22:45 Todd Brandt
  2015-10-16 22:49 ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Todd Brandt @ 2015-10-16 22:45 UTC (permalink / raw)
  To: linux-pm, rafael.j.wysocki; +Cc: rjw, todd.e.brandt, Todd Brandt

If a device has no pm_ops complete callback it shouldn't have
to be locked in order to skip it in the dpm_complete call. This causes
problems when a device without a complete callback has already begun
operation after its resume cb is called. It can end up holding up the
system resume as the pm subsystem tries to get a device lock just to
check for a callback that isn't there.

This is basically the original v1 patch but updated for the latest kernel.

Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
---
 drivers/base/power/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 1710c26..9bb8ff0 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -899,8 +899,6 @@ static void device_complete(struct device *dev, pm_message_t state)
 	if (dev->power.syscore)
 		return;
 
-	device_lock(dev);
-
 	if (dev->pm_domain) {
 		info = "completing power domain ";
 		callback = dev->pm_domain->ops.complete;
@@ -920,13 +918,15 @@ static void device_complete(struct device *dev, pm_message_t state)
 		callback = dev->driver->pm->complete;
 	}
 
-	if (callback) {
-		pm_dev_dbg(dev, state, info);
-		callback(dev);
-	}
+	if (!callback)
+		goto Complete;
 
+	device_lock(dev);
+	pm_dev_dbg(dev, state, info);
+	callback(dev);
 	device_unlock(dev);
 
+Complete:
 	pm_runtime_put(dev);
 }
 
-- 
2.1.4


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

end of thread, other threads:[~2015-11-30  1:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 22:45 [PATCH v3] PM: check for complete cb before device lock in dpm_complete Todd Brandt
2015-10-16 22:49 ` Rafael J. Wysocki
2015-10-16 23:06   ` Todd E Brandt
2015-10-17 15:04     ` Alan Stern
2015-11-29  5:33   ` Dmitry Torokhov
2015-11-30  2:15     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.