aboutsummaryrefslogtreecommitdiff
path: root/drivers/powercap/dtpm_cpu.c
diff options
context:
space:
mode:
authorDaniel Lezcano2022-01-30 22:02:04 +0100
committerDaniel Lezcano2022-02-23 19:45:22 +0100
commit0aea2e4ec2a2bfa2d7e8820e37ba5b5ce04f20a5 (patch)
tree021916ca8ba98f9473a9b19f9e876d97a7d42e79 /drivers/powercap/dtpm_cpu.c
parent7b75bbdf5bedebed387aac6ad8411ed1cf3db5d0 (diff)
powercap/dtpm_cpu: Reset per_cpu variable in the release function
The release function does not reset the per cpu variable when it is called. That will prevent creation again as the variable will be already from the previous creation. Fix it by resetting them. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20220130210210.549877-2-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/powercap/dtpm_cpu.c')
-rw-r--r--drivers/powercap/dtpm_cpu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index eed5ad688d46..71f45d2f5a60 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -151,10 +151,17 @@ static int update_pd_power_uw(struct dtpm *dtpm)
static void pd_release(struct dtpm *dtpm)
{
struct dtpm_cpu *dtpm_cpu = to_dtpm_cpu(dtpm);
+ struct cpufreq_policy *policy;
if (freq_qos_request_active(&dtpm_cpu->qos_req))
freq_qos_remove_request(&dtpm_cpu->qos_req);
+ policy = cpufreq_cpu_get(dtpm_cpu->cpu);
+ if (policy) {
+ for_each_cpu(dtpm_cpu->cpu, policy->related_cpus)
+ per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL;
+ }
+
kfree(dtpm_cpu);
}