linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend
@ 2013-11-13 16:29 Ulf Hansson
  2013-11-13 19:16 ` Alan Stern
  2013-11-13 22:13 ` Rafael J. Wysocki
  0 siblings, 2 replies; 34+ messages in thread
From: Ulf Hansson @ 2013-11-13 16:29 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

The PM core was preventing devices from going inactive during system
suspend. Remove this constraint and moreover try to inactivate devices
by invoking pm_runtime_idle() before proceeding with device's
suspend_late callbacks.

A great amount of drivers that uses runtime PM will benefit from this.

Drivers that implements some of the system ->suspend* callbacks for the
only reason of making sure the runtime PM resourses gets inactive, can
now solely instead rely on the PM core to handle this.

In the case were drivers needs there runtime resourses to be activated
to be able to handle their system suspend tasks, those can easily just
restore the runtime PM usage count, pm_runtime_put_sync(), once done
with it's suspend operations, which then will inactivate the device.

Cc: Kevin Hilman <khilman@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

There are a quite long history for how the PM core behaves around this
topic. Changes has been iterated, back for forward, you might even
think that it should have been settled at this point. So, forgive me
for bringing this up, again.

This patch shall obviously not be merged as is, it will cause
regressions for several drivers and subsystems. The intent is instead
to try to follow up on previous discussions to see if we might end up
closer to the sequence, which my RFC PATCH suggests, or if I am just
bothering you completely unnecessary.

---
 drivers/base/power/main.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ee039af..670b1d5 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -832,7 +832,7 @@ static void device_complete(struct device *dev, pm_message_t state)
 
 	device_unlock(dev);
 
-	pm_runtime_put(dev);
+	pm_request_idle(dev);
 }
 
 /**
@@ -1004,6 +1004,7 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
 	pm_callback_t callback = NULL;
 	char *info = NULL;
 
+	pm_runtime_idle(dev);
 	__pm_runtime_disable(dev, false);
 
 	if (dev->power.syscore)
@@ -1312,14 +1313,6 @@ static int device_prepare(struct device *dev, pm_message_t state)
 	if (dev->power.syscore)
 		return 0;
 
-	/*
-	 * If a device's parent goes into runtime suspend at the wrong time,
-	 * it won't be possible to resume the device.  To prevent this we
-	 * block runtime suspend here, during the prepare phase, and allow
-	 * it again during the complete phase.
-	 */
-	pm_runtime_get_noresume(dev);
-
 	device_lock(dev);
 
 	dev->power.wakeup_path = device_may_wakeup(dev);
-- 
1.7.9.5

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

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

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 16:29 [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend Ulf Hansson
2013-11-13 19:16 ` Alan Stern
2013-11-13 22:21   ` Rafael J. Wysocki
2013-11-14 13:21   ` Ulf Hansson
2013-11-14 15:59     ` Alan Stern
2013-11-14 16:40       ` Ulf Hansson
2013-11-14 17:57         ` Alan Stern
2013-11-15  8:44           ` Ulf Hansson
2013-11-15  9:29             ` Bjørn Mork
2013-11-15 10:34               ` Ulf Hansson
2013-11-15 15:22             ` Alan Stern
2013-11-18 13:27               ` Ulf Hansson
2013-11-18 15:17                 ` Alan Stern
2013-11-19 12:21                   ` Ulf Hansson
2013-11-19 13:21                     ` Rafael J. Wysocki
2013-11-19 15:35                     ` Alan Stern
2013-11-19 16:45                       ` Kevin Hilman
     [not found]                         ` <87r4acmjc6.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-11-19 18:03                           ` Alan Stern
2013-11-19 18:43                             ` Kevin Hilman
     [not found]                             ` <Pine.LNX.4.44L0.1311191258550.1145-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-21  9:00                               ` Ulf Hansson
2013-11-21 15:54                                 ` Alan Stern
2013-11-22  8:19                                   ` Ulf Hansson
2013-11-22 12:06                                     ` Rafael J. Wysocki
2013-11-20 10:52                       ` Ulf Hansson
2013-11-20 11:23                         ` Pavel Machek
2013-11-20 11:53                           ` Rafael J. Wysocki
2013-11-20 12:43                           ` Ulf Hansson
2013-11-20 16:58                             ` Alan Stern
2013-11-20 19:55                               ` Pavel Machek
2013-11-20 16:55                         ` Alan Stern
2013-11-13 22:13 ` Rafael J. Wysocki
     [not found]   ` <2003753.HAeVh74cdL-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2013-11-14 14:32     ` Ulf Hansson
2013-11-14 15:55       ` Alan Stern
2013-11-21  9:11         ` Ulf Hansson

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).