From 32ee8c3e470d86588b51dc42ed01e85c5fa0f180 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Tue, 28 Feb 2006 00:43:23 -0500 Subject: [CPUFREQ] Lots of whitespace & CodingStyle cleanup. Signed-off-by: Dave Jones --- drivers/cpufreq/cpufreq.c | 54 +++++++++++----------- drivers/cpufreq/cpufreq_ondemand.c | 86 +++++++++++++++++------------------ drivers/cpufreq/cpufreq_performance.c | 2 +- drivers/cpufreq/cpufreq_powersave.c | 2 +- drivers/cpufreq/cpufreq_stats.c | 6 +-- drivers/cpufreq/cpufreq_userspace.c | 12 ++--- drivers/cpufreq/freq_table.c | 12 ++--- 7 files changed, 86 insertions(+), 88 deletions(-) (limited to 'drivers/cpufreq') diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9582de1c9ca..cb7d6e0db75 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -5,7 +5,7 @@ * (C) 2002 - 2003 Dominik Brodowski * * Oct 2005 - Ashok Raj - * Added handling for CPU hotplug + * Added handling for CPU hotplug * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -44,8 +44,8 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) static void handle_update(void *data); /** - * Two notifier lists: the "policy" list is involved in the - * validation process for a new CPU frequency policy; the + * Two notifier lists: the "policy" list is involved in the + * validation process for a new CPU frequency policy; the * "transition" list for kernel code that needs to handle * changes to devices when the CPU clock speed changes. * The mutex locks both lists. @@ -151,7 +151,7 @@ void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt va_list args; unsigned int len; unsigned long flags; - + WARN_ON(!prefix); if (type & debug) { spin_lock_irqsave(&disable_ratelimit_lock, flags); @@ -198,7 +198,7 @@ static inline void cpufreq_debug_disable_ratelimit(void) { return; } * * This function alters the system "loops_per_jiffy" for the clock * speed change. Note that loops_per_jiffy cannot be updated on SMP - * systems as each CPU might be scaled differently. So, use the arch + * systems as each CPU might be scaled differently. So, use the arch * per-CPU loops_per_jiffy value wherever possible. */ #ifndef CONFIG_SMP @@ -233,7 +233,7 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { * * This function calls the transition notifiers and the "adjust_jiffies" * function. It is called twice on all CPU frequency changes that have - * external effects. + * external effects. */ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) { @@ -251,7 +251,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) switch (state) { case CPUFREQ_PRECHANGE: - /* detect if the driver reported a value as "old frequency" + /* detect if the driver reported a value as "old frequency" * which is not equal to what the cpufreq core thinks is * "old frequency". */ @@ -335,11 +335,11 @@ extern struct sysdev_class cpu_sysdev_class; * "unsigned int". */ -#define show_one(file_name, object) \ -static ssize_t show_##file_name \ -(struct cpufreq_policy * policy, char *buf) \ -{ \ - return sprintf (buf, "%u\n", policy->object); \ +#define show_one(file_name, object) \ +static ssize_t show_##file_name \ +(struct cpufreq_policy * policy, char *buf) \ +{ \ + return sprintf (buf, "%u\n", policy->object); \ } show_one(cpuinfo_min_freq, cpuinfo.min_freq); @@ -404,8 +404,8 @@ static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf) /** * store_scaling_governor - store policy for the specified CPU */ -static ssize_t store_scaling_governor (struct cpufreq_policy * policy, - const char *buf, size_t count) +static ssize_t store_scaling_governor (struct cpufreq_policy * policy, + const char *buf, size_t count) { unsigned int ret = -EINVAL; char str_governor[16]; @@ -528,7 +528,7 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) return ret; } -static ssize_t store(struct kobject * kobj, struct attribute * attr, +static ssize_t store(struct kobject * kobj, struct attribute * attr, const char * buf, size_t count) { struct cpufreq_policy * policy = to_policy(kobj); @@ -564,7 +564,7 @@ static struct kobj_type ktype_cpufreq = { /** * cpufreq_add_dev - add a CPU device * - * Adds the cpufreq interface for a CPU device. + * Adds the cpufreq interface for a CPU device. */ static int cpufreq_add_dev (struct sys_device * sys_dev) { @@ -724,7 +724,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) #ifdef CONFIG_SMP /* if this isn't the CPU which is the parent of the kobj, we - * only need to unlink, put and exit + * only need to unlink, put and exit */ if (unlikely(cpu != data->cpu)) { dprintk("removing link\n"); @@ -740,7 +740,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) if (!kobject_get(&data->kobj)) { spin_unlock_irqrestore(&cpufreq_driver_lock, flags); cpufreq_debug_enable_ratelimit(); - return -EFAULT; + return -EFAULT; } #ifdef CONFIG_SMP @@ -783,7 +783,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) kobject_put(&data->kobj); /* we need to make sure that the underlying kobj is actually - * not referenced anymore by anybody before we proceed with + * not referenced anymore by anybody before we proceed with * unloading. */ dprintk("waiting for dropping of refcount\n"); @@ -831,7 +831,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne } -/** +/** * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur * @cpu: CPU number * @@ -855,7 +855,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu) EXPORT_SYMBOL(cpufreq_quick_get); -/** +/** * cpufreq_get - get the current CPU frequency (in kHz) * @cpu: CPU number * @@ -1072,7 +1072,7 @@ static struct sysdev_driver cpufreq_sysdev_driver = { * @nb: notifier function to register * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER * - * Add a driver to one of two lists: either a list of drivers that + * Add a driver to one of two lists: either a list of drivers that * are notified about clock rate changes (once before and once after * the transition), or a list of drivers that are notified about * changes in cpufreq policy. @@ -1225,7 +1225,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor) return -EINVAL; mutex_lock(&cpufreq_governor_mutex); - + list_for_each_entry(t, &cpufreq_governor_list, governor_list) { if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { mutex_unlock(&cpufreq_governor_mutex); @@ -1234,7 +1234,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor) } list_add(&governor->governor_list, &cpufreq_governor_list); - mutex_unlock(&cpufreq_governor_mutex); + mutex_unlock(&cpufreq_governor_mutex); return 0; } EXPORT_SYMBOL_GPL(cpufreq_register_governor); @@ -1497,9 +1497,9 @@ static struct notifier_block cpufreq_cpu_notifier = * @driver_data: A struct cpufreq_driver containing the values# * submitted by the CPU Frequency driver. * - * Registers a CPU Frequency driver to this core code. This code + * Registers a CPU Frequency driver to this core code. This code * returns zero on success, -EBUSY when another driver got here first - * (and isn't unregistered in the meantime). + * (and isn't unregistered in the meantime). * */ int cpufreq_register_driver(struct cpufreq_driver *driver_data) @@ -1560,7 +1560,7 @@ EXPORT_SYMBOL_GPL(cpufreq_register_driver); /** * cpufreq_unregister_driver - unregister the current CPUFreq driver * - * Unregister the current CPUFreq driver. Only call this if you have + * Unregister the current CPUFreq driver. Only call this if you have * the right to do so, i.e. if you have succeeded in initialising before! * Returns zero if successful, and -EINVAL if the cpufreq_driver is * currently not initialised. diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 9ee9411f186..69aa1db8336 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -38,17 +38,17 @@ #define MIN_FREQUENCY_UP_THRESHOLD (11) #define MAX_FREQUENCY_UP_THRESHOLD (100) -/* - * The polling frequency of this governor depends on the capability of +/* + * The polling frequency of this governor depends on the capability of * the processor. Default polling frequency is 1000 times the transition - * latency of the processor. The governor will work on any processor with - * transition latency <= 10mS, using appropriate sampling + * latency of the processor. The governor will work on any processor with + * transition latency <= 10mS, using appropriate sampling * rate. * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL) * this governor will not work. * All times here are in uS. */ -static unsigned int def_sampling_rate; +static unsigned int def_sampling_rate; #define MIN_SAMPLING_RATE_RATIO (2) /* for correct statistics, we need at least 10 ticks between each measure */ #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) @@ -62,28 +62,28 @@ static unsigned int def_sampling_rate; static void do_dbs_timer(void *data); struct cpu_dbs_info_s { - struct cpufreq_policy *cur_policy; - unsigned int prev_cpu_idle_up; - unsigned int prev_cpu_idle_down; - unsigned int enable; + struct cpufreq_policy *cur_policy; + unsigned int prev_cpu_idle_up; + unsigned int prev_cpu_idle_down; + unsigned int enable; }; static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); static unsigned int dbs_enable; /* number of CPUs using this policy */ -static DEFINE_MUTEX (dbs_mutex); +static DEFINE_MUTEX (dbs_mutex); static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); struct dbs_tuners { - unsigned int sampling_rate; - unsigned int sampling_down_factor; - unsigned int up_threshold; - unsigned int ignore_nice; + unsigned int sampling_rate; + unsigned int sampling_down_factor; + unsigned int up_threshold; + unsigned int ignore_nice; }; static struct dbs_tuners dbs_tuners_ins = { - .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, - .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, + .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, + .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, }; static inline unsigned int get_cpu_idle_time(unsigned int cpu) @@ -106,8 +106,8 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf) return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); } -#define define_one_ro(_name) \ -static struct freq_attr _name = \ +#define define_one_ro(_name) \ +static struct freq_attr _name = \ __ATTR(_name, 0444, show_##_name, NULL) define_one_ro(sampling_rate_max); @@ -125,7 +125,7 @@ show_one(sampling_down_factor, sampling_down_factor); show_one(up_threshold, up_threshold); show_one(ignore_nice_load, ignore_nice); -static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, +static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, const char *buf, size_t count) { unsigned int input; @@ -144,7 +144,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, return count; } -static ssize_t store_sampling_rate(struct cpufreq_policy *unused, +static ssize_t store_sampling_rate(struct cpufreq_policy *unused, const char *buf, size_t count) { unsigned int input; @@ -163,7 +163,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, return count; } -static ssize_t store_up_threshold(struct cpufreq_policy *unused, +static ssize_t store_up_threshold(struct cpufreq_policy *unused, const char *buf, size_t count) { unsigned int input; @@ -171,7 +171,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, ret = sscanf (buf, "%u", &input); mutex_lock(&dbs_mutex); - if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || + if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || input < MIN_FREQUENCY_UP_THRESHOLD) { mutex_unlock(&dbs_mutex); return -EINVAL; @@ -190,14 +190,14 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, int ret; unsigned int j; - + ret = sscanf (buf, "%u", &input); if ( ret != 1 ) return -EINVAL; if ( input > 1 ) input = 1; - + mutex_lock(&dbs_mutex); if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ mutex_unlock(&dbs_mutex); @@ -259,16 +259,16 @@ static void dbs_check_cpu(int cpu) return; policy = this_dbs_info->cur_policy; - /* + /* * Every sampling_rate, we check, if current idle time is less * than 20% (default), then we try to increase frequency * Every sampling_rate*sampling_down_factor, we look for a the lowest * frequency which can sustain the load while keeping idle time over * 30%. If such a frequency exist, we try to decrease to this frequency. * - * Any frequency increase takes it to the maximum frequency. - * Frequency reduction happens at minimum steps of - * 5% (default) of current frequency + * Any frequency increase takes it to the maximum frequency. + * Frequency reduction happens at minimum steps of + * 5% (default) of current frequency */ /* Check for frequency increase */ @@ -298,14 +298,14 @@ static void dbs_check_cpu(int cpu) struct cpu_dbs_info_s *j_dbs_info; j_dbs_info = &per_cpu(cpu_dbs_info, j); - j_dbs_info->prev_cpu_idle_down = + j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; } /* if we are already at full speed then break out early */ if (policy->cur == policy->max) return; - - __cpufreq_driver_target(policy, policy->max, + + __cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H); return; } @@ -347,7 +347,7 @@ static void dbs_check_cpu(int cpu) * policy. To be safe, we focus 10 points under the threshold. */ freq_next = ((total_ticks - idle_ticks) * 100) / total_ticks; - freq_next = (freq_next * policy->cur) / + freq_next = (freq_next * policy->cur) / (dbs_tuners_ins.up_threshold - 10); if (freq_next <= ((policy->cur * 95) / 100)) @@ -355,15 +355,15 @@ static void dbs_check_cpu(int cpu) } static void do_dbs_timer(void *data) -{ +{ int i; mutex_lock(&dbs_mutex); for_each_online_cpu(i) dbs_check_cpu(i); - schedule_delayed_work(&dbs_work, + schedule_delayed_work(&dbs_work, usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); mutex_unlock(&dbs_mutex); -} +} static inline void dbs_timer_init(void) { @@ -390,7 +390,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, switch (event) { case CPUFREQ_GOV_START: - if ((!cpu_online(cpu)) || + if ((!cpu_online(cpu)) || (!policy->cur)) return -EINVAL; @@ -399,13 +399,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, return -EINVAL; if (this_dbs_info->enable) /* Already enabled */ break; - + mutex_lock(&dbs_mutex); for_each_cpu_mask(j, policy->cpus) { struct cpu_dbs_info_s *j_dbs_info; j_dbs_info = &per_cpu(cpu_dbs_info, j); j_dbs_info->cur_policy = policy; - + j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; @@ -435,7 +435,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, dbs_timer_init(); } - + mutex_unlock(&dbs_mutex); break; @@ -448,9 +448,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, * Stop the timerschedule work, when this governor * is used for first time */ - if (dbs_enable == 0) + if (dbs_enable == 0) dbs_timer_exit(); - + mutex_unlock(&dbs_mutex); break; @@ -460,11 +460,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, if (policy->max < this_dbs_info->cur_policy->cur) __cpufreq_driver_target( this_dbs_info->cur_policy, - policy->max, CPUFREQ_RELATION_H); + policy->max, CPUFREQ_RELATION_H); else if (policy->min > this_dbs_info->cur_policy->cur) __cpufreq_driver_target( this_dbs_info->cur_policy, - policy->min, CPUFREQ_RELATION_L); + policy->min, CPUFREQ_RELATION_L); mutex_unlock(&dbs_mutex); break; } diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c index 8d536b40deb..de91e3371ef 100644 --- a/drivers/cpufreq/cpufreq_performance.c +++ b/drivers/cpufreq/cpufreq_performance.c @@ -32,7 +32,7 @@ static int cpufreq_governor_performance(struct cpufreq_policy *policy, } return 0; } - + struct cpufreq_governor cpufreq_gov_performance = { .name = "performance", .governor = cpufreq_governor_performance, diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c index c85edda7feb..0a2596044e6 100644 --- a/drivers/cpufreq/cpufreq_powersave.c +++ b/drivers/cpufreq/cpufreq_powersave.c @@ -31,7 +31,7 @@ static int cpufreq_governor_powersave(struct cpufreq_policy *policy, } return 0; } - + static struct cpufreq_governor cpufreq_gov_powersave = { .name = "powersave", .governor = cpufreq_governor_powersave, diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 0bddb8e694d..c25bdb7aec5 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -2,7 +2,7 @@ * drivers/cpufreq/cpufreq_stats.c * * Copyright (C) 2003-2004 Venkatesh Pallipadi . - * (C) 2004 Zou Nan hai . + * (C) 2004 Zou Nan hai . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -90,7 +90,7 @@ show_time_in_state(struct cpufreq_policy *policy, char *buf) return 0; cpufreq_stats_update(stat->cpu); for (i = 0; i < stat->state_num; i++) { - len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i], + len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i], (unsigned long long)cputime64_to_clock_t(stat->time_in_state[i])); } return len; @@ -171,7 +171,7 @@ cpufreq_stats_free_table (unsigned int cpu) { struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); - if (policy && policy->cpu == cpu) + if (policy && policy->cpu == cpu) sysfs_remove_group(&policy->kobj, &stats_attr_group); if (stat) { kfree(stat->time_in_state); diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 92a0be22a2a..071ee4f1bbf 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -41,7 +41,7 @@ static DEFINE_MUTEX (userspace_mutex); #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg) /* keep track of frequency transitions */ -static int +static int userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) { @@ -58,7 +58,7 @@ static struct notifier_block userspace_cpufreq_notifier_block = { }; -/** +/** * cpufreq_set - set the CPU frequency * @freq: target frequency in kHz * @cpu: CPU for which the frequency is to be set @@ -103,8 +103,8 @@ static ssize_t show_speed (struct cpufreq_policy *policy, char *buf) return sprintf (buf, "%u\n", cpu_cur_freq[policy->cpu]); } -static ssize_t -store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) +static ssize_t +store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) { unsigned int freq = 0; unsigned int ret; @@ -118,7 +118,7 @@ store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) return count; } -static struct freq_attr freq_attr_scaling_setspeed = +static struct freq_attr freq_attr_scaling_setspeed = { .attr = { .name = "scaling_setspeed", .mode = 0644, .owner = THIS_MODULE }, .show = show_speed, @@ -135,7 +135,7 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, return -EINVAL; BUG_ON(!policy->cur); mutex_lock(&userspace_mutex); - cpu_is_managed[cpu] = 1; + cpu_is_managed[cpu] = 1; cpu_min_freq[cpu] = policy->min; cpu_max_freq[cpu] = policy->max; cpu_cur_freq[cpu] = policy->cur; diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index ba460bdea60..a4818ce8891 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -59,9 +59,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, if (!cpu_online(policy->cpu)) return -EINVAL; - cpufreq_verify_within_limits(policy, - policy->cpuinfo.min_freq, - policy->cpuinfo.max_freq); + cpufreq_verify_within_limits(policy, + policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { unsigned int freq = table[i].frequency; @@ -76,9 +75,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, if (!count) policy->max = next_larger; - cpufreq_verify_within_limits(policy, - policy->cpuinfo.min_freq, - policy->cpuinfo.max_freq); + cpufreq_verify_within_limits(policy, + policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); dprintk("verification lead to (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); @@ -199,7 +197,7 @@ EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); * if you use these, you must assure that the frequency table is valid * all the time between get_attr and put_attr! */ -void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, +void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, unsigned int cpu) { dprintk("setting show_table for cpu %u to %p\n", cpu, table); -- cgit v1.2.3