From: santosh.shilimkar@ti•com (Santosh Shilimkar)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 02/15] cpuidle: initialize the broadcast timer framework
Date: Tue, 26 Mar 2013 10:09:53 +0530 [thread overview]
Message-ID: <51512699.2050609@ti.com> (raw)
In-Reply-To: <1364234140-514-3-git-send-email-daniel.lezcano@linaro.org>
On Monday 25 March 2013 11:25 PM, Daniel Lezcano wrote:
> The commit 89878baa73f0f1c679355006bd8632e5d78f96c2 introduced
> the CPUIDLE_FLAG_TIMER_STOP flag where we specify a specific idle
> state stops the local timer.
>
> Now use this flag to check at init time if one state will need
> the broadcast timer and, in this case, setup the broadcast timer
> framework. That prevents multiple code duplication in the drivers.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro•org>
> ---
> drivers/cpuidle/driver.c | 35 +++++++++++++++++++++++++++++++++--
> include/linux/cpuidle.h | 2 ++
> 2 files changed, 35 insertions(+), 2 deletions(-)
>
Make sense. Minor comments.
> diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
> index 422c7b6..476ce0c 100644
> --- a/drivers/cpuidle/driver.c
> +++ b/drivers/cpuidle/driver.c
> @@ -11,6 +11,8 @@
> #include <linux/mutex.h>
> #include <linux/module.h>
> #include <linux/cpuidle.h>
> +#include <linux/cpumask.h>
> +#include <linux/clockchips.h>
>
> #include "cpuidle.h"
>
> @@ -19,9 +21,30 @@ DEFINE_SPINLOCK(cpuidle_driver_lock);
> static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu);
> static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu);
>
> -static void __cpuidle_driver_init(struct cpuidle_driver *drv)
> +static void cpuidle_setup_broadcast_timer(void *arg)
> {
> + int cpu = smp_processor_id();
> + clockevents_notify((long)(arg), &cpu);
> +}
> +
> +static void __cpuidle_driver_init(struct cpuidle_driver *drv, int cpu)
> +{
> + int i;
> +
Un-necessary extra line..
> drv->refcnt = 0;
> +
> + for (i = drv->state_count - 1; i >= 0 ; i--) {
> +
here as well
> + if (!(drv->states[i].flags & CPUIDLE_FLAG_TIMER_STOP))
> + continue;
> +
> + drv->bctimer = 1;
> +
ditto
> + on_each_cpu_mask(get_cpu_mask(cpu), cpuidle_setup_broadcast_timer,
> + (void *)CLOCK_EVT_NOTIFY_BROADCAST_ON, 1);
> +
ditto
> + break;
> + }
> }
>
> static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu)
> @@ -35,7 +58,7 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu)
> if (__cpuidle_get_cpu_driver(cpu))
> return -EBUSY;
>
> - __cpuidle_driver_init(drv);
> + __cpuidle_driver_init(drv, cpu);
>
> __cpuidle_set_cpu_driver(drv, cpu);
>
> @@ -49,6 +72,14 @@ static void __cpuidle_unregister_driver(struct cpuidle_driver *drv, int cpu)
>
> if (!WARN_ON(drv->refcnt > 0))
> __cpuidle_set_cpu_driver(NULL, cpu);
> +
> + if (drv->bctimer) {
> +
> + drv->bctimer = 0;
> +
> +
no need of extra line here
on_each_cpu_mask(get_cpu_mask(cpu), cpuidle_setup_broadcast_timer,
> + (void *)CLOCK_EVT_NOTIFY_BROADCAST_OFF, 1);
> + }
> }
>
> #ifdef CONFIG_CPU_IDLE_MULTIPLE_DRIVERS
> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> index a837b33..fc3e580 100644
> --- a/include/linux/cpuidle.h
> +++ b/include/linux/cpuidle.h
> @@ -107,6 +107,8 @@ struct cpuidle_driver {
>
> /* set to 1 to use the core cpuidle time keeping (for all states). */
> unsigned int en_core_tk_irqen:1;
> + /* used by the cpuidle framework to setup the broadcast timer */
> + unsigned int bctimer:1;
> /* states array must be ordered in decreasing power consumption */
> struct cpuidle_state states[CPUIDLE_STATE_MAX];
> int state_count;
>
next prev parent reply other threads:[~2013-03-26 4:39 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 17:55 [PATCH 00/15] ARM: cpuidle: code consolidation Daniel Lezcano
2013-03-25 17:55 ` [PATCH 01/15] timer: move enum definition out of ifdef section Daniel Lezcano
2013-03-26 4:36 ` Santosh Shilimkar
2013-03-26 9:55 ` Daniel Lezcano
2013-03-25 17:55 ` [PATCH 02/15] cpuidle: initialize the broadcast timer framework Daniel Lezcano
2013-03-26 4:39 ` Santosh Shilimkar [this message]
2013-03-25 17:55 ` [PATCH 03/15] cpuidle: ux500: remove timer broadcast initialization Daniel Lezcano
2013-03-27 14:46 ` Linus Walleij
2013-03-25 17:55 ` [PATCH 04/15] cpuidle: OMAP4: " Daniel Lezcano
2013-03-26 4:41 ` Santosh Shilimkar
2013-03-25 17:55 ` [PATCH 05/15] cpuidle: imx6: " Daniel Lezcano
2013-03-26 7:25 ` Shawn Guo
2013-03-26 9:43 ` Daniel Lezcano
2013-03-26 12:40 ` Shawn Guo
2013-03-26 12:53 ` Daniel Lezcano
2013-03-26 13:06 ` Rafael J. Wysocki
2013-03-26 14:28 ` Shawn Guo
2013-03-25 17:55 ` [PATCH 06/15] ARM: cpuidle: remove useless declaration Daniel Lezcano
2013-03-25 17:55 ` [PATCH 07/15] ARM: cpuidle: add init/exit routine Daniel Lezcano
2013-03-25 18:10 ` Andrew Lunn
2013-03-25 18:33 ` Daniel Lezcano
2013-03-25 19:09 ` Andrew Lunn
2013-03-25 19:20 ` Daniel Lezcano
2013-03-25 19:31 ` Amit Kucheria
2013-03-25 19:46 ` Daniel Lezcano
2013-03-25 21:42 ` Andrew Lunn
2013-03-25 22:09 ` Daniel Lezcano
2013-03-25 20:28 ` Nicolas Pitre
2013-03-25 21:53 ` Daniel Lezcano
2013-03-25 21:57 ` Nicolas Pitre
2013-03-25 17:55 ` [PATCH 08/15] ARM: ux500: cpuidle: use init/exit common routine Daniel Lezcano
2013-03-27 14:47 ` Linus Walleij
2013-03-25 17:55 ` [PATCH 09/15] ARM: at91: " Daniel Lezcano
2013-03-26 8:48 ` Nicolas Ferre
2013-03-25 17:55 ` [PATCH 10/15] ARM: OMAP3: " Daniel Lezcano
2013-03-25 17:55 ` [PATCH 11/15] ARM: s3c64xx: " Daniel Lezcano
2013-03-25 17:55 ` [PATCH 12/15] ARM: tegra1: " Daniel Lezcano
2013-03-25 17:55 ` [PATCH 13/15] ARM: shmobile: pm: fix init sections Daniel Lezcano
2013-03-27 14:09 ` Simon Horman
2013-03-25 17:55 ` [PATCH 14/15] ARM: shmobile: cpuidle: remove useless WFI function Daniel Lezcano
2013-03-27 14:09 ` Simon Horman
2013-03-25 17:55 ` [PATCH 15/15] ARM: shmobile: cpuidle: use init/exit common routine Daniel Lezcano
2013-03-27 14:10 ` Simon Horman
2013-03-25 20:27 ` [PATCH 00/15] ARM: cpuidle: code consolidation Rob Herring
2013-03-25 21:55 ` Daniel Lezcano
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=51512699.2050609@ti.com \
--to=santosh.shilimkar@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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