diff --git a/drivers/cpuidle/governors/qcom-cluster-lpm.c b/drivers/cpuidle/governors/qcom-cluster-lpm.c index d3f6202926f6..54be4cec2cde 100644 --- a/drivers/cpuidle/governors/qcom-cluster-lpm.c +++ b/drivers/cpuidle/governors/qcom-cluster-lpm.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -390,14 +391,14 @@ void update_cluster_select(struct lpm_cpu *cpu_gov) if (!cluster_gov->initialized) continue; - spin_lock(&cluster_gov->lock); - cluster_gov->now = cpu_gov->now; genpd = cluster_gov->genpd; if (cpumask_test_cpu(cpu, genpd->cpus)) { + spin_lock(&cluster_gov->lock); + cluster_gov->now = cpu_gov->now; cluster_gov->cpu_next_wakeup[cpu] = cpu_gov->next_wakeup; update_cluster_next_wakeup(cluster_gov); + spin_unlock(&cluster_gov->lock); } - spin_unlock(&cluster_gov->lock); } } diff --git a/drivers/cpuidle/governors/qcom-lpm.c b/drivers/cpuidle/governors/qcom-lpm.c index 3158de1c765b..d969bb58f902 100644 --- a/drivers/cpuidle/governors/qcom-lpm.c +++ b/drivers/cpuidle/governors/qcom-lpm.c @@ -345,7 +345,8 @@ static void update_cpu_history(struct lpm_cpu *cpu_gov) u64 measured_us = ktime_to_us(cpu_gov->dev->last_residency_ns); struct cpuidle_state *target; - if (prediction_disabled || idx < 0 || idx > cpu_gov->drv->state_count - 1) + if (sleep_disabled || prediction_disabled || idx < 0 || + idx > cpu_gov->drv->state_count - 1) return; target = &cpu_gov->drv->states[idx]; @@ -568,7 +569,7 @@ static int lpm_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, for (i = drv->state_count - 1; i > 0; i--) { struct cpuidle_state *s = &drv->states[i]; - if (i && dev->states_usage[i].disable) { + if (dev->states_usage[i].disable) { reason |= UPDATE_REASON(i, LPM_SELECT_STATE_DISABLED); continue; }