linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: rjw@sisk.pl
Cc: linux-pm@vger.kernel.org, patches@linaro.org,
	linaro-kernel@lists.linaro.org,
	linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
	rnayak@ti.com, swarren@wwwdotorg.org,
	linux-tegra@vger.kernel.org, horms+renesas@verge.net.au,
	santosh.shilimkar@ti.com, arnd@arndb.de, lenb@kernel.org,
	nsekhar@ti.com
Subject: [PATCH 5/9] ARM: tegra2: cpuidle: change driver initialization
Date: Fri, 29 Mar 2013 11:31:31 +0100	[thread overview]
Message-ID: <1364553095-25110-5-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org>

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(-)

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");
-- 
1.7.9.5


  parent reply	other threads:[~2013-03-29 10:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 10:31 [PATCH 1/9] ARM: cpuidle: remove useless declaration Daniel Lezcano
2013-03-29 10:31 ` [PATCH 2/9] ARM: shmobile: pm: fix init sections Daniel Lezcano
2013-03-29 10:31 ` [PATCH 3/9] ARM: shmobile: cpuidle: remove useless WFI function Daniel Lezcano
2013-03-29 10:31 ` Daniel Lezcano [this message]
2013-03-29 16:02   ` [PATCH 5/9] ARM: tegra2: cpuidle: change driver initialization Stephen Warren
2013-04-03 11:18     ` Daniel Lezcano
     [not found]       ` <515C101F.1020801-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-04-03 11:23         ` Joseph Lo
     [not found]           ` <1364988239.16957.78.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
2013-04-03 12:09             ` Daniel Lezcano
     [not found]   ` <1364553095-25110-5-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-30  2:22     ` Joseph Lo
2013-04-03 16:51       ` Stephen Warren
     [not found] ` <1364553095-25110-1-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-29 10:31   ` [PATCH 4/9] ARM: OMAP4: cpuidle: fix wrong " Daniel Lezcano
     [not found]     ` <1364553095-25110-4-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-29 10:38       ` Santosh Shilimkar
     [not found]         ` <51556F1D.5030208-l0cyMroinI0@public.gmane.org>
2013-03-29 10:45           ` Daniel Lezcano
     [not found]             ` <515570DF.5010608-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-29 10:53               ` Santosh Shilimkar
     [not found]                 ` <515572C7.1030309-l0cyMroinI0@public.gmane.org>
2013-03-29 11:23                   ` Daniel Lezcano
     [not found]                     ` <515579C6.1090602-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-29 11:31                       ` Santosh Shilimkar
2013-03-29 11:56               ` Amit Kucheria
2013-03-29 12:20                 ` Santosh Shilimkar
2013-03-29 12:50                   ` Amit Kucheria
     [not found]                     ` <CAP245DWAAgQ4co34mdkFgepC5kP9v0n6B954ej2X_y20LE9kSQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-29 15:10                       ` Santosh Shilimkar
2013-03-29 15:50                         ` How to facilitate the cpuidle drivers to go to the same direction (Was: Re: [PATCH 4/9] ARM: OMAP4: cpuidle: fix wrong driver initialization) Daniel Lezcano
2013-03-31 11:14                           ` Rafael J. Wysocki
     [not found]                           ` <5155B85F.6030808-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-04-01  6:05                             ` Deepthi Dharwar
     [not found]                               ` <515923C7.8040408-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2013-04-01  8:26                                 ` Daniel Lezcano
2013-04-01  8:29                                 ` Benjamin Herrenschmidt
2013-04-02 18:37                                   ` Olof Johansson
2013-03-29 10:31   ` [PATCH 6/9] ARM: tegra: cpuidle: remove useless initialization Daniel Lezcano
2013-03-29 10:31   ` [PATCH 7/9] ARM: davinci: cpuidle: fix wrong enter function Daniel Lezcano
     [not found]     ` <1364553095-25110-7-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-29 11:36       ` Santosh Shilimkar
2013-03-29 10:31   ` [PATCH 8/9] intel: cpuidle: remove stop/start critical timings Daniel Lezcano
2013-03-29 10:31   ` [PATCH 9/9] ARM: omap3: cpuidle: enable time keeping Daniel Lezcano
2013-03-29 11:35     ` Santosh Shilimkar
2013-03-29 11:40   ` [PATCH 1/9] ARM: cpuidle: remove useless declaration Santosh Shilimkar
     [not found]     ` <51557DC6.5060104-l0cyMroinI0@public.gmane.org>
2013-03-29 11:53       ` 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=1364553095-25110-5-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=arnd@arndb.de \
    --cc=horms+renesas@verge.net.au \
    --cc=lenb@kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nsekhar@ti.com \
    --cc=patches@linaro.org \
    --cc=rjw@sisk.pl \
    --cc=rnayak@ti.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=swarren@wwwdotorg.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).