Merge branch 'cpu_cooling-doc-comments-update' of .git into next
This commit is contained in:
commit
8f578bfefd
@ -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)
|
||||
@ -176,7 +183,6 @@ static int get_property(unsigned int cpu, unsigned long input,
|
||||
if (property == GET_FREQ)
|
||||
level = descend ? input : (max_level - input - 1);
|
||||
|
||||
|
||||
for (i = 0, j = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
|
||||
/* ignore invalid entry */
|
||||
if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user