From patchwork Fri Mar 29 10:31:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 15762 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 7504D23DEE for ; Fri, 29 Mar 2013 10:31:47 +0000 (UTC) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2E1DCA18D03 for ; Fri, 29 Mar 2013 10:31:47 +0000 (UTC) Received: by mail-vc0-f180.google.com with SMTP id m17so369449vca.39 for ; Fri, 29 Mar 2013 03:31:46 -0700 (PDT) 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 :in-reply-to:references:x-gm-message-state; bh=iSdTKqGWkKs+8C++oUkknDzm7eCR3KTcxN9JalVYkrk=; b=iXOEeBXCtgf+/z2UqFBTZsSABsM6Os3uj143VSphUOVVMxw2BeksOrE6BqydSv+9c6 Xtq5aT8yjOEPudV6SSfkah7LHMARDelw1VoCQdjAfg24OuEZlZ0IpIQGK2S28SWyh7D6 UsWiaX1EXl2qCGmndPWoA6GlWMyF47WIFzSApGlZ/SRmD4S4Q2VnTyzqhAwFf9IwZWsi CICsuxVPvM8c67l2jTxQLKAP/+YCpa2YC9jiLZLswh6ZIjT1fg9WxWgh9lYASDgF8VKr rDodVsLH1wjSYm/oJMYIHGfvHJJC+gAep0cN61Y8qtTCGnLHUP/848K1znogPK2Fa/B9 SPxg== X-Received: by 10.52.20.239 with SMTP id q15mr1176963vde.73.1364553106668; Fri, 29 Mar 2013 03:31:46 -0700 (PDT) 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.59.4.204 with SMTP id cg12csp54144ved; Fri, 29 Mar 2013 03:31:46 -0700 (PDT) X-Received: by 10.180.11.136 with SMTP id q8mr2711086wib.18.1364553105795; Fri, 29 Mar 2013 03:31:45 -0700 (PDT) Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]) by mx.google.com with ESMTPS id u4si880543wiv.107.2013.03.29.03.31.45 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 03:31:45 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::22f; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22f 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-we0-f175.google.com with SMTP id t11so264620wey.34 for ; Fri, 29 Mar 2013 03:31:45 -0700 (PDT) X-Received: by 10.180.92.97 with SMTP id cl1mr21479041wib.19.1364553105263; Fri, 29 Mar 2013 03:31:45 -0700 (PDT) Received: from mai.home (AToulouse-654-1-486-7.w92-146.abo.wanadoo.fr. [92.146.77.7]) by mx.google.com with ESMTPS id q13sm2472076wie.0.2013.03.29.03.31.43 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 03:31:44 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Cc: linux-pm@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, rnayak@ti.com, swarren@wwwdotorg.org, linux-tegra@vger.kernel.org, horms+renesas@verge.net.au, santosh.shilimkar@ti.com, arnd@arndb.de, lenb@kernel.org, nsekhar@ti.com Subject: [PATCH 4/9] ARM: OMAP4: cpuidle: fix wrong driver initialization Date: Fri, 29 Mar 2013 11:31:30 +0100 Message-Id: <1364553095-25110-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> References: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQn/25gpKjVpDTuGr7/iLwjamZA+I2Olqh6PcOrvKPqa4GknSEvlCBKG5Do0Bj/gT0rW0c6W The driver is initialized several times. This is wrong and if the return code of the function was checked, it will return -EINVAL. Move this initialization out of the loop. Signed-off-by: Daniel Lezcano --- arch/arm/mach-omap2/cpuidle44xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index f4b1b23..3d33b8a 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c @@ -210,6 +210,7 @@ int __init omap4_idle_init(void) { struct cpuidle_device *dev; unsigned int cpu_id = 0; + int ret; mpu_pd = pwrdm_lookup("mpu_pwrdm"); cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm"); @@ -222,14 +223,18 @@ int __init omap4_idle_init(void) if (!cpu_clkdm[0] || !cpu_clkdm[1]) return -ENODEV; + ret = cpuidle_register_driver(&omap4_idle_driver); + if (ret) { + printk(KERN_ERR "failed to register the idle driver\n"); + return ret; + } + for_each_cpu(cpu_id, cpu_online_mask) { dev = &per_cpu(omap4_idle_dev, cpu_id); dev->cpu = cpu_id; #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED dev->coupled_cpus = *cpu_online_mask; #endif - cpuidle_register_driver(&omap4_idle_driver); - if (cpuidle_register_device(dev)) { pr_err("%s: CPUidle register failed\n", __func__); return -EIO;