summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/lib/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/power/cpupower/lib/cpufreq.c')
-rw-r--r--tools/power/cpupower/lib/cpufreq.c72
1 files changed, 45 insertions, 27 deletions
diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c
index ae7d8c57b447..d961101d1cea 100644
--- a/tools/power/cpupower/lib/cpufreq.c
+++ b/tools/power/cpupower/lib/cpufreq.c
@@ -42,21 +42,25 @@ int cpufreq_get_hardware_limits(unsigned int cpu,
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);
}
-void cpufreq_put_driver(char * ptr) {
+void cpufreq_put_driver(char *ptr)
+{
if (!ptr)
return;
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);
}
-void cpufreq_put_policy(struct cpufreq_policy *policy) {
+void cpufreq_put_policy(struct cpufreq_policy *policy)
+{
if ((!policy) || (!policy->governor))
return;
@@ -65,11 +69,14 @@ void cpufreq_put_policy(struct cpufreq_policy *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);
}
-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;
if (!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);
}
-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;
if (!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);
}
-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;
if (!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);
}
-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);
}
-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))
return -EINVAL;
@@ -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);
}
-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);
}
-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))
return -EINVAL;
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);
}
-struct cpufreq_stats * cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time) {
- struct cpufreq_stats *ret;
-
- ret = sysfs_get_freq_stats(cpu, total_time);
- return (ret);
+struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu,
+ unsigned long long *total_time)
+{
+ return sysfs_get_freq_stats(cpu, total_time);
}
-void cpufreq_put_stats(struct cpufreq_stats *any) {
+void cpufreq_put_stats(struct cpufreq_stats *any)
+{
struct cpufreq_stats *tmp, *next;
if (!any)
@@ -183,8 +202,7 @@ void cpufreq_put_stats(struct cpufreq_stats *any) {
}
}
-unsigned long cpufreq_get_transitions(unsigned int cpu) {
- unsigned long ret = sysfs_get_freq_transitions(cpu);
-
- return (ret);
+unsigned long cpufreq_get_transitions(unsigned int cpu)
+{
+ return sysfs_get_freq_transitions(cpu);
}