From patchwork Wed Apr 10 14:22:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 16033 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A64823912 for ; Wed, 10 Apr 2013 14:23:49 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id m1sf861367ves.11 for ; Wed, 10 Apr 2013 07:23:29 -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=onNGAXfGDilnbN/5hXsKZ8BSLBdRG/r/lAJ9yyzjTkA8OCDIo3RPh8K956L7Bgi1iT +Hm0I/8Qfxwg/XRHfHeCy8n6g1NdIoif9qjHMUnsd89JkzLyhjvhE12yBVzkVsPf8ldw 6GTMbfoiiq8lbROSa7I3dxqriCU6HuqEcZXZiwjOBbWt5ZdiuoZ9PgZaJ+pXPGAJldya 5P9F/63UVvUAoPCfWdgjvuL5sbW8HNn0deu/Dab8jw5H/X+0hsXirzETKx6ZVp79kIsn hCouRxkaT6Z+9plPuRAHocYTHcFTCepydGtZo1tHoqRGuShlDKPlZvzsCc35K2rh0tDR 26Bg== X-Received: by 10.236.72.228 with SMTP id t64mr1111629yhd.17.1365603809762; Wed, 10 Apr 2013 07:23:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.72.164 with SMTP id e4ls332029qev.18.gmail; Wed, 10 Apr 2013 07:23:29 -0700 (PDT) X-Received: by 10.52.159.6 with SMTP id wy6mr1419198vdb.18.1365603809555; Wed, 10 Apr 2013 07:23:29 -0700 (PDT) Received: from mail-vb0-x22d.google.com (mail-vb0-x22d.google.com [2607:f8b0:400c:c02::22d]) by mx.google.com with ESMTPS id p12si90620vce.68.2013.04.10.07.23.29 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 07:23:29 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22d; Received: by mail-vb0-f45.google.com with SMTP id w15so404473vbf.32 for ; Wed, 10 Apr 2013 07:23:29 -0700 (PDT) X-Received: by 10.220.77.138 with SMTP id g10mr1602488vck.69.1365603809370; Wed, 10 Apr 2013 07:23:29 -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.85.136 with SMTP id h8csp107503vez; Wed, 10 Apr 2013 07:23:28 -0700 (PDT) X-Received: by 10.194.23.105 with SMTP id l9mr3915306wjf.41.1365603808168; Wed, 10 Apr 2013 07:23:28 -0700 (PDT) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by mx.google.com with ESMTPS id h8si56225wjq.58.2013.04.10.07.23.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 07:23:28 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.45 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.45; Received: by mail-wg0-f45.google.com with SMTP id l18so545881wgh.12 for ; Wed, 10 Apr 2013 07:23:27 -0700 (PDT) X-Received: by 10.180.85.103 with SMTP id g7mr27123358wiz.23.1365603803913; Wed, 10 Apr 2013 07:23:23 -0700 (PDT) Received: from mai.home (AToulouse-654-1-413-119.w82-125.abo.wanadoo.fr. [82.125.160.119]) by mx.google.com with ESMTPS id dp5sm32126938wib.1.2013.04.10.07.23.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 07:23:23 -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: [PATCH 18/18] ARM: imx: cpuidle: use init/exit common routine Date: Wed, 10 Apr 2013 16:22:23 +0200 Message-Id: <1365603743-5618-19-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1365603743-5618-1-git-send-email-daniel.lezcano@linaro.org> References: <1365603743-5618-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQlPOlxsHhWqEahkeVKmp/xDJaIgkWFFpsr1/4c6F3QdEneQx1LxxmdRVvkjFpydhhrV/pZE X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22d 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); }