From bdfb11230b8707ebaf18b4a45f8303f0675fc828 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 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 500f265e0d14..ab77a363a9fb 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);