* [PATCH v1 1/3] PM / sleep: Check legacy pm callbacks for direct complete
@ 2016-02-25 0:11 Derek Basehore
2016-02-25 0:11 ` [PATCH v1 2/3] PM / sleep: try to runtime suspend " Derek Basehore
2016-02-25 0:11 ` [PATCH v1 3/3] scsi: allow scsi devices to use " Derek Basehore
0 siblings, 2 replies; 5+ messages in thread
From: Derek Basehore @ 2016-02-25 0:11 UTC (permalink / raw)
To: linux-pm
Cc: Rafael J . Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
linux-kernel, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, Derek Basehore
This adds checks for legacy pm callbacks when setting no_pm_callbacks.
This fixes an issue where these suspend/resume callbacks were
incorrectly ignored during suspend/resume with direct complete.
Fixes: 4534d9d881f9 "PM / sleep: Go direct_complete if driver has..."
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
---
drivers/base/power/main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 6e7c3cc..e0017d9 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1764,8 +1764,10 @@ void device_pm_check_callbacks(struct device *dev)
{
spin_lock_irq(&dev->power.lock);
dev->power.no_pm_callbacks =
- (!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
- (!dev->class || pm_ops_is_empty(dev->class->pm)) &&
+ (!dev->bus || (!dev->bus->resume && !dev->bus->suspend &&
+ pm_ops_is_empty(dev->bus->pm))) &&
+ (!dev->class || (!dev->class->resume && !dev->class->suspend &&
+ pm_ops_is_empty(dev->class->pm))) &&
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
(!dev->driver || pm_ops_is_empty(dev->driver->pm));
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 2/3] PM / sleep: try to runtime suspend for direct complete
2016-02-25 0:11 [PATCH v1 1/3] PM / sleep: Check legacy pm callbacks for direct complete Derek Basehore
@ 2016-02-25 0:11 ` Derek Basehore
2016-03-01 20:41 ` Ulf Hansson
2016-02-25 0:11 ` [PATCH v1 3/3] scsi: allow scsi devices to use " Derek Basehore
1 sibling, 1 reply; 5+ messages in thread
From: Derek Basehore @ 2016-02-25 0:11 UTC (permalink / raw)
To: linux-pm
Cc: Rafael J . Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
linux-kernel, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, Derek Basehore
This tries to runtime suspend devices that are still active for direct
complete. This is for cases such as autosuspend delays which leaves
devices able to runtime suspend but still active. It's beneficial in
this case to runtime suspend the device to take advantage of direct
complete when possible.
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
---
drivers/base/power/main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e0017d9..9693032 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1380,7 +1380,12 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
goto Complete;
if (dev->power.direct_complete) {
- if (pm_runtime_status_suspended(dev)) {
+ /*
+ * Check if we're runtime suspended. If not, try to runtime
+ * suspend for autosuspend cases.
+ */
+ if (pm_runtime_status_suspended(dev) ||
+ !pm_runtime_suspend(dev)) {
pm_runtime_disable(dev);
if (pm_runtime_status_suspended(dev))
goto Complete;
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/3] PM / sleep: try to runtime suspend for direct complete
2016-02-25 0:11 ` [PATCH v1 2/3] PM / sleep: try to runtime suspend " Derek Basehore
@ 2016-03-01 20:41 ` Ulf Hansson
[not found] ` <CAGAzgsocODbT9+sKE0tR1W5V=68FkX=O6_mvSwhzu7Lq9E7NtQ@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2016-03-01 20:41 UTC (permalink / raw)
To: Derek Basehore
Cc: linux-pm@vger.kernel.org, Rafael J . Wysocki, Len Brown,
Pavel Machek, Greg Kroah-Hartman, linux-kernel@vger.kernel.org,
James E . J . Bottomley, Martin K . Petersen, linux-scsi
On 25 February 2016 at 01:11, Derek Basehore <dbasehore@chromium.org> wrote:
> This tries to runtime suspend devices that are still active for direct
> complete. This is for cases such as autosuspend delays which leaves
> devices able to runtime suspend but still active. It's beneficial in
> this case to runtime suspend the device to take advantage of direct
> complete when possible.
Unfortunate this doesn't work. In the device_prepare() phase the PM
core prevents runtime suspend via a call to pm_runtime_get_noresume().
Kind regards
Uffe
>
> Signed-off-by: Derek Basehore <dbasehore@chromium.org>
> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
> ---
> drivers/base/power/main.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index e0017d9..9693032 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -1380,7 +1380,12 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
> goto Complete;
>
> if (dev->power.direct_complete) {
> - if (pm_runtime_status_suspended(dev)) {
> + /*
> + * Check if we're runtime suspended. If not, try to runtime
> + * suspend for autosuspend cases.
> + */
> + if (pm_runtime_status_suspended(dev) ||
> + !pm_runtime_suspend(dev)) {
> pm_runtime_disable(dev);
> if (pm_runtime_status_suspended(dev))
> goto Complete;
> --
> 2.7.0.rc3.207.g0ac5344
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 3/3] scsi: allow scsi devices to use direct complete
2016-02-25 0:11 [PATCH v1 1/3] PM / sleep: Check legacy pm callbacks for direct complete Derek Basehore
2016-02-25 0:11 ` [PATCH v1 2/3] PM / sleep: try to runtime suspend " Derek Basehore
@ 2016-02-25 0:11 ` Derek Basehore
1 sibling, 0 replies; 5+ messages in thread
From: Derek Basehore @ 2016-02-25 0:11 UTC (permalink / raw)
To: linux-pm
Cc: Rafael J . Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
linux-kernel, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, Derek Basehore
This allows scsi devices to remain runtime suspended for system
suspend. Since runtime suspend is stricter than system suspend
callbacks, this is just returning a positive number for the prepare
callback.
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
---
drivers/scsi/scsi_pm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index b44c1bb..7af76ad 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -178,7 +178,7 @@ static int scsi_bus_prepare(struct device *dev)
/* Wait until async scanning is finished */
scsi_complete_async_scans();
}
- return 0;
+ return 1;
}
static int scsi_bus_suspend(struct device *dev)
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-02 9:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 0:11 [PATCH v1 1/3] PM / sleep: Check legacy pm callbacks for direct complete Derek Basehore
2016-02-25 0:11 ` [PATCH v1 2/3] PM / sleep: try to runtime suspend " Derek Basehore
2016-03-01 20:41 ` Ulf Hansson
[not found] ` <CAGAzgsocODbT9+sKE0tR1W5V=68FkX=O6_mvSwhzu7Lq9E7NtQ@mail.gmail.com>
2016-03-02 9:26 ` Ulf Hansson
2016-02-25 0:11 ` [PATCH v1 3/3] scsi: allow scsi devices to use " Derek Basehore
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).