aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2013-04-17 09:32:57 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-21 18:35:53 -0400
commit38a94f4169e03494cbf850919b4b0a7e53e84bfd (patch)
treeec8574a75cf249c0a38749369d6720dda7898f62 /arch/sh
parent0a4f841e9c473be84a1ed0c14f65058c29238ce1 (diff)
SH: cpuidle: check error code at init
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 <daniel.lezcano@linaro.org> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/suspend.h4
-rw-r--r--arch/sh/kernel/cpu/shmobile/cpuidle.c11
-rw-r--r--arch/sh/kernel/cpu/shmobile/pm.c3
3 files changed, 11 insertions, 7 deletions
diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h
index e14567a7e9a1..70ae0b2888ab 100644
--- a/arch/sh/include/asm/suspend.h
+++ b/arch/sh/include/asm/suspend.h
@@ -14,9 +14,9 @@ struct swsusp_arch_regs {
14void sh_mobile_call_standby(unsigned long mode); 14void sh_mobile_call_standby(unsigned long mode);
15 15
16#ifdef CONFIG_CPU_IDLE 16#ifdef CONFIG_CPU_IDLE
17void sh_mobile_setup_cpuidle(void); 17int sh_mobile_setup_cpuidle(void);
18#else 18#else
19static inline void sh_mobile_setup_cpuidle(void) {} 19static inline int sh_mobile_setup_cpuidle(void) { return 0; }
20#endif 20#endif
21 21
22/* notifier chains for pre/post sleep hooks */ 22/* 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 aae346811da4..ea6ab0278490 100644
--- a/arch/sh/kernel/cpu/shmobile/cpuidle.c
+++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c
@@ -91,14 +91,19 @@ static struct cpuidle_driver cpuidle_driver = {
91 .state_count = 3, 91 .state_count = 3,
92}; 92};
93 93
94void sh_mobile_setup_cpuidle(void) 94int __init sh_mobile_setup_cpuidle(void)
95{ 95{
96 int ret;
97
96 if (sh_mobile_sleep_supported & SUSP_SH_SF) 98 if (sh_mobile_sleep_supported & SUSP_SH_SF)
97 cpuidle_driver.states[1].disabled = false; 99 cpuidle_driver.states[1].disabled = false;
98 100
99 if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) 101 if (sh_mobile_sleep_supported & SUSP_SH_STANDBY)
100 cpuidle_driver.states[2].disabled = false; 102 cpuidle_driver.states[2].disabled = false;
101 103
102 if (!cpuidle_register_driver(&cpuidle_driver)) 104 ret = cpuidle_register_driver(&cpuidle_driver);
103 cpuidle_register_device(&cpuidle_dev); 105 if (ret)
106 return ret;
107
108 return cpuidle_register_device(&cpuidle_dev);
104} 109}
diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c
index 08d27fac8d08..ac37b7234f85 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 = {
150static int __init sh_pm_init(void) 150static int __init sh_pm_init(void)
151{ 151{
152 suspend_set_ops(&sh_pm_ops); 152 suspend_set_ops(&sh_pm_ops);
153 sh_mobile_setup_cpuidle(); 153 return sh_mobile_setup_cpuidle();
154 return 0;
155} 154}
156 155
157late_initcall(sh_pm_init); 156late_initcall(sh_pm_init);