From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] ARM: exynos: factor out the idle states
Date: Fri, 4 Jan 2013 17:59:55 +0100 [thread overview]
Message-ID: <1357318799-24378-1-git-send-email-daniel.lezcano@linaro.org> (raw)
The states are defined in the driver. We can get rid of the
intermediate cpuidle states initialization and the memcpy by
directly initializing the driver states.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
arch/arm/mach-exynos/cpuidle.c | 45 +++++++++++++++-------------------------
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 0509241..f8dd1cd 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -40,24 +40,25 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index);
-static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
- [0] = ARM_CPUIDLE_WFI_STATE,
- [1] = {
- .enter = exynos4_enter_lowpower,
- .exit_latency = 300,
- .target_residency = 100000,
- .flags = CPUIDLE_FLAG_TIME_VALID,
- .name = "C1",
- .desc = "ARM power down",
- },
-};
-
static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
static struct cpuidle_driver exynos4_idle_driver = {
.name = "exynos4_idle",
.owner = THIS_MODULE,
.en_core_tk_irqen = 1,
+ .states = {
+ [0] = ARM_CPUIDLE_WFI_STATE,
+ [1] = {
+ .enter = exynos4_enter_lowpower,
+ .exit_latency = 300,
+ .target_residency = 100000,
+ .flags = CPUIDLE_FLAG_TIME_VALID,
+ .name = "C1",
+ .desc = "ARM power down",
+ },
+ },
+ .state_count = 2,
+ .safe_state_index = 0,
};
/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
@@ -192,33 +193,21 @@ static void __init exynos5_core_down_clk(void)
static int __init exynos4_init_cpuidle(void)
{
- int i, max_cpuidle_state, cpu_id;
+ int cpu_id;
struct cpuidle_device *device;
- struct cpuidle_driver *drv = &exynos4_idle_driver;
if (soc_is_exynos5250())
exynos5_core_down_clk();
- /* Setup cpuidle driver */
- drv->state_count = (sizeof(exynos4_cpuidle_set) /
- sizeof(struct cpuidle_state));
- max_cpuidle_state = drv->state_count;
- for (i = 0; i < max_cpuidle_state; i++) {
- memcpy(&drv->states[i], &exynos4_cpuidle_set[i],
- sizeof(struct cpuidle_state));
- }
- drv->safe_state_index = 0;
cpuidle_register_driver(&exynos4_idle_driver);
for_each_cpu(cpu_id, cpu_online_mask) {
device = &per_cpu(exynos4_cpuidle_device, cpu_id);
device->cpu = cpu_id;
- if (cpu_id == 0)
- device->state_count = (sizeof(exynos4_cpuidle_set) /
- sizeof(struct cpuidle_state));
- else
- device->state_count = 1; /* Support IDLE only */
+ /* Support IDLE only */
+ if (cpu_id != 0)
+ device->state_count = 1;
if (cpuidle_register_device(device)) {
printk(KERN_ERR "CPUidle register device failed\n,");
--
1.7.9.5
next reply other threads:[~2013-01-04 16:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 16:59 Daniel Lezcano [this message]
2013-01-04 16:59 ` [PATCH 2/5] ARM: exynos: handle properly the return values Daniel Lezcano
2013-01-04 16:59 ` [PATCH 3/5] ARM: exynos: replace cpumask by the corresponding macro Daniel Lezcano
2013-01-04 16:59 ` [PATCH 4/5] ARM: exynos: only register cpuidle for cpu0 Daniel Lezcano
2013-01-04 16:59 ` [PATCH 5/5] ARM: exynos: enable/disable cpuidle when cpu1 is down/up Daniel Lezcano
2013-01-10 20:07 ` amit daniel kachhap
2013-01-10 21:32 ` Daniel Lezcano
2013-01-10 22:33 ` amit daniel kachhap
2013-01-15 12:56 ` Daniel Lezcano
2013-01-18 3:51 ` Kukjin Kim
2013-01-18 8:18 ` 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=1357318799-24378-1-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).