lkml.org 
[lkml]   [2019]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 08/16] cpufreq/intel_pstate: remove NULL entry + use match_string()
Date
The change is mostly cosmetic.

The `energy_perf_strings` array is static, so match_string() can be used
(which will implicitly do a ARRAY_SIZE(energy_perf_strings)).

The only small benefit here, is the reduction of the array size by 1
element.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/cpufreq/intel_pstate.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 6ed1e705bc05..ab9a0b34b900 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -593,8 +593,7 @@ static const char * const energy_perf_strings[] = {
"performance",
"balance_performance",
"balance_power",
- "power",
- NULL
+ "power"
};
static const unsigned int epp_values[] = {
HWP_EPP_PERFORMANCE,
@@ -680,8 +679,8 @@ static ssize_t show_energy_performance_available_preferences(
int i = 0;
int ret = 0;

- while (energy_perf_strings[i] != NULL)
- ret += sprintf(&buf[ret], "%s ", energy_perf_strings[i++]);
+ for (; i < ARRAY_SIZE(energy_perf_strings); i++)
+ ret += sprintf(&buf[ret], "%s ", energy_perf_strings[i]);

ret += sprintf(&buf[ret], "\n");

@@ -701,7 +700,7 @@ static ssize_t store_energy_performance_preference(
if (ret != 1)
return -EINVAL;

- ret = __match_string(energy_perf_strings, -1, str_preference);
+ ret = match_string(energy_perf_strings, str_preference);
if (ret < 0)
return ret;

--
2.17.1
\
 
 \ /
  Last update: 2019-05-08 13:33    [W:0.208 / U:6.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site