thermal: cpu_cooling: remove unnecessary wrapper get_cpu_frequency()
get_cpu_frequency() isn't doing much by itself, just calling get_property(). And so this wrapper isn't required at all. Get rid of it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
parent
5194fe4699
commit
521a2e5831
1 changed files with 9 additions and 31 deletions
|
@ -229,30 +229,6 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level);
|
EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level);
|
||||||
|
|
||||||
/**
|
|
||||||
* get_cpu_frequency - get the absolute value of frequency from level.
|
|
||||||
* @cpu: cpu for which frequency is fetched.
|
|
||||||
* @level: cooling level
|
|
||||||
*
|
|
||||||
* This function matches cooling level with frequency. Based on a cooling level
|
|
||||||
* of frequency, equals cooling state of cpu cooling device, it will return
|
|
||||||
* the corresponding frequency.
|
|
||||||
* e.g level=0 --> 1st MAX FREQ, level=1 ---> 2nd MAX FREQ, .... etc
|
|
||||||
*
|
|
||||||
* Return: 0 on error, the corresponding frequency otherwise.
|
|
||||||
*/
|
|
||||||
static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
unsigned int freq;
|
|
||||||
|
|
||||||
ret = get_property(cpu, level, &freq, GET_FREQ);
|
|
||||||
if (ret)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cpufreq_thermal_notifier - notifier callback for cpufreq policy change.
|
* cpufreq_thermal_notifier - notifier callback for cpufreq policy change.
|
||||||
* @nb: struct notifier_block * with callback info.
|
* @nb: struct notifier_block * with callback info.
|
||||||
|
@ -358,14 +334,15 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
|
||||||
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
|
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
|
||||||
unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus);
|
unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus);
|
||||||
unsigned int clip_freq;
|
unsigned int clip_freq;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Check if the old cooling action is same as new cooling action */
|
/* Check if the old cooling action is same as new cooling action */
|
||||||
if (cpufreq_device->cpufreq_state == state)
|
if (cpufreq_device->cpufreq_state == state)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
clip_freq = get_cpu_frequency(cpu, state);
|
ret = get_property(cpu, state, &clip_freq, GET_FREQ);
|
||||||
if (!clip_freq)
|
if (ret)
|
||||||
return -EINVAL;
|
return ret;
|
||||||
|
|
||||||
cpufreq_device->cpufreq_state = state;
|
cpufreq_device->cpufreq_state = state;
|
||||||
cpufreq_device->cpufreq_val = clip_freq;
|
cpufreq_device->cpufreq_val = clip_freq;
|
||||||
|
@ -419,10 +396,11 @@ __cpufreq_cooling_register(struct device_node *np,
|
||||||
if (!cpufreq_dev)
|
if (!cpufreq_dev)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
cpufreq_dev->cpufreq_val = get_cpu_frequency(cpumask_any(clip_cpus), 0);
|
ret = get_property(cpumask_any(clip_cpus), 0, &cpufreq_dev->cpufreq_val,
|
||||||
if (!cpufreq_dev->cpufreq_val) {
|
GET_FREQ);
|
||||||
pr_err("%s: Failed to get frequency", __func__);
|
if (ret) {
|
||||||
cool_dev = ERR_PTR(-EINVAL);
|
pr_err("%s: Failed to get frequency: %d", __func__, ret);
|
||||||
|
cool_dev = ERR_PTR(ret);
|
||||||
goto free_cdev;
|
goto free_cdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue