The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Derek Basehore <dbasehore@chromium.org>
Cc: linux-pm@vger.kernel.org, Len Brown <len.brown@intel.com>,
	Pavel Machek <pavel@ucw.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 2/3] PM / sleep: try to runtime suspend for direct complete
Date: Sun, 28 Feb 2016 02:31:11 +0100	[thread overview]
Message-ID: <3183435.BG93qPHVgS@vostro.rjw.lan> (raw)
In-Reply-To: <1456359748-22838-2-git-send-email-dbasehore@chromium.org>

On Wednesday, February 24, 2016 04:22:27 PM Derek Basehore 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.
> 
> 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;
> 

This can be done somewhat simpler, because pm_runtime_suspend() will check
if the device has already been suspended:

	ret = pm_runtime_suspend(dev);
	if (ret >= 0) {

and you don't need the extra pm_runtime_status_suspended(dev) check.

Thanks,
Rafael

  reply	other threads:[~2016-02-28  1:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25  0:22 [PATCH v2 1/3] PM / sleep: Check legacy pm callbacks for direct complete Derek Basehore
2016-02-25  0:22 ` [PATCH v2 2/3] PM / sleep: try to runtime suspend " Derek Basehore
2016-02-28  1:31   ` Rafael J. Wysocki [this message]
2016-03-01 21:48     ` dbasehore .
2016-02-25  0:22 ` [PATCH v2 3/3] scsi: allow scsi devices to use " Derek Basehore
2016-02-27  7:26   ` Mika Westerberg
2016-02-27  8:10     ` dbasehore .
2016-02-27  8:38       ` Mika Westerberg
2016-02-27  9:07         ` dbasehore .
2016-02-29 10:10           ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3183435.BG93qPHVgS@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=dbasehore@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox