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: 16067 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 754FA238FF for ; Thu, 11 Apr 2013 20:44:10 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id p43sf2271421wea.4 for ; Thu, 11 Apr 2013 13:43:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=MbCluV5BmYIj+9zHKT/uXgmU5t7p4+hGszqD3pW2xbI=; b=lOnkfZgvjNHe9Kg2ipAlBBIGc1Q1Q50Q0PffDMMAky1ClgRzPzhygYFA6f61XXGc9U IYs9pKOJyLaJKk/nR6cj3vphmwWiL2dZmdSNi5wM4O6JffLaE5hD/59txW/pFKxuxIp9 J3cRj/A8XJtoc2y8eBymoX1iRtf4lTsyKXw6dVcSg5TzIyf67TD0dEMbhx0Gp4gsCS+K By9cEMEnk69wAtkoFdTN8Kpz/mpf0xEppbtQsLSfqOc2iwqYArhRv40AfwuXY537yno/ LF8YuDNSk0QCpd+m01mG2A0hNzRrH4dU2ovH/y1cXK12GtpJ8v5tPny19BiBV+80SkPj XVvA== X-Received: by 10.180.182.229 with SMTP id eh5mr8015wic.1.1365713027484; Thu, 11 Apr 2013 13:43:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.19.70 with SMTP id c6ls360615wie.32.canary; Thu, 11 Apr 2013 13:43:47 -0700 (PDT) X-Received: by 10.194.133.198 with SMTP id pe6mr13417231wjb.9.1365713026726; Thu, 11 Apr 2013 13:43:46 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id p9si1403079wiz.71.2013.04.11.13.43.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:43:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id pb11so1815118veb.20 for ; Thu, 11 Apr 2013 13:43:45 -0700 (PDT) X-Received: by 10.220.214.6 with SMTP id gy6mr6320181vcb.8.1365713025424; Thu, 11 Apr 2013 13:43:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp38048veb; Thu, 11 Apr 2013 13:43:44 -0700 (PDT) X-Received: by 10.194.157.42 with SMTP id wj10mr13421147wjb.12.1365713024529; Thu, 11 Apr 2013 13:43:44 -0700 (PDT) Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [2a00:1450:400c:c03::22b]) by mx.google.com with ESMTPS id bl4si2153577wjb.29.2013.04.11.13.43.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:43:44 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22b is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::22b; Received: by mail-we0-f171.google.com with SMTP id d46so1534033wer.2 for ; Thu, 11 Apr 2013 13:43:44 -0700 (PDT) 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 Cc: linus.walleij@linaro.org, jason@lakedaemon.net, andrew@lunn.ch, kernel@pengutronix.de, swarren@wwwdotorg.org, santosh.shilimkar@ti.com, nicolas.ferre@atmel.com, plagnioj@jcrosoft.com, linux@maxim.org.za, rob.herring@calxeda.com, nsekhar@ti.com, horms@verge.net.au, magnus.damm@gmail.com, deepthi@linux.vnet.ibm.com, lethal@linux-sh.org, jkosina@suse.cz, kgene.kim@samsung.com, khilman@deeprootsystems.com, tony@atomide.com, linux-pm@vger.kernel.org, patches@linaro.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, josephl@nvidia.com 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: ALoCoQkJP7L+7eVuxm9CRqOJ8CWDsqGTji0z4IZStSXoqwHZZR3qNdwgI2zyKaPsk29OGl8aG3iQ X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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); }