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: 2453851 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EB880DF23A for ; Wed, 17 Apr 2013 13:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966341Ab3DQNdQ (ORCPT ); Wed, 17 Apr 2013 09:33:16 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:49443 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966258Ab3DQNdP (ORCPT ); Wed, 17 Apr 2013 09:33:15 -0400 Received: by mail-wg0-f54.google.com with SMTP id y10so1545502wgg.33 for ; Wed, 17 Apr 2013 06:33:14 -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=mNj/IUx4iVIP8Ucbpd8WSlUDGYhgd7fue8JtAk4K2lk=; b=j0+LFd6cBkg0LxjPp0ccwWgB8lNwJC5GAnPtiQt+mTsAgReuMAM1cTXGrH2QgjYTTJ 1o3vRmk1pyzj04TsM7P6CqiF007T9Lr4rU1XfyKbdWxI0qX08/8fAb9f98bog183oqJx Eo87Pge5mDLRwdxZjgMCdrzk2xtlO4ecuzqxUSPWVTzv2n3uU4Y0HCuDauHGzZxMIFm9 2TKEMKKfDeqtjz7k+gp/sGyg1EGJ+93ATN7tnhy0EezSoLaCjYWBwB4aSJXBvYZ1y8MK neJS5QP+5gRVfJxKlqLCkE4ULVIlc8jxBNKdofi+cSvK1h3stDlmB6RRLXD3SsMvI6fe tsqQ== 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: ALoCoQm6h0IjhsFKxX3vNv0PBp5u8Z3uy4lGUFzrFWeTCeeTlnT+dCHMi7DcnzmUwo/8Ubeej0Fp Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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);