From patchwork Thu Apr 11 20:42:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2431471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 16A16DF230 for ; Thu, 11 Apr 2013 20:52:16 +0000 (UTC) Received: from merlin.infradead.org ([205.233.59.134]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQOTC-0005sI-CT; Thu, 11 Apr 2013 20:51:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQOO2-0005N5-3I; Thu, 11 Apr 2013 20:46:26 +0000 Received: from mail-wg0-f43.google.com ([74.125.82.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQOLR-00058X-9t for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2013 20:44:01 +0000 Received: by mail-wg0-f43.google.com with SMTP id f12so2105284wgh.22 for ; Thu, 11 Apr 2013 13:43:44 -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=MbCluV5BmYIj+9zHKT/uXgmU5t7p4+hGszqD3pW2xbI=; b=KHGwGnKVxhP3wnxv6u4Nippo1sD4/LBoNs3HRVUFcb8j5DDJts8X3SAdQaLcCC0e0S 2JbizvJz+CZDdIw5TEMFxZbT9kfv/KNrMMXUxqFsA1sePmjV2OI3urQMaIwugQAk7ExA wZCn2YP3coTyz2eMihRPtKOBpgzmnLe5eUAgp1CInvBP1+hxlGVsRj3U2Y3SlPut+vcC QwC9kM0O6HZ/18qGSf8SQ5DN5v7bumtAbQO2W9jpwBUjAYt39qV7HMO55cKCcHuCv0m6 hQ2YPO6cNdXb2ZBr1ku28XPEScGjZVMD1/MBOifijP64U+9VSMSkeQNIgZpsyssAJcGz fAaw== X-Received: by 10.180.11.238 with SMTP id t14mr40389wib.3.1365713024129; Thu, 11 Apr 2013 13:43:44 -0700 (PDT) Received: from mai.home (AToulouse-654-1-501-244.w83-205.abo.wanadoo.fr. [83.205.84.244]) by mx.google.com with ESMTPS id fv2sm5794029wib.6.2013.04.11.13.43.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:43:42 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Subject: [V2 patch 19/19] ARM: imx: cpuidle: use init/exit common routine Date: Thu, 11 Apr 2013 22:42:49 +0200 Message-Id: <1365712969-7541-20-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1365712969-7541-1-git-send-email-daniel.lezcano@linaro.org> References: <1365712969-7541-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQlHLVWXKpSFuI4YUk+12ItCxaFyffDvvnlAfG1wD2K6PWeKC1nct6rm88DctfLyOyoqCNMR X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130411_164345_516126_D78F024E X-CRM114-Status: GOOD ( 14.76 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.43 listed in list.dnswl.org] 1.7 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: andrew@lunn.ch, khilman@deeprootsystems.com, linus.walleij@linaro.org, nsekhar@ti.com, josephl@nvidia.com, kgene.kim@samsung.com, patches@linaro.org, magnus.damm@gmail.com, tony@atomide.com, plagnioj@jcrosoft.com, linaro-kernel@lists.linaro.org, jason@lakedaemon.net, swarren@wwwdotorg.org, nicolas.ferre@atmel.com, rob.herring@calxeda.com, horms@verge.net.au, linux@maxim.org.za, linux-arm-kernel@lists.infradead.org, deepthi@linux.vnet.ibm.com, jkosina@suse.cz, linux-pm@vger.kernel.org, lethal@linux-sh.org, santosh.shilimkar@ti.com, kernel@pengutronix.de 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 Remove the duplicated code and use the cpuidle common code for initialization. Signed-off-by: Daniel Lezcano --- arch/arm/mach-imx/cpuidle-imx5.c | 36 +----------------------------------- arch/arm/mach-imx/cpuidle-imx6q.c | 36 +----------------------------------- 2 files changed, 2 insertions(+), 70 deletions(-) diff --git a/arch/arm/mach-imx/cpuidle-imx5.c b/arch/arm/mach-imx/cpuidle-imx5.c index 3d9f0c9..ba4565f 100644 --- a/arch/arm/mach-imx/cpuidle-imx5.c +++ b/arch/arm/mach-imx/cpuidle-imx5.c @@ -13,8 +13,6 @@ #include "hardware.h" -static DEFINE_PER_CPU(struct cpuidle_device, devices); - static int imx5_cpuidle_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { @@ -38,37 +36,5 @@ static struct cpuidle_driver imx5_cpuidle_driver = { int __init imx5_cpuidle_init(void) { - struct cpuidle_device *dev; - int cpu, ret; - - ret = cpuidle_register_driver(&imx5_cpuidle_driver); - if (ret) { - pr_err("%s: Failed to register cpuidle driver with error: %d\n", - __func__, ret); - return ret; - } - - /* initialize state data for each cpuidle_device */ - for_each_possible_cpu(cpu) { - dev = &per_cpu(devices, cpu); - dev->cpu = cpu; - - ret = cpuidle_register_device(dev); - if (ret) { - pr_err("%s: Failed to register cpu %u, error: %d\n", - __func__, cpu, ret); - goto out_unregister; - } - } - - return 0; - -out_unregister: - for_each_possible_cpu(cpu) { - dev = &per_cpu(devices, cpu); - cpuidle_unregister_device(dev); - } - - cpuidle_unregister_driver(&imx5_cpuidle_driver); - return ret; + return cpuidle_register(&imx5_cpuidle_driver, NULL); } diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c index c066b74faa..23ddfb6 100644 --- a/arch/arm/mach-imx/cpuidle-imx6q.c +++ b/arch/arm/mach-imx/cpuidle-imx6q.c @@ -14,8 +14,6 @@ #include "common.h" #include "cpuidle.h" -static DEFINE_PER_CPU(struct cpuidle_device, devices); - static atomic_t master = ATOMIC_INIT(0); static DEFINE_SPINLOCK(master_lock); @@ -67,43 +65,11 @@ static struct cpuidle_driver imx6q_cpuidle_driver = { int __init imx6q_cpuidle_init(void) { - struct cpuidle_device *dev; - int cpu, ret; - /* Need to enable SCU standby for entering WAIT modes */ imx_scu_standby_enable(); /* Set chicken bit to get a reliable WAIT mode support */ imx6q_set_chicken_bit(); - ret = cpuidle_register_driver(&imx6q_cpuidle_driver); - if (ret) { - pr_err("%s: Failed to register cpuidle driver with error: %d\n", - __func__, ret); - return ret; - } - - /* initialize state data for each cpuidle_device */ - for_each_possible_cpu(cpu) { - dev = &per_cpu(devices, cpu); - dev->cpu = cpu; - - ret = cpuidle_register_device(dev); - if (ret) { - pr_err("%s: Failed to register cpu %u, error: %d\n", - __func__, cpu, ret); - goto out_unregister; - } - } - - return 0; - -out_unregister: - for_each_possible_cpu(cpu) { - dev = &per_cpu(devices, cpu); - cpuidle_unregister_device(dev); - } - - cpuidle_unregister_driver(&imx6q_cpuidle_driver); - return ret; + return cpuidle_register(&imx6q_cpuidle_driver, NULL); }