From: Ulf Hansson <ulf.hansson-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
To: Russell King - ARM Linux <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Cc: "spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] spi/pl022: Enable clock in probe an use runtime_idle
Date: Thu, 3 Nov 2011 14:59:53 +0100 [thread overview]
Message-ID: <4EB29E59.4040509@stericsson.com> (raw)
In-Reply-To: <20111102141628.GG19187-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
>> @@ -2342,11 +2350,19 @@ static int pl022_runtime_resume(struct device *dev)
>>
>> return 0;
>> }
>> +
>> +static int pl022_runtime_idle(struct device *dev)
>> +{
>> + pm_runtime_suspend(dev);
>> + return 0;
>> +}
>> #endif
>>
>> static const struct dev_pm_ops pl022_dev_pm_ops = {
>> SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
>> - SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
>> + SET_RUNTIME_PM_OPS(pl022_runtime_suspend,
>> + pl022_runtime_resume,
>> + pl022_runtime_idle)
>
> This is an unnecessary change.
>
> The bus-level ops runtime PM ops call pm_generic_runtime_idle() when
> its 'runtime_idle' operation is invoked. Let's look at the code
> there:
>
> int pm_generic_runtime_idle(struct device *dev)
> {
> const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>
> if (pm && pm->runtime_idle) {
> int ret = pm->runtime_idle(dev);
> if (ret)
> return ret;
> }
>
> pm_runtime_suspend(dev);
> return 0;
> }
>
> If the driver has a NULL runtime idle, then generic code will call
> pm_runtime_suspend() for the device. So, adding a runtime_idle callback
> to a driver to explicitly call pm_runtime_suspend() is not required.
>
You are somewhat correct. But the patch is still needed as is!
Reason is simply that after a probe, driver core is calling
pm_runtime_put_sync. This will not go through the
pm_generic_runtime_idle function, but directly to __pm_runtime_idle.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
WARNING: multiple messages have this Message-ID (diff)
From: ulf.hansson@stericsson.com (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi/pl022: Enable clock in probe an use runtime_idle
Date: Thu, 3 Nov 2011 14:59:53 +0100 [thread overview]
Message-ID: <4EB29E59.4040509@stericsson.com> (raw)
In-Reply-To: <20111102141628.GG19187@n2100.arm.linux.org.uk>
>> @@ -2342,11 +2350,19 @@ static int pl022_runtime_resume(struct device *dev)
>>
>> return 0;
>> }
>> +
>> +static int pl022_runtime_idle(struct device *dev)
>> +{
>> + pm_runtime_suspend(dev);
>> + return 0;
>> +}
>> #endif
>>
>> static const struct dev_pm_ops pl022_dev_pm_ops = {
>> SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
>> - SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
>> + SET_RUNTIME_PM_OPS(pl022_runtime_suspend,
>> + pl022_runtime_resume,
>> + pl022_runtime_idle)
>
> This is an unnecessary change.
>
> The bus-level ops runtime PM ops call pm_generic_runtime_idle() when
> its 'runtime_idle' operation is invoked. Let's look at the code
> there:
>
> int pm_generic_runtime_idle(struct device *dev)
> {
> const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>
> if (pm && pm->runtime_idle) {
> int ret = pm->runtime_idle(dev);
> if (ret)
> return ret;
> }
>
> pm_runtime_suspend(dev);
> return 0;
> }
>
> If the driver has a NULL runtime idle, then generic code will call
> pm_runtime_suspend() for the device. So, adding a runtime_idle callback
> to a driver to explicitly call pm_runtime_suspend() is not required.
>
You are somewhat correct. But the patch is still needed as is!
Reason is simply that after a probe, driver core is calling
pm_runtime_put_sync. This will not go through the
pm_generic_runtime_idle function, but directly to __pm_runtime_idle.
next prev parent reply other threads:[~2011-11-03 13:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 14:08 [PATCH] spi/pl022: Enable clock in probe an use runtime_idle Ulf Hansson
2011-10-21 14:08 ` Ulf Hansson
[not found] ` <1319206124-17549-1-git-send-email-ulf.hansson-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2011-10-22 16:41 ` Linus Walleij
2011-10-22 16:41 ` Linus Walleij
[not found] ` <CACRpkdY2Csh58QbtnfYikr-VtYR_wDRfC2_X_+wR3OPhgTBE3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-24 7:38 ` Ulf Hansson
2011-10-24 7:38 ` Ulf Hansson
2011-11-02 14:16 ` Russell King - ARM Linux
2011-11-02 14:16 ` Russell King - ARM Linux
[not found] ` <20111102141628.GG19187-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-11-03 13:59 ` Ulf Hansson [this message]
2011-11-03 13:59 ` Ulf Hansson
2011-11-03 14:13 ` Russell King - ARM Linux
2011-11-03 14:13 ` Russell King - ARM Linux
2011-11-03 15:47 ` Ulf Hansson
2011-11-03 15:47 ` Ulf Hansson
2011-10-24 12:03 ` Grant Likely
2011-10-24 12:03 ` Grant Likely
[not found] ` <20111024120342.GQ8708-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-10-24 12:50 ` Russell King - ARM Linux
2011-10-24 12:50 ` Russell King - ARM Linux
2011-10-24 14:58 ` Linus Walleij
2011-10-24 14:58 ` Linus Walleij
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=4EB29E59.4040509@stericsson.com \
--to=ulf.hansson-0is4wlfg1ojsueelwk9/pw@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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 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.