cpufreq: Change order of online() CB and policy->cpus modification
authorPierre Gondois <pierre.gondois@arm.com>
Mon, 4 Jul 2022 11:27:39 +0000 (13:27 +0200)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 18 Jul 2022 01:52:22 +0000 (07:22 +0530)
From a state where all policy->related_cpus are offline, putting one
of the policy's CPU back online re-activates the policy by:
 1. Calling cpufreq_driver->online()
 2. Setting the CPU in policy->cpus

qcom_cpufreq_hw_cpu_online() makes use of policy->cpus. Thus 1. and 2.
should be inverted to avoid having a policy->cpus empty. The
qcom-cpufreq-hw is the only driver affected by this.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/cpufreq.c

index 2cad42774164799dc1895116f5ca7783e46b281a..36043be16d8e1f104f100de158ce24607d2d643c 100644 (file)
@@ -1350,15 +1350,15 @@ static int cpufreq_online(unsigned int cpu)
        }
 
        if (!new_policy && cpufreq_driver->online) {
+               /* Recover policy->cpus using related_cpus */
+               cpumask_copy(policy->cpus, policy->related_cpus);
+
                ret = cpufreq_driver->online(policy);
                if (ret) {
                        pr_debug("%s: %d: initialization failed\n", __func__,
                                 __LINE__);
                        goto out_exit_policy;
                }
-
-               /* Recover policy->cpus using related_cpus */
-               cpumask_copy(policy->cpus, policy->related_cpus);
        } else {
                cpumask_copy(policy->cpus, cpumask_of(cpu));