Commit 38a94f41 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki

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: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0a4f841e
...@@ -14,9 +14,9 @@ struct swsusp_arch_regs { ...@@ -14,9 +14,9 @@ struct swsusp_arch_regs {
void sh_mobile_call_standby(unsigned long mode); void sh_mobile_call_standby(unsigned long mode);
#ifdef CONFIG_CPU_IDLE #ifdef CONFIG_CPU_IDLE
void sh_mobile_setup_cpuidle(void); int sh_mobile_setup_cpuidle(void);
#else #else
static inline void sh_mobile_setup_cpuidle(void) {} static inline int sh_mobile_setup_cpuidle(void) { return 0; }
#endif #endif
/* notifier chains for pre/post sleep hooks */ /* notifier chains for pre/post sleep hooks */
......
...@@ -91,14 +91,19 @@ static struct cpuidle_driver cpuidle_driver = { ...@@ -91,14 +91,19 @@ static struct cpuidle_driver cpuidle_driver = {
.state_count = 3, .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) if (sh_mobile_sleep_supported & SUSP_SH_SF)
cpuidle_driver.states[1].disabled = false; cpuidle_driver.states[1].disabled = false;
if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) if (sh_mobile_sleep_supported & SUSP_SH_STANDBY)
cpuidle_driver.states[2].disabled = false; cpuidle_driver.states[2].disabled = false;
if (!cpuidle_register_driver(&cpuidle_driver)) ret = cpuidle_register_driver(&cpuidle_driver);
cpuidle_register_device(&cpuidle_dev); if (ret)
return ret;
return cpuidle_register_device(&cpuidle_dev);
} }
...@@ -150,8 +150,7 @@ static const struct platform_suspend_ops sh_pm_ops = { ...@@ -150,8 +150,7 @@ static const struct platform_suspend_ops sh_pm_ops = {
static int __init sh_pm_init(void) static int __init sh_pm_init(void)
{ {
suspend_set_ops(&sh_pm_ops); suspend_set_ops(&sh_pm_ops);
sh_mobile_setup_cpuidle(); return sh_mobile_setup_cpuidle();
return 0;
} }
late_initcall(sh_pm_init); late_initcall(sh_pm_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment