From 50379951c4cbb5d0ec12375bc50f3e7fb5f763cf Mon Sep 17 00:00:00 2001 From: Pankaj Gupta Date: Wed, 2 Sep 2020 10:57:31 +0530 Subject: [PATCH] msm: kgsl: Skip state change in idle check, if requested state is NONE After scheduling the idle work for transitioning to either NAP or SLUMBER it's possible that requested state can change to NONE if any new workload comes before kgsl_idle_check is executed or it gets the device mutex. If this happens, current code calls pwrctrl_change_state which fails as this is not a valid transition. To prevent this, skip calling pwrctrl_change_state if requested state is NONE. Change-Id: Iae535c6e2a3230f9e7e210712990eeb405822f4f Signed-off-by: Deepak Kumar Signed-off-by: Pankaj Gupta --- drivers/gpu/msm/kgsl_pwrctrl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c index 87245a77ee12..d01b000cbeef 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.c +++ b/drivers/gpu/msm/kgsl_pwrctrl.c @@ -1601,6 +1601,18 @@ void kgsl_idle_check(struct work_struct *work) mutex_lock(&device->mutex); + /* + * After scheduling idle work for transitioning to either NAP or + * SLUMBER, it's possible that requested state can change to NONE + * if any new workload comes before kgsl_idle_check is executed or + * it gets the device mutex. In such case, no need to change state + * to NONE. + */ + if (device->requested_state == KGSL_STATE_NONE) { + mutex_unlock(&device->mutex); + return; + } + requested_state = device->requested_state; if (device->state == KGSL_STATE_ACTIVE