From 132d8ef6173f20f4ad2320b6545a2bcd0bbfb31d Mon Sep 17 00:00:00 2001 From: Maulik Shah Date: Wed, 30 Jun 2021 19:22:58 +0530 Subject: [PATCH] ANDROID: cpuidle: Allow for an early exit from cpuidle_enter_state() Vendor hook may modify index to negative to force an early exit from idle entry. Add support for the same. Bug: 192436062 Bug: 195914333 Change-Id: I82b822296d06b122e3f154b2c8af2128136023d5 Signed-off-by: Maulik Shah --- drivers/cpuidle/cpuidle.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 91908e8223d3..a01f04b31d50 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -212,6 +212,9 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, * broadcast must be assigned after the vendor hook. */ trace_android_vh_cpu_idle_enter(&index, dev); + if (index < 0) + return index; + target_state = &drv->states[index]; broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP);