[5/9] ARM: tegra2: cpuidle: change driver initialization

Message ID 1364553095-25110-5-git-send-email-daniel.lezcano@linaro.org
State Superseded
Headers show

Commit Message

Daniel Lezcano March 29, 2013, 10:31 a.m.
Initialize the idle states directly in the driver structure.

That prevents extra structure declaration and memcpy at init time.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/mach-tegra/cpuidle-tegra20.c |   40 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

Comments

Stephen Warren March 29, 2013, 4:02 p.m. | #1
On 03/29/2013 04:31 AM, Daniel Lezcano wrote:
> Initialize the idle states directly in the driver structure.
> 
> That prevents extra structure declaration and memcpy at init time.

Joseph, can you please review/ack patch 5/9 and patch 6/9. Thanks.
Joseph Lo March 30, 2013, 2:22 a.m. | #2
On Fri, 2013-03-29 at 18:31 +0800, Daniel Lezcano wrote:
> Initialize the idle states directly in the driver structure.
> 
> That prevents extra structure declaration and memcpy at init time.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Daniel,

Thank you.

Both the 5th and 6th patch,

Reviewed-by: Joseph Lo <josephl@nvidia.com>
Daniel Lezcano April 3, 2013, 11:18 a.m. | #3
On 03/29/2013 05:02 PM, Stephen Warren wrote:
> On 03/29/2013 04:31 AM, Daniel Lezcano wrote:
>> Initialize the idle states directly in the driver structure.
>>
>> That prevents extra structure declaration and memcpy at init time.
> 
> Joseph, can you please review/ack patch 5/9 and patch 6/9. Thanks.

Thanks Joseph to review the patches.

Rafael is expecting an Acked-by.

If you are ok, with these patches, is it possible to ack them please ?

Thanks
  -- Daniel
Joseph Lo April 3, 2013, 11:23 a.m. | #4
On Wed, 2013-04-03 at 19:18 +0800, Daniel Lezcano wrote:
> On 03/29/2013 05:02 PM, Stephen Warren wrote:
> > On 03/29/2013 04:31 AM, Daniel Lezcano wrote:
> >> Initialize the idle states directly in the driver structure.
> >>
> >> That prevents extra structure declaration and memcpy at init time.
> > 
> > Joseph, can you please review/ack patch 5/9 and patch 6/9. Thanks.
> 
> Thanks Joseph to review the patches.
> 
> Rafael is expecting an Acked-by.
> 
> If you are ok, with these patches, is it possible to ack them please ?
> 
OK.

The 5/9 and 6/9 of this series.
Acked-by: Joseph Lo <josephl@nvidia.com>

Thanks,
Joseph
> 
>
Daniel Lezcano April 3, 2013, 12:09 p.m. | #5
On 04/03/2013 01:23 PM, Joseph Lo wrote:
> On Wed, 2013-04-03 at 19:18 +0800, Daniel Lezcano wrote:
>> On 03/29/2013 05:02 PM, Stephen Warren wrote:
>>> On 03/29/2013 04:31 AM, Daniel Lezcano wrote:
>>>> Initialize the idle states directly in the driver structure.
>>>>
>>>> That prevents extra structure declaration and memcpy at init time.
>>>
>>> Joseph, can you please review/ack patch 5/9 and patch 6/9. Thanks.
>>
>> Thanks Joseph to review the patches.
>>
>> Rafael is expecting an Acked-by.
>>
>> If you are ok, with these patches, is it possible to ack them please ?
>>
> OK.
> 
> The 5/9 and 6/9 of this series.
> Acked-by: Joseph Lo <josephl@nvidia.com>

Thanks Joseph.
Stephen Warren April 3, 2013, 4:51 p.m. | #6
On 03/29/2013 08:22 PM, Joseph Lo wrote:
> On Fri, 2013-03-29 at 18:31 +0800, Daniel Lezcano wrote:
>> Initialize the idle states directly in the driver structure.
>>
>> That prevents extra structure declaration and memcpy at init time.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> Hi Daniel,
> 
> Thank you.
> 
> Both the 5th and 6th patch,
> 
> Reviewed-by: Joseph Lo <josephl@nvidia.com>

Thanks. Those same two patches therefore,

Acked-by: Stephen Warren <swarren@nvidia.com>

Patch

diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index 825ced4..1ad1a67 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -43,28 +43,32 @@  static atomic_t abort_barrier;
 static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
 				    struct cpuidle_driver *drv,
 				    int index);
+#define TEGRA20_MAX_STATES 2
+#else
+#define TEGRA20_MAX_STATES 1
 #endif
 
-static struct cpuidle_state tegra_idle_states[] = {
-	[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
-#ifdef CONFIG_PM_SLEEP
-	[1] = {
-		.enter			= tegra20_idle_lp2_coupled,
-		.exit_latency		= 5000,
-		.target_residency	= 10000,
-		.power_usage		= 0,
-		.flags			= CPUIDLE_FLAG_TIME_VALID |
-					  CPUIDLE_FLAG_COUPLED,
-		.name			= "powered-down",
-		.desc			= "CPU power gated",
-	},
-#endif
-};
-
 static struct cpuidle_driver tegra_idle_driver = {
 	.name = "tegra_idle",
 	.owner = THIS_MODULE,
 	.en_core_tk_irqen = 1,
+	.states = {
+		ARM_CPUIDLE_WFI_STATE_PWR(600),
+#ifdef CONFIG_PM_SLEEP
+		{
+			.enter            = tegra20_idle_lp2_coupled,
+			.exit_latency     = 5000,
+			.target_residency = 10000,
+			.power_usage      = 0,
+			.flags            = CPUIDLE_FLAG_TIME_VALID |
+			CPUIDLE_FLAG_COUPLED,
+			.name             = "powered-down",
+			.desc             = "CPU power gated",
+		},
+#endif
+	},
+	.state_count = TEGRA20_MAX_STATES,
+	.safe_state_index = 0,
 };
 
 static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
@@ -226,10 +230,6 @@  int __init tegra20_cpuidle_init(void)
 	tegra_tear_down_cpu = tegra20_tear_down_cpu;
 #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);
 	if (ret) {
 		pr_err("CPUidle driver registration failed\n");