Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1630383
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V4 14/17] thermal: cpu_cooling: get_level() can't fail |
| Date | 2017-04-25 12:40 +0200 |
| Message-ID | <tA62Z-3ve-3@gated-at.bofh.it> (permalink) |
| References | <tA5Tk-3rD-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The frequency passed to get_level() is returned by cpu_power_to_freq()
and it is guaranteed that get_level() can't fail.
Get rid of error code.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
---
drivers/thermal/cpu_cooling.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 11735dba1456..2c2d76ac04c3 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -119,22 +119,19 @@ static LIST_HEAD(cpufreq_cdev_list);
* @cpufreq_cdev: cpufreq_cdev for which the property is required
* @freq: Frequency
*
- * Return: level on success, THERMAL_CSTATE_INVALID on error.
+ * Return: level corresponding to the frequency.
*/
static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev,
unsigned int freq)
{
+ struct freq_table *freq_table = cpufreq_cdev->freq_table;
unsigned long level;
- for (level = 0; level <= cpufreq_cdev->max_level; level++) {
- if (freq == cpufreq_cdev->freq_table[level].frequency)
- return level;
-
- if (freq > cpufreq_cdev->freq_table[level].frequency)
+ for (level = 1; level <= cpufreq_cdev->max_level; level++)
+ if (freq > freq_table[level].frequency)
break;
- }
- return THERMAL_CSTATE_INVALID;
+ return level - 1;
}
/**
@@ -627,13 +624,6 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev,
target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power);
*state = get_level(cpufreq_cdev, target_freq);
- if (*state == THERMAL_CSTATE_INVALID) {
- dev_err_ratelimited(&cdev->device,
- "Failed to convert %dKHz for cpu %d into a cdev state\n",
- target_freq, policy->cpu);
- return -EINVAL;
- }
-
trace_thermal_power_cpu_limit(policy->related_cpus, target_freq, *state,
power);
return 0;
--
2.12.0.432.g71c3a4f4ba37
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 13/17] thermal: cpu_cooling: create structure for idle time stats Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 16/17] thermal: cpu_cooling: 'freq' can't be zero in cpufreq_state2power() Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 12/17] thermal: cpu_cooling: merge frequency and power tables Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 07/17] thermal: cpu_cooling: use cpufreq_policy to register cooling device Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level() Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:30 +0200
[PATCH V4 10/17] thermal: cpu_cooling: OPPs are registered for all CPUs Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 14/17] thermal: cpu_cooling: get_level() can't fail Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 09/17] thermal: cpu_cooling: store cpufreq policy Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 11/17] thermal: cpu_cooling: get rid of 'allowed_cpus' Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 08/17] cpufreq: create cpufreq_table_count_valid_entries() Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 03/17] thermal: cpu_cooling: Name cpufreq cooling devices as cpufreq_cdev Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 04/17] thermal: cpu_cooling: replace cool_dev with cdev Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 15/17] thermal: cpu_cooling: don't store cpu_dev in cpufreq_cdev Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
[PATCH V4 17/17] thermal: cpu_cooling: Rearrange struct cpufreq_cooling_device Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-25 12:40 +0200
Re: [PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Lukasz Luba <lukasz.luba@arm.com> - 2017-04-26 12:50 +0200
Re: [PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 12:50 +0200
Re: [PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Eduardo Valentin <edubezval@gmail.com> - 2017-04-27 18:30 +0200
Re: [PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-28 06:30 +0200
csiph-web