diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-02-20 00:24:25 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-02-20 10:18:37 +0100 |
commit | 348a2ec5f5a5af15509252dfc6a30fa190ac0203 (patch) | |
tree | 7358c08bb8a4be1525335f165734baacbf917995 | |
parent | a0dbb819b84f87b3cb35083e264e9e584630e1f7 (diff) | |
download | linux-348a2ec5f5a5af15509252dfc6a30fa190ac0203.tar.bz2 |
cpufreq: Reorder and simplify cpufreq_update_policy()
In cpufreq_update_policy(), instead of updating new_policy.cur
separately, which is kind of confusing, because cpufreq_set_policy()
doesn't take that value into account directly anyway, make the copy
of the existing policy after calling cpufreq_update_current_freq().
No intentional changes of behavior.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e4a7dbee84fc..fd5221007ade 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2354,23 +2354,18 @@ void cpufreq_update_policy(unsigned int cpu) if (policy_is_inactive(policy)) goto unlock; - pr_debug("updating policy for CPU %u\n", cpu); - memcpy(&new_policy, policy, sizeof(*policy)); - new_policy.min = policy->user_policy.min; - new_policy.max = policy->user_policy.max; - /* * BIOS might change freq behind our back * -> ask driver for current freq and notify governors about a change */ - if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { - if (cpufreq_suspended) - goto unlock; + if (cpufreq_driver->get && !cpufreq_driver->setpolicy && + (cpufreq_suspended || WARN_ON(!cpufreq_update_current_freq(policy)))) + goto unlock; - new_policy.cur = cpufreq_update_current_freq(policy); - if (WARN_ON(!new_policy.cur)) - goto unlock; - } + pr_debug("updating policy for CPU %u\n", cpu); + memcpy(&new_policy, policy, sizeof(*policy)); + new_policy.min = policy->user_policy.min; + new_policy.max = policy->user_policy.max; cpufreq_set_policy(policy, &new_policy); |