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: 15763 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C271B23DEE for ; Fri, 29 Mar 2013 10:31:49 +0000 (UTC) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by fiordland.canonical.com (Postfix) with ESMTP id 560FEA18D08 for ; Fri, 29 Mar 2013 10:31:49 +0000 (UTC) Received: by mail-ve0-f181.google.com with SMTP id pa12so395440veb.26 for ; Fri, 29 Mar 2013 03:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=j91jMDFJYC0QoKUIID04oo2rFKG7Oz4j0s/UkG8NeLA=; b=drp604fxXcpPbZt3xm1YKaXowJYrF9JrlndjM4R3fqnlDSQHGUNVz3EXsQENyrRgdj 5SQWUHEJeTguTNk0l10K8wNC/CvtF5DUuNpy4nNcFmon5sP2R/gMsFjQ+rWblSO4bNqm cy4k6Hu4ujw8JsOMyJJTozhl+nT0unyeZ05NI9NFvpx6Np0bVomIXOYLQJ5YHP/nXDmO BmSFkul2wQX+dIXUAhxxe1J24w3XqECAb5ZUqH01Sld8UmVrgUHqiGsQgH3rInEojjpr HUiEVz6i77Mi8wJ7bINmpywtI5Yyznvg/EARphoKZTVoJOpuOE6BePpkCmUwjZEiX45R 2b6g== X-Received: by 10.58.29.101 with SMTP id j5mr1409265veh.26.1364553108799; Fri, 29 Mar 2013 03:31:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp54146ved; Fri, 29 Mar 2013 03:31:48 -0700 (PDT) X-Received: by 10.180.81.232 with SMTP id d8mr2685834wiy.25.1364553107917; Fri, 29 Mar 2013 03:31:47 -0700 (PDT) Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]) by mx.google.com with ESMTPS id e4si882344wjy.166.2013.03.29.03.31.47 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 03:31:47 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::231 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::231; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::231 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by mail-we0-f177.google.com with SMTP id o45so259734wer.22 for ; Fri, 29 Mar 2013 03:31:47 -0700 (PDT) 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 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 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: ALoCoQnBrWIUvEB4LaRb7bNM3c8k4ADVpIS+9Qvk1zTlHY2RoSD1oId1kFsqQepTWejXRwJNjbN+ 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");