Commit 6c2b8185 authored by Dominik Brodowski's avatar Dominik Brodowski

cpupowerutils: lib - ConfigStyle bugfixes

Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 02af3cb5
...@@ -42,21 +42,25 @@ int cpufreq_get_hardware_limits(unsigned int cpu, ...@@ -42,21 +42,25 @@ int cpufreq_get_hardware_limits(unsigned int cpu,
return sysfs_get_freq_hardware_limits(cpu, min, max); return sysfs_get_freq_hardware_limits(cpu, min, max);
} }
char * cpufreq_get_driver(unsigned int cpu) { char *cpufreq_get_driver(unsigned int cpu)
{
return sysfs_get_freq_driver(cpu); return sysfs_get_freq_driver(cpu);
} }
void cpufreq_put_driver(char * ptr) { void cpufreq_put_driver(char *ptr)
{
if (!ptr) if (!ptr)
return; return;
free(ptr); free(ptr);
} }
struct cpufreq_policy * cpufreq_get_policy(unsigned int cpu) { struct cpufreq_policy *cpufreq_get_policy(unsigned int cpu)
{
return sysfs_get_freq_policy(cpu); return sysfs_get_freq_policy(cpu);
} }
void cpufreq_put_policy(struct cpufreq_policy *policy) { void cpufreq_put_policy(struct cpufreq_policy *policy)
{
if ((!policy) || (!policy->governor)) if ((!policy) || (!policy->governor))
return; return;
...@@ -65,11 +69,14 @@ void cpufreq_put_policy(struct cpufreq_policy *policy) { ...@@ -65,11 +69,14 @@ void cpufreq_put_policy(struct cpufreq_policy *policy) {
free(policy); free(policy);
} }
struct cpufreq_available_governors * cpufreq_get_available_governors(unsigned int cpu) { struct cpufreq_available_governors *cpufreq_get_available_governors(unsigned
int cpu)
{
return sysfs_get_freq_available_governors(cpu); return sysfs_get_freq_available_governors(cpu);
} }
void cpufreq_put_available_governors(struct cpufreq_available_governors *any) { void cpufreq_put_available_governors(struct cpufreq_available_governors *any)
{
struct cpufreq_available_governors *tmp, *next; struct cpufreq_available_governors *tmp, *next;
if (!any) if (!any)
...@@ -86,11 +93,14 @@ void cpufreq_put_available_governors(struct cpufreq_available_governors *any) { ...@@ -86,11 +93,14 @@ void cpufreq_put_available_governors(struct cpufreq_available_governors *any) {
} }
struct cpufreq_available_frequencies * cpufreq_get_available_frequencies(unsigned int cpu) { struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu)
{
return sysfs_get_available_frequencies(cpu); return sysfs_get_available_frequencies(cpu);
} }
void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *any) { void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies
*any) {
struct cpufreq_available_frequencies *tmp, *next; struct cpufreq_available_frequencies *tmp, *next;
if (!any) if (!any)
...@@ -105,11 +115,13 @@ void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *any ...@@ -105,11 +115,13 @@ void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *any
} }
struct cpufreq_affected_cpus * cpufreq_get_affected_cpus(unsigned int cpu) { struct cpufreq_affected_cpus *cpufreq_get_affected_cpus(unsigned int cpu)
{
return sysfs_get_freq_affected_cpus(cpu); return sysfs_get_freq_affected_cpus(cpu);
} }
void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any) { void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any)
{
struct cpufreq_affected_cpus *tmp, *next; struct cpufreq_affected_cpus *tmp, *next;
if (!any) if (!any)
...@@ -124,16 +136,19 @@ void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any) { ...@@ -124,16 +136,19 @@ void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any) {
} }
struct cpufreq_affected_cpus * cpufreq_get_related_cpus(unsigned int cpu) { struct cpufreq_affected_cpus *cpufreq_get_related_cpus(unsigned int cpu)
{
return sysfs_get_freq_related_cpus(cpu); return sysfs_get_freq_related_cpus(cpu);
} }
void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *any) { void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *any)
{
cpufreq_put_affected_cpus(any); cpufreq_put_affected_cpus(any);
} }
int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy) { int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy)
{
if (!policy || !(policy->governor)) if (!policy || !(policy->governor))
return -EINVAL; return -EINVAL;
...@@ -141,35 +156,39 @@ int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy) { ...@@ -141,35 +156,39 @@ int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy) {
} }
int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq) { int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq)
{
return sysfs_modify_freq_policy_min(cpu, min_freq); return sysfs_modify_freq_policy_min(cpu, min_freq);
} }
int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq) { int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq)
{
return sysfs_modify_freq_policy_max(cpu, max_freq); return sysfs_modify_freq_policy_max(cpu, max_freq);
} }
int cpufreq_modify_policy_governor(unsigned int cpu, char *governor) { int cpufreq_modify_policy_governor(unsigned int cpu, char *governor)
{
if ((!governor) || (strlen(governor) > 19)) if ((!governor) || (strlen(governor) > 19))
return -EINVAL; return -EINVAL;
return sysfs_modify_freq_policy_governor(cpu, governor); return sysfs_modify_freq_policy_governor(cpu, governor);
} }
int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency) { int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency)
{
return sysfs_set_frequency(cpu, target_frequency); return sysfs_set_frequency(cpu, target_frequency);
} }
struct cpufreq_stats * cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time) { struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu,
struct cpufreq_stats *ret; unsigned long long *total_time)
{
ret = sysfs_get_freq_stats(cpu, total_time); return sysfs_get_freq_stats(cpu, total_time);
return (ret);
} }
void cpufreq_put_stats(struct cpufreq_stats *any) { void cpufreq_put_stats(struct cpufreq_stats *any)
{
struct cpufreq_stats *tmp, *next; struct cpufreq_stats *tmp, *next;
if (!any) if (!any)
...@@ -183,8 +202,7 @@ void cpufreq_put_stats(struct cpufreq_stats *any) { ...@@ -183,8 +202,7 @@ void cpufreq_put_stats(struct cpufreq_stats *any) {
} }
} }
unsigned long cpufreq_get_transitions(unsigned int cpu) { unsigned long cpufreq_get_transitions(unsigned int cpu)
unsigned long ret = sysfs_get_freq_transitions(cpu); {
return sysfs_get_freq_transitions(cpu);
return (ret);
} }
...@@ -93,9 +93,9 @@ extern unsigned long cpufreq_get_transition_latency(unsigned int cpu); ...@@ -93,9 +93,9 @@ extern unsigned long cpufreq_get_transition_latency(unsigned int cpu);
* considerations by cpufreq policy notifiers in the kernel. * considerations by cpufreq policy notifiers in the kernel.
*/ */
extern int cpufreq_get_hardware_limits(unsigned int cpu, extern int cpufreq_get_hardware_limits(unsigned int cpu,
unsigned long *min, unsigned long *min,
unsigned long *max); unsigned long *max);
/* determine CPUfreq driver used /* determine CPUfreq driver used
...@@ -104,9 +104,9 @@ extern int cpufreq_get_hardware_limits(unsigned int cpu, ...@@ -104,9 +104,9 @@ extern int cpufreq_get_hardware_limits(unsigned int cpu,
* to avoid memory leakage, please. * to avoid memory leakage, please.
*/ */
extern char * cpufreq_get_driver(unsigned int cpu); extern char *cpufreq_get_driver(unsigned int cpu);
extern void cpufreq_put_driver(char * ptr); extern void cpufreq_put_driver(char *ptr);
/* determine CPUfreq policy currently used /* determine CPUfreq policy currently used
...@@ -116,7 +116,7 @@ extern void cpufreq_put_driver(char * ptr); ...@@ -116,7 +116,7 @@ extern void cpufreq_put_driver(char * ptr);
*/ */
extern struct cpufreq_policy * cpufreq_get_policy(unsigned int cpu); extern struct cpufreq_policy *cpufreq_get_policy(unsigned int cpu);
extern void cpufreq_put_policy(struct cpufreq_policy *policy); extern void cpufreq_put_policy(struct cpufreq_policy *policy);
...@@ -129,41 +129,47 @@ extern void cpufreq_put_policy(struct cpufreq_policy *policy); ...@@ -129,41 +129,47 @@ extern void cpufreq_put_policy(struct cpufreq_policy *policy);
*/ */
extern struct cpufreq_available_governors * cpufreq_get_available_governors(unsigned int cpu); extern struct cpufreq_available_governors
*cpufreq_get_available_governors(unsigned int cpu);
extern void cpufreq_put_available_governors(struct cpufreq_available_governors *first); extern void cpufreq_put_available_governors(
struct cpufreq_available_governors *first);
/* determine CPU frequency states available /* determine CPU frequency states available
* *
* only present on _some_ ->target() cpufreq drivers. For information purposes * Only present on _some_ ->target() cpufreq drivers. For information purposes
* only. Please free allocated memory by calling cpufreq_put_available_frequencies * only. Please free allocated memory by calling
* after use. * cpufreq_put_available_frequencies after use.
*/ */
extern struct cpufreq_available_frequencies * cpufreq_get_available_frequencies(unsigned int cpu); extern struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu);
extern void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *first); extern void cpufreq_put_available_frequencies(
struct cpufreq_available_frequencies *first);
/* determine affected CPUs /* determine affected CPUs
* *
* Remember to call cpufreq_put_affected_cpus when no longer needed * Remember to call cpufreq_put_affected_cpus when no longer needed
* to avoid memory leakage, please. * to avoid memory leakage, please.
*/ */
extern struct cpufreq_affected_cpus * cpufreq_get_affected_cpus(unsigned int cpu); extern struct cpufreq_affected_cpus *cpufreq_get_affected_cpus(unsigned
int cpu);
extern void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *first); extern void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *first);
/* determine related CPUs /* determine related CPUs
* *
* Remember to call cpufreq_put_related_cpus when no longer needed * Remember to call cpufreq_put_related_cpus when no longer needed
* to avoid memory leakage, please. * to avoid memory leakage, please.
*/ */
extern struct cpufreq_affected_cpus * cpufreq_get_related_cpus(unsigned int cpu); extern struct cpufreq_affected_cpus *cpufreq_get_related_cpus(unsigned
int cpu);
extern void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first); extern void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first);
...@@ -173,15 +179,16 @@ extern void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first); ...@@ -173,15 +179,16 @@ extern void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first);
* This is not available in all kernel versions or configurations. * This is not available in all kernel versions or configurations.
*/ */
extern struct cpufreq_stats * cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time); extern struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu,
unsigned long long *total_time);
extern void cpufreq_put_stats(struct cpufreq_stats *stats); extern void cpufreq_put_stats(struct cpufreq_stats *stats);
extern unsigned long cpufreq_get_transitions(unsigned int cpu); extern unsigned long cpufreq_get_transitions(unsigned int cpu);
/* set new cpufreq policy /* set new cpufreq policy
* *
* Tries to set the passed policy as new policy as close as possible, * Tries to set the passed policy as new policy as close as possible,
* but results may differ depending e.g. on governors being available. * but results may differ depending e.g. on governors being available.
*/ */
...@@ -189,7 +196,7 @@ extern unsigned long cpufreq_get_transitions(unsigned int cpu); ...@@ -189,7 +196,7 @@ extern unsigned long cpufreq_get_transitions(unsigned int cpu);
extern int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy); extern int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy);
/* modify a policy by only changing min/max freq or governor /* modify a policy by only changing min/max freq or governor
* *
* Does not check whether result is what was intended. * Does not check whether result is what was intended.
*/ */
...@@ -202,11 +209,12 @@ extern int cpufreq_modify_policy_governor(unsigned int cpu, char *governor); ...@@ -202,11 +209,12 @@ extern int cpufreq_modify_policy_governor(unsigned int cpu, char *governor);
/* set a specific frequency /* set a specific frequency
* *
* Does only work if userspace governor can be used and no external * Does only work if userspace governor can be used and no external
* interference (other calls to this function or to set/modify_policy) * interference (other calls to this function or to set/modify_policy)
* occurs. Also does not work on ->range() cpufreq drivers. * occurs. Also does not work on ->range() cpufreq drivers.
*/ */
extern int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency); extern int cpufreq_set_frequency(unsigned int cpu,
unsigned long target_frequency);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
This diff is collapsed.
...@@ -5,17 +5,27 @@ extern unsigned int sysfs_cpu_exists(unsigned int cpu); ...@@ -5,17 +5,27 @@ extern unsigned int sysfs_cpu_exists(unsigned int cpu);
extern unsigned long sysfs_get_freq_kernel(unsigned int cpu); extern unsigned long sysfs_get_freq_kernel(unsigned int cpu);
extern unsigned long sysfs_get_freq_hardware(unsigned int cpu); extern unsigned long sysfs_get_freq_hardware(unsigned int cpu);
extern unsigned long sysfs_get_freq_transition_latency(unsigned int cpu); extern unsigned long sysfs_get_freq_transition_latency(unsigned int cpu);
extern int sysfs_get_freq_hardware_limits(unsigned int cpu, unsigned long *min, unsigned long *max); extern int sysfs_get_freq_hardware_limits(unsigned int cpu,
extern char * sysfs_get_freq_driver(unsigned int cpu); unsigned long *min, unsigned long *max);
extern struct cpufreq_policy * sysfs_get_freq_policy(unsigned int cpu); extern char *sysfs_get_freq_driver(unsigned int cpu);
extern struct cpufreq_available_governors * sysfs_get_freq_available_governors(unsigned int cpu); extern struct cpufreq_policy *sysfs_get_freq_policy(unsigned int cpu);
extern struct cpufreq_available_frequencies * sysfs_get_available_frequencies(unsigned int cpu); extern struct cpufreq_available_governors *sysfs_get_freq_available_governors(
extern struct cpufreq_affected_cpus * sysfs_get_freq_affected_cpus(unsigned int cpu); unsigned int cpu);
extern struct cpufreq_affected_cpus * sysfs_get_freq_related_cpus(unsigned int cpu); extern struct cpufreq_available_frequencies *sysfs_get_available_frequencies(
extern struct cpufreq_stats * sysfs_get_freq_stats(unsigned int cpu, unsigned long long *total_time); unsigned int cpu);
extern struct cpufreq_affected_cpus *sysfs_get_freq_affected_cpus(
unsigned int cpu);
extern struct cpufreq_affected_cpus *sysfs_get_freq_related_cpus(
unsigned int cpu);
extern struct cpufreq_stats *sysfs_get_freq_stats(unsigned int cpu,
unsigned long long *total_time);
extern unsigned long sysfs_get_freq_transitions(unsigned int cpu); extern unsigned long sysfs_get_freq_transitions(unsigned int cpu);
extern int sysfs_set_freq_policy(unsigned int cpu, struct cpufreq_policy *policy); extern int sysfs_set_freq_policy(unsigned int cpu,
extern int sysfs_modify_freq_policy_min(unsigned int cpu, unsigned long min_freq); struct cpufreq_policy *policy);
extern int sysfs_modify_freq_policy_max(unsigned int cpu, unsigned long max_freq); extern int sysfs_modify_freq_policy_min(unsigned int cpu,
unsigned long min_freq);
extern int sysfs_modify_freq_policy_max(unsigned int cpu,
unsigned long max_freq);
extern int sysfs_modify_freq_policy_governor(unsigned int cpu, char *governor); extern int sysfs_modify_freq_policy_governor(unsigned int cpu, char *governor);
extern int sysfs_set_frequency(unsigned int cpu, unsigned long target_frequency); extern int sysfs_set_frequency(unsigned int cpu,
unsigned long target_frequency);
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