Skip to contentSkip to conversation

cpufreq: Remove needless bios_limit check in show_bios_limit()

PATCH Applied Yue Hu 3 participants 3 messages Apr 16, 2019 – May 1, 2019 CPU frequency scaling framework

lore
Share & tools
lore

Yue Hu

author
#0 lore raw

PATCH 1/1 cpufreq: Remove needless bios_limit check in show_bios_limit()

From: Yue Hu <[email protected]>

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.

---
 drivers/cpufreq/cpufreq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/cpufreq.c +3 -5
index d9123de..047662b 100644
@@ -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);
 }
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Yue Hu

From: Yue Hu <[email protected]>

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.

---
 drivers/cpufreq/cpufreq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/cpufreq.c +0 -1
index d9123de..047662b 100644
@@ -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) {

drivers/cpufreq/cpufreq.c static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) · line 865

Quoted 10 lines
drivers/cpufreq/cpufreq.c +3 -4
-		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);
 }
 
Signature · 1 line
viresh
#2 lore raw
In reply to Yue Hu
Quoted 21 lines · CEST Yue Hu

From: Yue Hu <[email protected]>

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.

---
 drivers/cpufreq/cpufreq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/cpufreq.c +0 -1
index d9123de..047662b 100644
@@ -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) {

drivers/cpufreq/cpufreq.c static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) · line 865

Quoted 10 lines
drivers/cpufreq/cpufreq.c +3 -4
-		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!