Patchwork cpufreq: Remove needless bios_limit check in show_bios_limit()

login
register
mail settings
Submitter Yue Hu
Date April 16, 2019, 2:40 a.m.
Message ID <20190416024027.6516-1-zbestahu@gmail.com>
Download mbox | patch
Permalink /patch/773803/
State New
Headers show

Comments

Yue Hu - April 16, 2019, 2:40 a.m.
From: Yue Hu <huyue2@yulong.com>

Initially, bios_limit attribute will be created if driver->bios_limit
is set in cpufreq_add_dev_interface(). So remove the redundant check
for latter show operation.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 drivers/cpufreq/cpufreq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
Viresh Kumar - April 16, 2019, 1 p.m.
On 16-04-19, 10:40, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
> 
> Initially, bios_limit attribute will be created if driver->bios_limit
> is set in cpufreq_add_dev_interface(). So remove the redundant check
> for latter show operation.
> 
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
>  drivers/cpufreq/cpufreq.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index d9123de..047662b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -857,11 +857,9 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
>  {
>  	unsigned int limit;
>  	int ret;
> -	if (cpufreq_driver->bios_limit) {
> -		ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
> -		if (!ret)
> -			return sprintf(buf, "%u\n", limit);
> -	}
> +	ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
> +	if (!ret)
> +		return sprintf(buf, "%u\n", limit);
>  	return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
>  }
>  

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d9123de..047662b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -857,11 +857,9 @@  static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
 {
 	unsigned int limit;
 	int ret;
-	if (cpufreq_driver->bios_limit) {
-		ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
-		if (!ret)
-			return sprintf(buf, "%u\n", limit);
-	}
+	ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
+	if (!ret)
+		return sprintf(buf, "%u\n", limit);
 	return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
 }