mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
cpufreq: Use clamp() helper macro to improve the code readability
The valid values of policy.{min, max} should be between 'min' and 'max', so use clamp() helper macro to makes cpufreq_verify_within_limits() easier to follow. Signed-off-by: Liao Chang <liaochang1@huawei.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
d51847acb0
commit
a436ae9434
1 changed files with 3 additions and 11 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <linux/pm_qos.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/minmax.h>
|
||||
|
||||
/*********************************************************************
|
||||
* CPUFREQ INTERFACE *
|
||||
|
@ -467,17 +468,8 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy_data *poli
|
|||
unsigned int min,
|
||||
unsigned int max)
|
||||
{
|
||||
if (policy->min < min)
|
||||
policy->min = min;
|
||||
if (policy->max < min)
|
||||
policy->max = min;
|
||||
if (policy->min > max)
|
||||
policy->min = max;
|
||||
if (policy->max > max)
|
||||
policy->max = max;
|
||||
if (policy->min > policy->max)
|
||||
policy->min = policy->max;
|
||||
return;
|
||||
policy->max = clamp(policy->max, min, max);
|
||||
policy->min = clamp(policy->min, min, policy->max);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
Loading…
Reference in a new issue