Commit 8f578bfe authored by Zhang Rui's avatar Zhang Rui

Merge branch 'cpu_cooling-doc-comments-update' of .git into next

parents 09681dfa d44ada51
......@@ -64,6 +64,11 @@ static struct cpufreq_cooling_device *notify_device;
* get_idr - function to get a unique id.
* @idr: struct idr * handle used to create a id.
* @id: int * value generated by this function.
*
* This function will populate @id with an unique
* id, using the idr API.
*
* Return: 0 on success, an error code on failure.
*/
static int get_idr(struct idr *idr, int *id)
{
......@@ -75,6 +80,7 @@ static int get_idr(struct idr *idr, int *id)
if (unlikely(ret < 0))
return ret;
*id = ret;
return 0;
}
......@@ -105,6 +111,7 @@ static void release_idr(struct idr *idr, int id)
static int is_cpufreq_valid(int cpu)
{
struct cpufreq_policy policy;
return !cpufreq_get_policy(&policy, cpu);
}
......@@ -134,7 +141,8 @@ enum cpufreq_cooling_property {
* Return: 0 on success, -EINVAL when invalid parameters are passed.
*/
static int get_property(unsigned int cpu, unsigned long input,
unsigned int* output, enum cpufreq_cooling_property property)
unsigned int *output,
enum cpufreq_cooling_property property)
{
int i, j;
unsigned long max_level = 0, level = 0;
......@@ -149,7 +157,6 @@ static int get_property(unsigned int cpu, unsigned long input,
if (!table)
return -EINVAL;
for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
/* ignore invalid entries */
if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
......@@ -174,8 +181,7 @@ static int get_property(unsigned int cpu, unsigned long input,
}
if (property == GET_FREQ)
level = descend ? input : (max_level - input -1);
level = descend ? input : (max_level - input - 1);
for (i = 0, j = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
/* ignore invalid entry */
......@@ -201,6 +207,7 @@ static int get_property(unsigned int cpu, unsigned long input,
}
j++;
}
return -EINVAL;
}
......@@ -221,6 +228,7 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
if (get_property(cpu, (unsigned long)freq, &val, GET_LEVEL))
return THERMAL_CSTATE_INVALID;
return (unsigned long)val;
}
EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level);
......@@ -245,6 +253,7 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
ret = get_property(cpu, level, &freq, GET_FREQ);
if (ret)
return 0;
return freq;
}
......@@ -314,7 +323,7 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
if (cpumask_test_cpu(policy->cpu, &notify_device->allowed_cpus))
max_freq = notify_device->cpufreq_val;
/* Never exceed user_policy.max*/
/* Never exceed user_policy.max */
if (max_freq > policy->user_policy.max)
max_freq = policy->user_policy.max;
......@@ -324,9 +333,7 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
return 0;
}
/*
* cpufreq cooling device callback functions are defined below
*/
/* cpufreq cooling device callback functions are defined below */
/**
* cpufreq_get_max_state - callback function to get the max cooling state.
......@@ -373,6 +380,7 @@ static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev,
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
*state = cpufreq_device->cpufreq_state;
return 0;
}
......@@ -417,8 +425,8 @@ static struct notifier_block thermal_cpufreq_notifier_block = {
* Return: a valid struct thermal_cooling_device pointer on success,
* on failure, it returns a corresponding ERR_PTR().
*/
struct thermal_cooling_device *cpufreq_cooling_register(
const struct cpumask *clip_cpus)
struct thermal_cooling_device *
cpufreq_cooling_register(const struct cpumask *clip_cpus)
{
struct thermal_cooling_device *cool_dev;
struct cpufreq_cooling_device *cpufreq_dev = NULL;
......@@ -427,9 +435,9 @@ struct thermal_cooling_device *cpufreq_cooling_register(
int ret = 0, i;
struct cpufreq_policy policy;
/*Verify that all the clip cpus have same freq_min, freq_max limit*/
/* Verify that all the clip cpus have same freq_min, freq_max limit */
for_each_cpu(i, clip_cpus) {
/*continue if cpufreq policy not found and not return error*/
/* continue if cpufreq policy not found and not return error */
if (!cpufreq_get_policy(&policy, i))
continue;
if (min == 0 && max == 0) {
......@@ -475,6 +483,7 @@ struct thermal_cooling_device *cpufreq_cooling_register(
cpufreq_dev_count++;
mutex_unlock(&cooling_cpufreq_lock);
return cool_dev;
}
EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
......@@ -496,7 +505,6 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
if (cpufreq_dev_count == 0)
cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,
CPUFREQ_POLICY_NOTIFIER);
mutex_unlock(&cooling_cpufreq_lock);
thermal_cooling_device_unregister(cpufreq_dev->cool_dev);
......
......@@ -32,8 +32,8 @@
* cpufreq_cooling_register - function to create cpufreq cooling device.
* @clip_cpus: cpumask of cpus where the frequency constraints will happen
*/
struct thermal_cooling_device *cpufreq_cooling_register(
const struct cpumask *clip_cpus);
struct thermal_cooling_device *
cpufreq_cooling_register(const struct cpumask *clip_cpus);
/**
* cpufreq_cooling_unregister - function to remove cpufreq cooling device.
......@@ -43,18 +43,18 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int);
#else /* !CONFIG_CPU_THERMAL */
static inline struct thermal_cooling_device *cpufreq_cooling_register(
const struct cpumask *clip_cpus)
static inline struct thermal_cooling_device *
cpufreq_cooling_register(const struct cpumask *clip_cpus)
{
return NULL;
}
static inline void cpufreq_cooling_unregister(
struct thermal_cooling_device *cdev)
static inline
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
{
return;
}
static inline unsigned long cpufreq_cooling_get_level(unsigned int,
unsigned int)
static inline
unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int)
{
return THERMAL_CSTATE_INVALID;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment