Commit 29464f28 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] checkpatch cleanups for cpufreq core

Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 6072ace4
...@@ -104,7 +104,8 @@ EXPORT_SYMBOL_GPL(unlock_policy_rwsem_write); ...@@ -104,7 +104,8 @@ EXPORT_SYMBOL_GPL(unlock_policy_rwsem_write);
/* internal prototypes */ /* internal prototypes */
static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); static int __cpufreq_governor(struct cpufreq_policy *policy,
unsigned int event);
static unsigned int __cpufreq_get(unsigned int cpu); static unsigned int __cpufreq_get(unsigned int cpu);
static void handle_update(struct work_struct *work); static void handle_update(struct work_struct *work);
...@@ -128,7 +129,7 @@ static int __init init_cpufreq_transition_notifier_list(void) ...@@ -128,7 +129,7 @@ static int __init init_cpufreq_transition_notifier_list(void)
pure_initcall(init_cpufreq_transition_notifier_list); pure_initcall(init_cpufreq_transition_notifier_list);
static LIST_HEAD(cpufreq_governor_list); static LIST_HEAD(cpufreq_governor_list);
static DEFINE_MUTEX (cpufreq_governor_mutex); static DEFINE_MUTEX(cpufreq_governor_mutex);
struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
{ {
...@@ -371,7 +372,7 @@ static struct cpufreq_governor *__find_governor(const char *str_governor) ...@@ -371,7 +372,7 @@ static struct cpufreq_governor *__find_governor(const char *str_governor)
struct cpufreq_governor *t; struct cpufreq_governor *t;
list_for_each_entry(t, &cpufreq_governor_list, governor_list) list_for_each_entry(t, &cpufreq_governor_list, governor_list)
if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) if (!strnicmp(str_governor, t->name, CPUFREQ_NAME_LEN))
return t; return t;
return NULL; return NULL;
...@@ -429,15 +430,11 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, ...@@ -429,15 +430,11 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
mutex_unlock(&cpufreq_governor_mutex); mutex_unlock(&cpufreq_governor_mutex);
} }
out: out:
return err; return err;
} }
/* drivers/base/cpu.c */
extern struct sysdev_class cpu_sysdev_class;
/** /**
* cpufreq_per_cpu_attr_read() / show_##file_name() - * cpufreq_per_cpu_attr_read() / show_##file_name() -
* print out cpufreq information * print out cpufreq information
...@@ -450,7 +447,7 @@ extern struct sysdev_class cpu_sysdev_class; ...@@ -450,7 +447,7 @@ extern struct sysdev_class cpu_sysdev_class;
static ssize_t show_##file_name \ static ssize_t show_##file_name \
(struct cpufreq_policy *policy, char *buf) \ (struct cpufreq_policy *policy, char *buf) \
{ \ { \
return sprintf (buf, "%u\n", policy->object); \ return sprintf(buf, "%u\n", policy->object); \
} }
show_one(cpuinfo_min_freq, cpuinfo.min_freq); show_one(cpuinfo_min_freq, cpuinfo.min_freq);
...@@ -476,7 +473,7 @@ static ssize_t store_##file_name \ ...@@ -476,7 +473,7 @@ static ssize_t store_##file_name \
if (ret) \ if (ret) \
return -EINVAL; \ return -EINVAL; \
\ \
ret = sscanf (buf, "%u", &new_policy.object); \ ret = sscanf(buf, "%u", &new_policy.object); \
if (ret != 1) \ if (ret != 1) \
return -EINVAL; \ return -EINVAL; \
\ \
...@@ -486,8 +483,8 @@ static ssize_t store_##file_name \ ...@@ -486,8 +483,8 @@ static ssize_t store_##file_name \
return ret ? ret : count; \ return ret ? ret : count; \
} }
store_one(scaling_min_freq,min); store_one(scaling_min_freq, min);
store_one(scaling_max_freq,max); store_one(scaling_max_freq, max);
/** /**
* show_cpuinfo_cur_freq - current CPU frequency as detected by hardware * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware
...@@ -507,12 +504,13 @@ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, ...@@ -507,12 +504,13 @@ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy,
*/ */
static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
{ {
if(policy->policy == CPUFREQ_POLICY_POWERSAVE) if (policy->policy == CPUFREQ_POLICY_POWERSAVE)
return sprintf(buf, "powersave\n"); return sprintf(buf, "powersave\n");
else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE)
return sprintf(buf, "performance\n"); return sprintf(buf, "performance\n");
else if (policy->governor) else if (policy->governor)
return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", policy->governor->name); return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n",
policy->governor->name);
return -EINVAL; return -EINVAL;
} }
...@@ -531,7 +529,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, ...@@ -531,7 +529,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
if (ret) if (ret)
return ret; return ret;
ret = sscanf (buf, "%15s", str_governor); ret = sscanf(buf, "%15s", str_governor);
if (ret != 1) if (ret != 1)
return -EINVAL; return -EINVAL;
...@@ -575,7 +573,8 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, ...@@ -575,7 +573,8 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy,
} }
list_for_each_entry(t, &cpufreq_governor_list, governor_list) { list_for_each_entry(t, &cpufreq_governor_list, governor_list) {
if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) - (CPUFREQ_NAME_LEN + 2))) if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char))
- (CPUFREQ_NAME_LEN + 2)))
goto out; goto out;
i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name);
} }
...@@ -684,10 +683,10 @@ static struct attribute *default_attrs[] = { ...@@ -684,10 +683,10 @@ static struct attribute *default_attrs[] = {
NULL NULL
}; };
#define to_policy(k) container_of(k,struct cpufreq_policy,kobj) #define to_policy(k) container_of(k, struct cpufreq_policy, kobj)
#define to_attr(a) container_of(a,struct freq_attr,attr) #define to_attr(a) container_of(a, struct freq_attr, attr)
static ssize_t show(struct kobject *kobj, struct attribute *attr ,char *buf) static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf)
{ {
struct cpufreq_policy *policy = to_policy(kobj); struct cpufreq_policy *policy = to_policy(kobj);
struct freq_attr *fattr = to_attr(attr); struct freq_attr *fattr = to_attr(attr);
...@@ -858,10 +857,10 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -858,10 +857,10 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
if (cpu == j) if (cpu == j)
continue; continue;
/* check for existing affected CPUs. They may not be aware /* Check for existing affected CPUs.
* of it due to CPU Hotplug. * They may not be aware of it due to CPU Hotplug.
*/ */
managed_policy = cpufreq_cpu_get(j); // FIXME: Where is this released? What about error paths? managed_policy = cpufreq_cpu_get(j); /* FIXME: Where is this released? What about error paths? */
if (unlikely(managed_policy)) { if (unlikely(managed_policy)) {
/* Set proper policy_cpu */ /* Set proper policy_cpu */
...@@ -1142,8 +1141,8 @@ static void handle_update(struct work_struct *work) ...@@ -1142,8 +1141,8 @@ static void handle_update(struct work_struct *work)
* @old_freq: CPU frequency the kernel thinks the CPU runs at * @old_freq: CPU frequency the kernel thinks the CPU runs at
* @new_freq: CPU frequency the CPU actually runs at * @new_freq: CPU frequency the CPU actually runs at
* *
* We adjust to current frequency first, and need to clean up later. So either call * We adjust to current frequency first, and need to clean up later.
* to cpufreq_update_policy() or schedule handle_update()). * So either call to cpufreq_update_policy() or schedule handle_update()).
*/ */
static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq,
unsigned int new_freq) unsigned int new_freq)
...@@ -1625,7 +1624,8 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); ...@@ -1625,7 +1624,8 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor);
/** /**
* cpufreq_get_policy - get the current cpufreq_policy * cpufreq_get_policy - get the current cpufreq_policy
* @policy: struct cpufreq_policy into which the current cpufreq_policy is written * @policy: struct cpufreq_policy into which the current cpufreq_policy
* is written
* *
* Reads the current cpufreq policy. * Reads the current cpufreq policy.
*/ */
......
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