Commit 9587661e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Qais Yousef
Browse files

UPSTREAM: cpuidle: teo: Fix alternative idle state lookup



There are three mistakes in the loop in teo_select() that is looking
for an alternative candidate idle state.  First, it should walk all
of the idle states shallower than the current candidate one,
including all of the disabled ones, but it terminates after the first
enabled idle state.  Second, it should not terminate its last step
if idle state 0 is disabled (which is related to the first issue).
Finally, it may return the current alternative candidate idle state
prematurely if the time span criterion is not met by the idle state
under consideration at the moment.

To address the issues mentioned above, make the loop in question walk
all of the idle states shallower than the current candidate idle state
all the way down to idle state 0 and rearrange the checks in it.

Bug: 258723112
Fixes: 77577558 ("cpuidle: teo: Rework most recent idle duration values treatment")
Reported-by: default avatarDoug Smythies <dsmythies@telus.net>
Tested-by: default avatarDoug Smythies <dsmythies@telus.net>
Change-Id: I6e71e4f073c2adedc1134e166281e08676df6faa
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit c2ec772b)
Signed-off-by: default avatarQais Yousef <qyousef@google.com>
parent 7847e260
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment