mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-pm@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / Runtime: honor device autosuspend in pm_generic_runtime_idle()
Date: Mon, 13 May 2013 13:50:18 +0200	[thread overview]
Message-ID: <14273128.qrOYeDHLlu@vostro.rjw.lan> (raw)
In-Reply-To: <1368443127-9636-1-git-send-email-mika.westerberg@linux.intel.com>

On Monday, May 13, 2013 02:05:27 PM Mika Westerberg wrote:
> If the device is using autosuspend we should honor that and call
> pm_runtime_autosuspend() instead of pm_runtime_suspend(). Failing to do so
> causes the device to be suspended immediately even though it expects to be
> suspended only when the autosuspend delay is expired.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
>  drivers/base/power/generic_ops.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c
> index bfd898b..19786ca 100644
> --- a/drivers/base/power/generic_ops.c
> +++ b/drivers/base/power/generic_ops.c
> @@ -29,7 +29,10 @@ int pm_generic_runtime_idle(struct device *dev)
>  			return ret;
>  	}
>  
> -	pm_runtime_suspend(dev);
> +	if (dev->power.use_autosuspend)
> +		pm_runtime_autosuspend(dev);
> +	else
> +		pm_runtime_suspend(dev);
>  	return 0;

First of all, this is racy (power.use_autosuspend shoud be accessed under
power.lock).

Second, this is not the only place we'd need to make this change (the analogous
function for PCI is one example, but there may be others).

Finally, I'm not sure how to address this problem in general.  It may be better
to simply modify rpm_idle() and remove pm_generic_runtime_idle() etc. entirely.

I'll have a look at that, thanks for pointing out the problem.

Rafael


>  }
>  EXPORT_SYMBOL_GPL(pm_generic_runtime_idle);
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-05-13 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 11:05 Mika Westerberg
2013-05-13 11:50 ` Rafael J. Wysocki [this message]
2013-05-28 12:53   ` Rafael J. Wysocki
2013-05-28 14:13     ` Alan Stern
2013-05-28 20:59       ` Rafael J. Wysocki
2013-05-29  8:23     ` 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=14273128.qrOYeDHLlu@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pavel@ucw.cz \
    --cc=rafael.j.wysocki@intel.com \
    /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

all inboxes | Powered by JetHome®