From patchwork Fri Jan 4 16:59:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13804 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 A17DF23EC8 for ; Fri, 4 Jan 2013 17:00:06 +0000 (UTC) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by fiordland.canonical.com (Postfix) with ESMTP id 3B46DA197DE for ; Fri, 4 Jan 2013 17:00:06 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id f13so16730541vcb.18 for ; Fri, 04 Jan 2013 09:00:05 -0800 (PST) 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 :x-gm-message-state; bh=1Y8JojrctRvgGa531zOIElhkKMm2d9MEoyfkTi0JQWU=; b=Yg7x/GCka1ujTna6zSC1+bNsqD2cuE4Q7hvK6IBvU5hq3jGTxU1h+Y5g6YPf2B1OIn Bd8UYBhsc4VzcSgs35MaI48U8e6SQmqOavXJBbWYsZ+3+pyxhTNpaNhA0ZSYiXBNJvz2 tZoxLOdDBbS8mNQx3NrZ+5L/PU2tuhj7sHDinZhpZ1SssVlSQCIzgxEK7dBr6pVfk1ei HnjrNjsXvYmMWPQ7VUQxYrs75RiPOTvlBDBWcUKnQTwA1i3xu5AmWKcjHUgmNL0l2BAc MnZJv318ztrXMUdjMUAlT+w0qn0S7aIkpqWtvIDnLxZBVtGL3f3+3AMooBvD+78UUzMk jXOQ== X-Received: by 10.52.88.168 with SMTP id bh8mr65798976vdb.51.1357318805740; Fri, 04 Jan 2013 09:00:05 -0800 (PST) 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.58.145.101 with SMTP id st5csp146419veb; Fri, 4 Jan 2013 09:00:04 -0800 (PST) X-Received: by 10.194.174.196 with SMTP id bu4mr84597550wjc.35.1357318803408; Fri, 04 Jan 2013 09:00:03 -0800 (PST) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by mx.google.com with ESMTPS id lc9si18574356wjb.13.2013.01.04.09.00.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 09:00:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.180 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=209.85.212.180; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.180 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-wi0-f180.google.com with SMTP id hj13so34905wib.7 for ; Fri, 04 Jan 2013 09:00:02 -0800 (PST) X-Received: by 10.180.90.106 with SMTP id bv10mr81442457wib.12.1357318802644; Fri, 04 Jan 2013 09:00:02 -0800 (PST) Received: from mai.home (AToulouse-654-1-322-234.w86-199.abo.wanadoo.fr. [86.199.209.234]) by mx.google.com with ESMTPS id t17sm91133761wiv.6.2013.01.04.09.00.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 09:00:01 -0800 (PST) From: Daniel Lezcano To: kgene.kim@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, patches@linaro.org, linaro-dev@lists.linaro.org Subject: [PATCH 1/5] ARM: exynos: factor out the idle states Date: Fri, 4 Jan 2013 17:59:55 +0100 Message-Id: <1357318799-24378-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlPkh0UAPbqJ8x9jHJesRt+LEJAq2zObMnZD5CvmJs/MiuMnbO5NvsfeXf3s7NOnkB4JrYr The states are defined in the driver. We can get rid of the intermediate cpuidle states initialization and the memcpy by directly initializing the driver states. Signed-off-by: Daniel Lezcano --- arch/arm/mach-exynos/cpuidle.c | 45 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 0509241..f8dd1cd 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -40,24 +40,25 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index); -static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { - [0] = ARM_CPUIDLE_WFI_STATE, - [1] = { - .enter = exynos4_enter_lowpower, - .exit_latency = 300, - .target_residency = 100000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "C1", - .desc = "ARM power down", - }, -}; - static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); static struct cpuidle_driver exynos4_idle_driver = { .name = "exynos4_idle", .owner = THIS_MODULE, .en_core_tk_irqen = 1, + .states = { + [0] = ARM_CPUIDLE_WFI_STATE, + [1] = { + .enter = exynos4_enter_lowpower, + .exit_latency = 300, + .target_residency = 100000, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "C1", + .desc = "ARM power down", + }, + }, + .state_count = 2, + .safe_state_index = 0, }; /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ @@ -192,33 +193,21 @@ static void __init exynos5_core_down_clk(void) static int __init exynos4_init_cpuidle(void) { - int i, max_cpuidle_state, cpu_id; + int cpu_id; struct cpuidle_device *device; - struct cpuidle_driver *drv = &exynos4_idle_driver; if (soc_is_exynos5250()) exynos5_core_down_clk(); - /* Setup cpuidle driver */ - drv->state_count = (sizeof(exynos4_cpuidle_set) / - sizeof(struct cpuidle_state)); - max_cpuidle_state = drv->state_count; - for (i = 0; i < max_cpuidle_state; i++) { - memcpy(&drv->states[i], &exynos4_cpuidle_set[i], - sizeof(struct cpuidle_state)); - } - drv->safe_state_index = 0; cpuidle_register_driver(&exynos4_idle_driver); for_each_cpu(cpu_id, cpu_online_mask) { device = &per_cpu(exynos4_cpuidle_device, cpu_id); device->cpu = cpu_id; - if (cpu_id == 0) - device->state_count = (sizeof(exynos4_cpuidle_set) / - sizeof(struct cpuidle_state)); - else - device->state_count = 1; /* Support IDLE only */ + /* Support IDLE only */ + if (cpu_id != 0) + device->state_count = 1; if (cpuidle_register_device(device)) { printk(KERN_ERR "CPUidle register device failed\n,");