From patchwork Wed Apr 17 13:32:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 16169 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f197.google.com (mail-ye0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28B2A23911 for ; Wed, 17 Apr 2013 13:33:52 +0000 (UTC) Received: by mail-ye0-f197.google.com with SMTP id q1sf2233371yen.4 for ; Wed, 17 Apr 2013 06:33:17 -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=mNj/IUx4iVIP8Ucbpd8WSlUDGYhgd7fue8JtAk4K2lk=; b=LI8f+eBoschpmDF/7WZnQhk9PFSPs8vDysedOoJD3WTbpaCIqeTOaorBAGc4K6oxRc 9U+7agL66n1cVLBXEYJCbvt2bOh3PQjn8Y6WZMXOp0YE8NHCHMmJd6hbed+RczHje3D6 zyO6h2gcmjHbg7kCBib1maPw1tyevdAN8/kjFsVVtpSLMx1QOQKXb8dDg6lFJ9C2QjFe mJ0IgRo8tBodOJEcd6VlmU1CXn0r8dHMfNS8bAWL+0aTzatfh7mvVudzomiJ8B31ZLAV SBCyc0iOELRT4PlKusE2sXe5OTdR7BYsmvMGd7VVnY156Qz0eheu+U8A8JWsyuZagdGb h0dQ== X-Received: by 10.236.15.164 with SMTP id f24mr3198628yhf.50.1366205597072; Wed, 17 Apr 2013 06:33:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.28.101 with SMTP id a5ls853646qeh.19.gmail; Wed, 17 Apr 2013 06:33:17 -0700 (PDT) X-Received: by 10.220.175.3 with SMTP id v3mr4846697vcz.8.1366205596963; Wed, 17 Apr 2013 06:33:16 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id ec8si3895964vdb.124.2013.04.17.06.33.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:33:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hx10so1332538vcb.28 for ; Wed, 17 Apr 2013 06:33:16 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr4930179vcb.14.1366205596834; Wed, 17 Apr 2013 06:33:16 -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 nf2csp73797veb; Wed, 17 Apr 2013 06:33:15 -0700 (PDT) X-Received: by 10.194.220.37 with SMTP id pt5mr11493034wjc.16.1366205594772; Wed, 17 Apr 2013 06:33:14 -0700 (PDT) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by mx.google.com with ESMTPS id k15si774307wjq.192.2013.04.17.06.33.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:33:14 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.51 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.51; Received: by mail-wg0-f51.google.com with SMTP id b13so1612142wgh.30 for ; Wed, 17 Apr 2013 06:33:14 -0700 (PDT) X-Received: by 10.180.87.97 with SMTP id w1mr11125759wiz.2.1366205594378; Wed, 17 Apr 2013 06:33:14 -0700 (PDT) Received: from mai.home (AToulouse-654-1-349-85.w90-55.abo.wanadoo.fr. [90.55.188.85]) by mx.google.com with ESMTPS id ej8sm25556799wib.9.2013.04.17.06.33.09 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:33:11 -0700 (PDT) From: Daniel Lezcano To: lethal@linux-sh.org, rjw@sisk.pl Cc: linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, patches@linaro.org Subject: [PATCH 4/4] SH: cpuidle: check error code at init Date: Wed, 17 Apr 2013 15:32:57 +0200 Message-Id: <1366205577-11632-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366205577-11632-1-git-send-email-daniel.lezcano@linaro.org> References: <1366205577-11632-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQmRfyID2YmlcTk/z0YxKtFbpqlL21jEcqVnMDYrKm4+BiqlGwKD6gByUeN1y7BFGQH7Jteg X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 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: , Registering the driver, or the device, can fail, let's check the return code and return the error code to the PM layer. Signed-off-by: Daniel Lezcano --- arch/sh/include/asm/suspend.h | 4 ++-- arch/sh/kernel/cpu/shmobile/cpuidle.c | 11 ++++++++--- arch/sh/kernel/cpu/shmobile/pm.c | 3 +-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h index e14567a..70ae0b2 100644 --- a/arch/sh/include/asm/suspend.h +++ b/arch/sh/include/asm/suspend.h @@ -14,9 +14,9 @@ struct swsusp_arch_regs { void sh_mobile_call_standby(unsigned long mode); #ifdef CONFIG_CPU_IDLE -void sh_mobile_setup_cpuidle(void); +int sh_mobile_setup_cpuidle(void); #else -static inline void sh_mobile_setup_cpuidle(void) {} +static inline int sh_mobile_setup_cpuidle(void) { return 0; } #endif /* notifier chains for pre/post sleep hooks */ diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c index f024acf..fdfe57f4 100644 --- a/arch/sh/kernel/cpu/shmobile/cpuidle.c +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c @@ -90,14 +90,19 @@ static struct cpuidle_driver cpuidle_driver = { .state_count = 3, }; -void sh_mobile_setup_cpuidle(void) +int __init sh_mobile_setup_cpuidle(void) { + int ret; + if (sh_mobile_sleep_supported & SUSP_SH_SF) cpuidle_driver.states[1].disabled = false; if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) cpuidle_driver.states[2].disabled = false; - if (!cpuidle_register_driver(&cpuidle_driver)) - cpuidle_register_device(&cpuidle_dev); + ret = cpuidle_register_driver(&cpuidle_driver); + if (ret) + return ret; + + return cpuidle_register_device(&cpuidle_dev); } diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c index 08d27fa..ac37b72 100644 --- a/arch/sh/kernel/cpu/shmobile/pm.c +++ b/arch/sh/kernel/cpu/shmobile/pm.c @@ -150,8 +150,7 @@ static const struct platform_suspend_ops sh_pm_ops = { static int __init sh_pm_init(void) { suspend_set_ops(&sh_pm_ops); - sh_mobile_setup_cpuidle(); - return 0; + return sh_mobile_setup_cpuidle(); } late_initcall(sh_pm_init);