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: 1933951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 04137DFABD for ; Fri, 4 Jan 2013 17:03:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TrAd7-0006Dm-2R; Fri, 04 Jan 2013 17:00:25 +0000 Received: from mail-we0-f172.google.com ([74.125.82.172]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TrAco-000696-Eq for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2013 17:00:07 +0000 Received: by mail-we0-f172.google.com with SMTP id r3so8003277wey.3 for ; Fri, 04 Jan 2013 09:00:02 -0800 (PST) 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 :x-gm-message-state; bh=1Y8JojrctRvgGa531zOIElhkKMm2d9MEoyfkTi0JQWU=; b=R8NRafr/DmhiioX2v0ZbIpcTxS+g7aWYkxsoJSL0ENBG/8YxYVZFPf17raHLmGAvCh r85hv4nT95JROoe7RfKG6LFmbnEW0W0etmm7io9aaqq4sIB7ELzFNSlM5UHOWTtDaqar 5Tk7ck0tyah7/EXOoLK62zbwGNvU8EQJcycjPqeaNbALVZl6Ji9KGH7++GabAG7WOVrp gR+eVrchJhM7FCIwGzsa8RmDCQK8pMxQbMoBZQW+szr2IobrZpnJUHswv7V27ao5BpEt zr4U2ttRhGvgbfDKrOpbGiu0VkOQtD4w5w9QlE1vYo01KQAKESNl0805z/eRww5pXII3 ugsA== 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 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: ALoCoQl/JFcqXpMXP+Tj1dkptmLEgAaKA9DEmEYe6vRDI1JJ6mSNGLl8zHVzg/DeaHvAuHmBc8i/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130104_120006_658472_3119114F X-CRM114-Status: GOOD ( 16.98 ) 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.172 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-samsung-soc@vger.kernel.org, linaro-dev@lists.linaro.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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,");