From: Jon Hunter <jon-hunter@ti.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Kevin Hilman <khilman@ti.com>,
linux-omap <linux-omap@vger.kernel.org>,
Ming Lei <ming.lei@canonical.com>,
Benoit Cousson <b-cousson@ti.com>, Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 4/6] ARM: OMAP4: PMU: Add runtime PM support
Date: Tue, 5 Jun 2012 08:19:02 -0500 [thread overview]
Message-ID: <4FCE0746.2090505@ti.com> (raw)
In-Reply-To: <4FCD2C30.8000106@ti.com>
Hi Will,
On 06/04/2012 04:44 PM, Jon Hunter wrote:
[...]
> diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c
> index 2334bf8..8ffbb09 100644
> --- a/arch/arm/kernel/pmu.c
> +++ b/arch/arm/kernel/pmu.c
> @@ -13,6 +13,8 @@
> #include <linux/err.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/platform_device.h>
>
> #include <asm/pmu.h>
>
> @@ -22,15 +24,17 @@
> static unsigned long pmu_lock[BITS_TO_LONGS(ARM_NUM_PMU_DEVICES)];
>
> int
> -reserve_pmu(enum arm_pmu_type type)
> +reserve_pmu(struct arm_pmu *armpmu)
> {
> - return test_and_set_bit_lock(type, pmu_lock) ? -EBUSY : 0;
> + pm_runtime_get_sync(&armpmu->plat_device->dev);
> + return test_and_set_bit_lock(armpmu->type, pmu_lock) ? -EBUSY : 0;
> }
> EXPORT_SYMBOL_GPL(reserve_pmu);
>
> void
> -release_pmu(enum arm_pmu_type type)
> +release_pmu(struct arm_pmu *armpmu)
> {
> - clear_bit_unlock(type, pmu_lock);
> + clear_bit_unlock(armpmu->type, pmu_lock);
> + pm_runtime_put_sync(&armpmu->plat_device->dev);
> }
> EXPORT_SYMBOL_GPL(release_pmu);
I have realised that there is a slight bug in the above
pm_runtime_get/put. The calls to pm_runtime_get/put need to be
symmetrical otherwise the if we call _get more than _put the pmu will
stay on. So in the reserve_pmu, I should only call pm_runtime_get if we
acquire the lock.
Anyway, let me know what you think of this approach. An alternative is
to put the calls pm_runtime_get/put outside of the reserve/release_pmu,
which would be a simpler change, but I was thinking that the above maybe
more aligned with your thinking.
Cheers
Jon
next prev parent reply other threads:[~2012-06-05 13:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 21:35 [PATCH 4/6] ARM: OMAP4: PMU: Add runtime PM support Jon Hunter
2012-05-10 6:21 ` Shilimkar, Santosh
2012-05-15 4:53 ` Ming Lei
2012-05-15 14:39 ` Jon Hunter
[not found] ` <CACVXFVNqWM7G8dK2AA90JPvE6e_L0_Zwk-BJTjThY+nZ6ONnQA@mail.gmail.com>
2012-05-16 8:17 ` Ming Lei
2012-05-17 5:28 ` Ming Lei
2012-05-29 21:17 ` Kevin Hilman
2012-05-29 22:07 ` Jon Hunter
2012-05-29 22:27 ` Jon Hunter
2012-05-30 21:50 ` Kevin Hilman
2012-05-31 1:29 ` Will Deacon
2012-05-31 15:05 ` Jon Hunter
2012-05-31 18:49 ` Jon Hunter
2012-05-31 18:11 ` Jon Hunter
2012-05-31 20:42 ` Kevin Hilman
2012-05-31 21:23 ` Jon Hunter
2012-05-31 22:36 ` Kevin Hilman
2012-05-31 23:02 ` Jon Hunter
2012-06-01 0:27 ` Kevin Hilman
2012-06-01 14:42 ` Jon Hunter
2012-06-02 16:42 ` Will Deacon
2012-06-04 21:44 ` Jon Hunter
2012-06-05 13:19 ` Jon Hunter [this message]
2012-06-06 17:33 ` Will Deacon
2012-06-07 1:24 ` Jon Hunter
2012-05-31 15:04 ` Jon Hunter
2012-05-31 16:22 ` Kevin Hilman
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=4FCE0746.2090505@ti.com \
--to=jon-hunter@ti.com \
--cc=b-cousson@ti.com \
--cc=khilman@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=paul@pwsan.com \
--cc=will.deacon@arm.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 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.