cpufreq: Remove needless bios_limit check in show_bios_limit()
diff mbox series

Message ID 20190416024027.6516-1-zbestahu@gmail.com
State Awaiting Upstream
Delegated to: Rafael Wysocki
Headers show
Series
  • cpufreq: Remove needless bios_limit check in show_bios_limit()
Related show

Commit Message

Yue Hu April 16, 2019, 2:40 a.m. UTC
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(-)

Comments

Viresh Kumar April 16, 2019, 1 p.m. UTC | #1
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>
Rafael J. Wysocki May 1, 2019, 10:23 a.m. UTC | #2
On Tuesday, April 16, 2019 4:40:27 AM CEST 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);
>  }
>  
> 

Applied, thanks!

Patch
diff mbox series

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);
 }