summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-05-26 11:27:24 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-06-02 23:24:40 +0200
commit910c6e881c3a610dfd7575b96975d4df21e3a920 (patch)
tree3a9cad787f82d4d5086c67d04d40543edbbe8d70 /drivers/cpufreq/cpufreq.c
parent388612baba201bdcedfa66782f524dcc507d9f12 (diff)
downloadlinux-910c6e881c3a610dfd7575b96975d4df21e3a920.tar.gz
linux-910c6e881c3a610dfd7575b96975d4df21e3a920.tar.bz2
linux-910c6e881c3a610dfd7575b96975d4df21e3a920.zip
cpufreq: Use clamp_val() in __cpufreq_driver_target()
Use clamp_val() instead of open coding it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 364922fda428..198416bc22de 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1923,10 +1923,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
return -ENODEV;
/* Make sure that target_freq is within supported range */
- if (target_freq > policy->max)
- target_freq = policy->max;
- if (target_freq < policy->min)
- target_freq = policy->min;
+ target_freq = clamp_val(target_freq, policy->min, policy->max);
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
policy->cpu, target_freq, relation, old_target_freq);