summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-05-26 07:57:24 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-06-02 23:24:40 +0200
commit910c6e881c3a610dfd7575b96975d4df21e3a920 (patch)
tree3a9cad787f82d4d5086c67d04d40543edbbe8d70 /drivers/cpufreq/cpufreq.c
parentcpufreq: Send START policy notification after sending CREATE (diff)
downloadlinux-910c6e881c3a610dfd7575b96975d4df21e3a920.tar.xz
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);