Technically cpu_suspend() may fail and it's never good to lose information
about failure. For example things like cpuidle core could correctly sample
idling time in the case of failure.
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Jasper Korten <jja2000@gmail.com>
Tested-by: David Heidelberg <david@ixit.cz>
Tested-by: Nicolas Chauvet <kwizart@gmail.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
                                           struct cpuidle_driver *drv,
                                           int index)
 {
+       bool ret;
+
        while (!tegra_cpu_rail_off_ready())
                cpu_relax();
 
-       tegra_idle_lp2_last();
+       ret = !tegra_idle_lp2_last();
 
        if (cpu_online(1))
                tegra20_wake_cpu1_from_reset();
 
-       return true;
+       return ret;
 }
 
 #ifdef CONFIG_SMP
 
                return false;
        }
 
-       tegra_idle_lp2_last();
-
-       return true;
+       return !tegra_idle_lp2_last();
 }
 
 #ifdef CONFIG_SMP
 
        tegra_pmc_enter_suspend_mode(mode);
 }
 
-void tegra_idle_lp2_last(void)
+int tegra_idle_lp2_last(void)
 {
+       int err;
+
        tegra_pm_set(TEGRA_SUSPEND_LP2);
 
        cpu_cluster_pm_enter();
        suspend_cpu_complex();
 
-       cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
+       err = cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
 
        /*
         * Resume L2 cache if it wasn't re-enabled early during resume,
 
        restore_cpu_complex();
        cpu_cluster_pm_exit();
+
+       return err;
 }
 
 enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
 
 
 void tegra_clear_cpu_in_lp2(void);
 void tegra_set_cpu_in_lp2(void);
-void tegra_idle_lp2_last(void);
+int tegra_idle_lp2_last(void);
 extern void (*tegra_tear_down_cpu)(void);
 
 #ifdef CONFIG_PM_SLEEP