mvebu: Add basic support for WRT1900AC (v1) and Turris Omnia (pre 2019)
[librecmc/librecmc.git] / target / linux / mvebu / patches-4.14 / 400-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch
1 From c28b2d367da8a471482e6a4aa8337ab6369a80c2 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@arm.linux.org.uk>
3 Date: Sat, 3 Oct 2015 09:13:05 +0100
4 Subject: cpuidle: mvebu: indicate failure to enter deeper sleep states
5
6 The cpuidle ->enter method expects the return value to be the sleep
7 state we entered.  Returning negative numbers or other codes is not
8 permissible since coupled CPU idle was merged.
9
10 At least some of the mvebu_v7_cpu_suspend() implementations return the
11 value from cpu_suspend(), which returns zero if the CPU vectors back
12 into the kernel via cpu_resume() (the success case), or the non-zero
13 return value of the suspend actor, or one (failure cases).
14
15 We do not want to be returning the failure case value back to CPU idle
16 as that indicates that we successfully entered one of the deeper idle
17 states.  Always return zero instead, indicating that we slept for the
18 shortest amount of time.
19
20 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
21 ---
22  drivers/cpuidle/cpuidle-mvebu-v7.c | 6 +++++-
23  1 file changed, 5 insertions(+), 1 deletion(-)
24
25 --- a/drivers/cpuidle/cpuidle-mvebu-v7.c
26 +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c
27 @@ -39,8 +39,12 @@ static int mvebu_v7_enter_idle(struct cp
28         ret = mvebu_v7_cpu_suspend(deepidle);
29         cpu_pm_exit();
30  
31 +       /*
32 +        * If we failed to enter the desired state, indicate that we
33 +        * slept lightly.
34 +        */
35         if (ret)
36 -               return ret;
37 +               return 0;
38  
39         return index;
40  }