From patchwork Fri Mar 29 10:31:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2365051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 2DF0B3FD40 for ; Fri, 29 Mar 2013 10:35:14 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULWbr-0004BD-Bd; Fri, 29 Mar 2013 10:32:35 +0000 Received: from mail-wg0-f48.google.com ([74.125.82.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULWb7-000418-GH for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2013 10:31:51 +0000 Received: by mail-wg0-f48.google.com with SMTP id m15so299766wgh.3 for ; Fri, 29 Mar 2013 03:31:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=j91jMDFJYC0QoKUIID04oo2rFKG7Oz4j0s/UkG8NeLA=; b=aSTRfEa4vroWKWvMNEjc1hC+Nw/Dk7aJkFRlzNEfxJs6s4Gs7Uj1564QdOdipcfuYh QermfsS/RFtwXObPyttW6SRu88JIT0hLEJpzVq8BVGtvAmMz8a9b6h34ESWNEt5NDko9 65O3ij0gCUBUtl6gFVCSORxFs5lgZGBKr7YeVq8Qdm5ou+d6ES9dKrxD4aLkiBXGwdEY LzEUcgRoW/WEl1QiA9uE6e4+l/7HO02bEqGUMGOY4h56pdfTAHbkUBiWDiSEMqwCmvsk 0+t8SlpYe6nBZ/8jY4et2SaRjnnVR9zCRAdTRIPtPF4jo7dRiObYFCdsnqxlkaQTeyu6 zXIw== X-Received: by 10.180.79.6 with SMTP id f6mr21330153wix.26.1364553107428; Fri, 29 Mar 2013 03:31:47 -0700 (PDT) Received: from mai.home (AToulouse-654-1-486-7.w92-146.abo.wanadoo.fr. [92.146.77.7]) by mx.google.com with ESMTPS id q13sm2472076wie.0.2013.03.29.03.31.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 03:31:46 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Subject: [PATCH 5/9] ARM: tegra2: cpuidle: change driver initialization Date: Fri, 29 Mar 2013 11:31:31 +0100 Message-Id: <1364553095-25110-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> References: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQnyH7Kv0GiQqKGsne1CJYDp77JsII2FNiYBYu6dP4Cpjek9gJTS5X/ND6COiR2ZCrazIG5K X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130329_063149_712819_6D4606C3 X-CRM114-Status: GOOD ( 12.16 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.48 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org, linux@arm.linux.org.uk, arnd@arndb.de, swarren@wwwdotorg.org, patches@linaro.org, linux-pm@vger.kernel.org, rnayak@ti.com, nsekhar@ti.com, santosh.shilimkar@ti.com, linux-tegra@vger.kernel.org, horms+renesas@verge.net.au, linux-arm-kernel@lists.infradead.org, lenb@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Reviewed-by: Joseph Lo Acked-by: Joseph Lo Acked-by: Stephen Warren --- 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");