Skip to content

Commit

Permalink
cpufreq: Use has_target() instead of !setpolicy
Browse files Browse the repository at this point in the history
For code consistency, use has_target() instead of !setpolicy everywhere,
as it is already done at several places. Maybe we should also use
"!has_target()" instead of "cpufreq_driver->setpolicy" where we need to
check if the driver supports setpolicy, so to use only one expression
for this kind of differentiation.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Jun 26, 2019

Unverified

No user is associated with the committer email.
1 parent 407d0ff commit 5ddc6d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
@@ -634,7 +634,7 @@ static int cpufreq_parse_policy(char *str_governor,
}

/**
* cpufreq_parse_governor - parse a governor string only for !setpolicy
* cpufreq_parse_governor - parse a governor string only for has_target()
*/
static int cpufreq_parse_governor(char *str_governor,
struct cpufreq_policy *policy)
@@ -1303,7 +1303,7 @@ static int cpufreq_online(unsigned int cpu)
policy->max = policy->user_policy.max;
}

if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
if (cpufreq_driver->get && has_target()) {
policy->cur = cpufreq_driver->get(policy->cpu);
if (!policy->cur) {
pr_err("%s: ->get() failed\n", __func__);
@@ -2402,7 +2402,7 @@ void cpufreq_update_policy(unsigned int cpu)
* 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_driver->get && has_target() &&
(cpufreq_suspended || WARN_ON(!cpufreq_update_current_freq(policy))))
goto unlock;

0 comments on commit 5ddc6d4

Please sign in to comment.