Commit 14ad7a11 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki

ARM: tegra2: cpuidle: change driver initialization

Initialize the idle states directly in the driver structure.

That prevents extra structure declaration and memcpy at init time.
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarJoseph Lo <josephl@nvidia.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 688036b5
...@@ -43,12 +43,19 @@ static atomic_t abort_barrier; ...@@ -43,12 +43,19 @@ static atomic_t abort_barrier;
static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev, static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
struct cpuidle_driver *drv, struct cpuidle_driver *drv,
int index); int index);
#define TEGRA20_MAX_STATES 2
#else
#define TEGRA20_MAX_STATES 1
#endif #endif
static struct cpuidle_state tegra_idle_states[] = { static struct cpuidle_driver tegra_idle_driver = {
[0] = ARM_CPUIDLE_WFI_STATE_PWR(600), .name = "tegra_idle",
.owner = THIS_MODULE,
.en_core_tk_irqen = 1,
.states = {
ARM_CPUIDLE_WFI_STATE_PWR(600),
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
[1] = { {
.enter = tegra20_idle_lp2_coupled, .enter = tegra20_idle_lp2_coupled,
.exit_latency = 5000, .exit_latency = 5000,
.target_residency = 10000, .target_residency = 10000,
...@@ -59,12 +66,9 @@ static struct cpuidle_state tegra_idle_states[] = { ...@@ -59,12 +66,9 @@ static struct cpuidle_state tegra_idle_states[] = {
.desc = "CPU power gated", .desc = "CPU power gated",
}, },
#endif #endif
}; },
.state_count = TEGRA20_MAX_STATES,
static struct cpuidle_driver tegra_idle_driver = { .safe_state_index = 0,
.name = "tegra_idle",
.owner = THIS_MODULE,
.en_core_tk_irqen = 1,
}; };
static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device); static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
...@@ -226,10 +230,6 @@ int __init tegra20_cpuidle_init(void) ...@@ -226,10 +230,6 @@ int __init tegra20_cpuidle_init(void)
tegra_tear_down_cpu = tegra20_tear_down_cpu; tegra_tear_down_cpu = tegra20_tear_down_cpu;
#endif #endif
drv->state_count = ARRAY_SIZE(tegra_idle_states);
memcpy(drv->states, tegra_idle_states,
drv->state_count * sizeof(drv->states[0]));
ret = cpuidle_register_driver(&tegra_idle_driver); ret = cpuidle_register_driver(&tegra_idle_driver);
if (ret) { if (ret) {
pr_err("CPUidle driver registration failed\n"); pr_err("CPUidle driver registration failed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment