Skip to content

Commit 0aea2e4

Browse files
committed
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
1 parent 7b75bbd commit 0aea2e4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/powercap/dtpm_cpu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,17 @@ static int update_pd_power_uw(struct dtpm *dtpm)
151151
static void pd_release(struct dtpm *dtpm)
152152
{
153153
struct dtpm_cpu *dtpm_cpu = to_dtpm_cpu(dtpm);
154+
struct cpufreq_policy *policy;
154155

155156
if (freq_qos_request_active(&dtpm_cpu->qos_req))
156157
freq_qos_remove_request(&dtpm_cpu->qos_req);
157158

159+
policy = cpufreq_cpu_get(dtpm_cpu->cpu);
160+
if (policy) {
161+
for_each_cpu(dtpm_cpu->cpu, policy->related_cpus)
162+
per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL;
163+
}
164+
158165
kfree(dtpm_cpu);
159166
}
160167

0 commit comments

Comments
 (0)