From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH 8/9] ARM: OMAP3: cpuidle - use omap3_idle_data directly
Date: Fri, 23 Mar 2012 10:26:33 +0100 [thread overview]
Message-ID: <1332494794-7810-8-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1332494794-7810-1-git-send-email-daniel.lezcano@linaro.org>
We are storing the 'omap3_idle_data' in the private data field
if the cpuidle device. As we are using this variable only in this file,
that does not really make sense. Let's use the global variable directly
instead dereferencing pointers in an idle critical loop.
As the table is initialized statically, let's remove the initialization at
startup too.
Also, that simplfies the code.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
arch/arm/mach-omap2/cpuidle34xx.c | 60 ++++---------------------------------
1 files changed, 6 insertions(+), 54 deletions(-)
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 34e1e34..726f0bf 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -106,8 +106,7 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
- struct omap3_idle_statedata *cx =
- cpuidle_get_statedata(&dev->states_usage[index]);
+ struct omap3_idle_statedata *cx = &omap3_idle_data[index];
struct timespec ts_preidle, ts_postidle, ts_idle;
u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
int idle_time;
@@ -208,7 +207,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
* Prevent PER off if CORE is not in retention or off as this
* would disable PER wakeups completely.
*/
- cx = cpuidle_get_statedata(&dev->states_usage[index]);
+ cx = &omap3_idle_data[index];
core_next_state = cx->core_state;
per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
if ((per_next_state == PWRDM_POWER_OFF) &&
@@ -295,19 +294,6 @@ struct cpuidle_driver omap3_idle_driver = {
.state_count = OMAP3_NUM_STATES,
};
-/* Helper to register the driver_data */
-static inline struct omap3_idle_statedata *_fill_cstate_usage(
- struct cpuidle_device *dev,
- int idx)
-{
- struct omap3_idle_statedata *cx = &omap3_idle_data[idx];
- struct cpuidle_state_usage *state_usage = &dev->states_usage[idx];
-
- cpuidle_set_statedata(state_usage, cx);
-
- return cx;
-}
-
/**
* omap3_idle_init - Init routine for OMAP3 idle
*
@@ -318,48 +304,12 @@ int __init omap3_idle_init(void)
{
struct cpuidle_device *dev;
struct cpuidle_driver *drv = &omap3_idle_driver;
- struct omap3_idle_statedata *cx;
mpu_pd = pwrdm_lookup("mpu_pwrdm");
core_pd = pwrdm_lookup("core_pwrdm");
per_pd = pwrdm_lookup("per_pwrdm");
cam_pd = pwrdm_lookup("cam_pwrdm");
-
- dev = &per_cpu(omap3_idle_dev, smp_processor_id());
-
- /* C1 . MPU WFI + Core active */
- cx = _fill_cstate_usage(dev, 0);
- cx->mpu_state = PWRDM_POWER_ON;
- cx->core_state = PWRDM_POWER_ON;
-
- /* C2 . MPU WFI + Core inactive */
- cx = _fill_cstate_usage(dev, 1);
- cx->mpu_state = PWRDM_POWER_ON;
- cx->core_state = PWRDM_POWER_ON;
-
- /* C3 . MPU CSWR + Core inactive */
- cx = _fill_cstate_usage(dev, 2);
- cx->mpu_state = PWRDM_POWER_RET;
- cx->core_state = PWRDM_POWER_ON;
-
- /* C4 . MPU OFF + Core inactive */
- cx = _fill_cstate_usage(dev, 3);
- cx->mpu_state = PWRDM_POWER_OFF;
- cx->core_state = PWRDM_POWER_ON;
-
- /* C5 . MPU RET + Core RET */
- cx = _fill_cstate_usage(dev, 4);
- cx->mpu_state = PWRDM_POWER_RET;
- cx->core_state = PWRDM_POWER_RET;
-
- /* C6 . MPU OFF + Core RET */
- cx = _fill_cstate_usage(dev, 5);
- cx->mpu_state = PWRDM_POWER_OFF;
- cx->core_state = PWRDM_POWER_RET;
-
- /* C7 . MPU OFF + Core OFF */
- cx = _fill_cstate_usage(dev, 6);
/*
* Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
* enable OFF mode in a stable form for previous revisions.
@@ -370,11 +320,13 @@ int __init omap3_idle_init(void)
pr_warn("%s: core off state C7 disabled due to i583\n",
__func__);
}
- cx->mpu_state = PWRDM_POWER_OFF;
- cx->core_state = PWRDM_POWER_OFF;
cpuidle_register_driver(&omap3_idle_driver);
+ dev = &per_cpu(omap3_idle_dev, smp_processor_id());
+ dev->cpu = 0;
+ dev->state_count = drv->state_count;
+
if (cpuidle_register_device(dev)) {
printk(KERN_ERR "%s: CPUidle register device failed\n",
__func__);
--
1.7.5.4
next prev parent reply other threads:[~2012-03-23 9:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 9:26 [RFC][PATCH 1/9] ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table Daniel Lezcano
2012-03-23 9:26 ` [RFC][PATCH 2/9] ARM: OMAP3: cpuidle - remove next_valid_state function Daniel Lezcano
2012-03-23 12:21 ` Jean Pihet
2012-03-23 9:26 ` [RFC][PATCH 3/9] ARM: OMAP3: cpuidle - set enable_off_mode as static Daniel Lezcano
2012-03-23 12:22 ` Jean Pihet
2012-03-23 12:38 ` Daniel Lezcano
2012-03-23 9:26 ` [RFC][PATCH 4/9] ARM: OMAP3: define cpuidle statically Daniel Lezcano
2012-03-23 12:35 ` Jean Pihet
2012-03-23 12:41 ` Daniel Lezcano
2012-03-23 13:17 ` Jean Pihet
2012-03-23 9:26 ` [RFC][PATCH 5/9] ARM: OMAP3: cpuidle - remove the 'valid' field Daniel Lezcano
2012-03-23 9:26 ` [RFC][PATCH 6/9] ARM: OMAP3: cpuidle - remove cpuidle_params_table Daniel Lezcano
2012-03-23 9:26 ` [RFC][PATCH 7/9] ARM: OMAP3: define statically the omap3_idle_data Daniel Lezcano
2012-03-23 9:26 ` Daniel Lezcano [this message]
2012-03-23 9:26 ` [RFC][PATCH 9/9] ARM: OMAP3/4: consolidate cpuidle Makefile 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=1332494794-7810-8-git-send-email-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).