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: 2453841 Return-Path: X-Original-To: patchwork-linux-sh@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 9E954DF23A for ; Wed, 17 Apr 2013 13:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966340Ab3DQNdQ (ORCPT ); Wed, 17 Apr 2013 09:33:16 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:52543 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966186Ab3DQNdP (ORCPT ); Wed, 17 Apr 2013 09:33:15 -0400 Received: by mail-wg0-f45.google.com with SMTP id l18so1609648wgh.12 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=pz2oVwsyQzYQZECzfpUaDK51l1vfiYIoEW7PXZ7/ZcDs6VYq+fNuabfq/XQqe8cE44 AHIkyE6uyh1Kmrbm6wcED22i/BAPS9Hh9DzMwQaUJWwhCKfje5/K3p7pYVb/e4FR5i31 QeCBYprt0aVRLlC7lcBm1acgcfy9a2RfnsQW1uvd1QkHjdIczvjPqO/wG85j9de3quSR /qCUZFI1Hu6o1Eo82XKOSsavBJn3KFuorqJgzv6Batpb2iUuCaugnvt8biBJH3sTNuzQ q+sbTufEuTF/9Nt5noT8OSIn2Wfyemn96Y0GKxW0lQGiA0xmeoCFHXbxcY3yzjMihmIa pUPQ== 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: ALoCoQmxNsir3zVj7Ku0duLB44imD6imQTjdndVH1Ofi3y+EXkcNXYqQ8yx3U2a5p5wbts8e4aXw Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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);