aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-06-19 04:49:33 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-20 19:06:34 -0400
commitbb176f7d038fee4d46b3293e64e173bfb05ab7b5 (patch)
tree3083ebddffa88ffe7e4889dc1ba618bb55c89953
parent95731ebb114c5f0c028459388560fc2a72fe5049 (diff)
cpufreq: Fix minor formatting issues
There were a few noticeable formatting issues in core cpufreq code. This cleans them up to make code look better. The changes include: - Whitespace cleanup. - Rearrangements of code. - Multiline comments fixes. - Formatting changes to fit 80 columns. Copyright information in cpufreq.c is also updated to include my name for 2013. [rjw: Changelog] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq.c63
-rw-r--r--drivers/cpufreq/cpufreq_governor.h4
-rw-r--r--drivers/cpufreq/cpufreq_performance.c4
-rw-r--r--drivers/cpufreq/cpufreq_powersave.c6
-rw-r--r--drivers/cpufreq/cpufreq_stats.c4
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c4
-rw-r--r--include/linux/cpufreq.h41
7 files changed, 53 insertions, 73 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 43cf60832468..075edeff358c 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * (C) 2013 Viresh Kumar <viresh.kumar@linaro.org>
6 * 7 *
7 * Oct 2005 - Ashok Raj <ashok.raj@intel.com> 8 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>
8 * Added handling for CPU hotplug 9 * Added handling for CPU hotplug
@@ -12,7 +13,6 @@
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 14 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation. 15 * published by the Free Software Foundation.
15 *
16 */ 16 */
17 17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -44,12 +44,13 @@
44 */ 44 */
45static struct cpufreq_driver *cpufreq_driver; 45static struct cpufreq_driver *cpufreq_driver;
46static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); 46static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
47static DEFINE_RWLOCK(cpufreq_driver_lock);
48static DEFINE_MUTEX(cpufreq_governor_lock);
49
47#ifdef CONFIG_HOTPLUG_CPU 50#ifdef CONFIG_HOTPLUG_CPU
48/* This one keeps track of the previously set governor of a removed CPU */ 51/* This one keeps track of the previously set governor of a removed CPU */
49static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); 52static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
50#endif 53#endif
51static DEFINE_RWLOCK(cpufreq_driver_lock);
52static DEFINE_MUTEX(cpufreq_governor_lock);
53 54
54/* 55/*
55 * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure 56 * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
@@ -199,7 +200,6 @@ static struct cpufreq_policy *__cpufreq_cpu_get(unsigned int cpu, bool sysfs)
199 if (!try_module_get(cpufreq_driver->owner)) 200 if (!try_module_get(cpufreq_driver->owner))
200 goto err_out_unlock; 201 goto err_out_unlock;
201 202
202
203 /* get the CPU */ 203 /* get the CPU */
204 data = per_cpu(cpufreq_cpu_data, cpu); 204 data = per_cpu(cpufreq_cpu_data, cpu);
205 205
@@ -269,7 +269,7 @@ static void cpufreq_cpu_put_sysfs(struct cpufreq_policy *data)
269 */ 269 */
270#ifndef CONFIG_SMP 270#ifndef CONFIG_SMP
271static unsigned long l_p_j_ref; 271static unsigned long l_p_j_ref;
272static unsigned int l_p_j_ref_freq; 272static unsigned int l_p_j_ref_freq;
273 273
274static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) 274static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
275{ 275{
@@ -282,7 +282,7 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
282 pr_debug("saving %lu as reference value for loops_per_jiffy; " 282 pr_debug("saving %lu as reference value for loops_per_jiffy; "
283 "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); 283 "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq);
284 } 284 }
285 if ((val == CPUFREQ_POSTCHANGE && ci->old != ci->new) || 285 if ((val == CPUFREQ_POSTCHANGE && ci->old != ci->new) ||
286 (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { 286 (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
287 loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, 287 loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq,
288 ci->new); 288 ci->new);
@@ -297,7 +297,6 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
297} 297}
298#endif 298#endif
299 299
300
301void __cpufreq_notify_transition(struct cpufreq_policy *policy, 300void __cpufreq_notify_transition(struct cpufreq_policy *policy,
302 struct cpufreq_freqs *freqs, unsigned int state) 301 struct cpufreq_freqs *freqs, unsigned int state)
303{ 302{
@@ -343,6 +342,7 @@ void __cpufreq_notify_transition(struct cpufreq_policy *policy,
343 break; 342 break;
344 } 343 }
345} 344}
345
346/** 346/**
347 * cpufreq_notify_transition - call notifier chain and adjust_jiffies 347 * cpufreq_notify_transition - call notifier chain and adjust_jiffies
348 * on frequency transition. 348 * on frequency transition.
@@ -360,7 +360,6 @@ void cpufreq_notify_transition(struct cpufreq_policy *policy,
360EXPORT_SYMBOL_GPL(cpufreq_notify_transition); 360EXPORT_SYMBOL_GPL(cpufreq_notify_transition);
361 361
362 362
363
364/********************************************************************* 363/*********************************************************************
365 * SYSFS INTERFACE * 364 * SYSFS INTERFACE *
366 *********************************************************************/ 365 *********************************************************************/
@@ -425,7 +424,6 @@ out:
425 return err; 424 return err;
426} 425}
427 426
428
429/** 427/**
430 * cpufreq_per_cpu_attr_read() / show_##file_name() - 428 * cpufreq_per_cpu_attr_read() / show_##file_name() -
431 * print out cpufreq information 429 * print out cpufreq information
@@ -490,7 +488,6 @@ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy,
490 return sprintf(buf, "%u\n", cur_freq); 488 return sprintf(buf, "%u\n", cur_freq);
491} 489}
492 490
493
494/** 491/**
495 * show_scaling_governor - show the current policy for the specified CPU 492 * show_scaling_governor - show the current policy for the specified CPU
496 */ 493 */
@@ -506,7 +503,6 @@ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
506 return -EINVAL; 503 return -EINVAL;
507} 504}
508 505
509
510/** 506/**
511 * store_scaling_governor - store policy for the specified CPU 507 * store_scaling_governor - store policy for the specified CPU
512 */ 508 */
@@ -529,8 +525,10 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
529 &new_policy.governor)) 525 &new_policy.governor))
530 return -EINVAL; 526 return -EINVAL;
531 527
532 /* Do not use cpufreq_set_policy here or the user_policy.max 528 /*
533 will be wrongly overridden */ 529 * Do not use cpufreq_set_policy here or the user_policy.max
530 * will be wrongly overridden
531 */
534 ret = __cpufreq_set_policy(policy, &new_policy); 532 ret = __cpufreq_set_policy(policy, &new_policy);
535 533
536 policy->user_policy.policy = policy->policy; 534 policy->user_policy.policy = policy->policy;
@@ -1094,7 +1092,8 @@ static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu)
1094 * Caller should already have policy_rwsem in write mode for this CPU. 1092 * Caller should already have policy_rwsem in write mode for this CPU.
1095 * This routine frees the rwsem before returning. 1093 * This routine frees the rwsem before returning.
1096 */ 1094 */
1097static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) 1095static int __cpufreq_remove_dev(struct device *dev,
1096 struct subsys_interface *sif)
1098{ 1097{
1099 unsigned int cpu = dev->id, ret, cpus; 1098 unsigned int cpu = dev->id, ret, cpus;
1100 unsigned long flags; 1099 unsigned long flags;
@@ -1201,7 +1200,6 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
1201 return 0; 1200 return 0;
1202} 1201}
1203 1202
1204
1205static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) 1203static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1206{ 1204{
1207 unsigned int cpu = dev->id; 1205 unsigned int cpu = dev->id;
@@ -1214,7 +1212,6 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1214 return retval; 1212 return retval;
1215} 1213}
1216 1214
1217
1218static void handle_update(struct work_struct *work) 1215static void handle_update(struct work_struct *work)
1219{ 1216{
1220 struct cpufreq_policy *policy = 1217 struct cpufreq_policy *policy =
@@ -1225,7 +1222,8 @@ static void handle_update(struct work_struct *work)
1225} 1222}
1226 1223
1227/** 1224/**
1228 * cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're in deep trouble. 1225 * cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're
1226 * in deep trouble.
1229 * @cpu: cpu number 1227 * @cpu: cpu number
1230 * @old_freq: CPU frequency the kernel thinks the CPU runs at 1228 * @old_freq: CPU frequency the kernel thinks the CPU runs at
1231 * @new_freq: CPU frequency the CPU actually runs at 1229 * @new_freq: CPU frequency the CPU actually runs at
@@ -1240,7 +1238,6 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq,
1240 struct cpufreq_freqs freqs; 1238 struct cpufreq_freqs freqs;
1241 unsigned long flags; 1239 unsigned long flags;
1242 1240
1243
1244 pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " 1241 pr_debug("Warning: CPU frequency out of sync: cpufreq and timing "
1245 "core thinks of %u, is %u kHz.\n", old_freq, new_freq); 1242 "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
1246 1243
@@ -1255,7 +1252,6 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq,
1255 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 1252 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
1256} 1253}
1257 1254
1258
1259/** 1255/**
1260 * cpufreq_quick_get - get the CPU frequency (in kHz) from policy->cur 1256 * cpufreq_quick_get - get the CPU frequency (in kHz) from policy->cur
1261 * @cpu: CPU number 1257 * @cpu: CPU number
@@ -1301,7 +1297,6 @@ unsigned int cpufreq_quick_get_max(unsigned int cpu)
1301} 1297}
1302EXPORT_SYMBOL(cpufreq_quick_get_max); 1298EXPORT_SYMBOL(cpufreq_quick_get_max);
1303 1299
1304
1305static unsigned int __cpufreq_get(unsigned int cpu) 1300static unsigned int __cpufreq_get(unsigned int cpu)
1306{ 1301{
1307 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); 1302 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
@@ -1360,7 +1355,6 @@ static struct subsys_interface cpufreq_interface = {
1360 .remove_dev = cpufreq_remove_dev, 1355 .remove_dev = cpufreq_remove_dev,
1361}; 1356};
1362 1357
1363
1364/** 1358/**
1365 * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. 1359 * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
1366 * 1360 *
@@ -1497,11 +1491,10 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
1497} 1491}
1498EXPORT_SYMBOL(cpufreq_register_notifier); 1492EXPORT_SYMBOL(cpufreq_register_notifier);
1499 1493
1500
1501/** 1494/**
1502 * cpufreq_unregister_notifier - unregister a driver with cpufreq 1495 * cpufreq_unregister_notifier - unregister a driver with cpufreq
1503 * @nb: notifier block to be unregistered 1496 * @nb: notifier block to be unregistered
1504 * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER 1497 * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER
1505 * 1498 *
1506 * Remove a driver from the CPU frequency notifier list. 1499 * Remove a driver from the CPU frequency notifier list.
1507 * 1500 *
@@ -1537,7 +1530,6 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier);
1537 * GOVERNORS * 1530 * GOVERNORS *
1538 *********************************************************************/ 1531 *********************************************************************/
1539 1532
1540
1541int __cpufreq_driver_target(struct cpufreq_policy *policy, 1533int __cpufreq_driver_target(struct cpufreq_policy *policy,
1542 unsigned int target_freq, 1534 unsigned int target_freq,
1543 unsigned int relation) 1535 unsigned int relation)
@@ -1678,7 +1670,6 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
1678 return ret; 1670 return ret;
1679} 1671}
1680 1672
1681
1682int cpufreq_register_governor(struct cpufreq_governor *governor) 1673int cpufreq_register_governor(struct cpufreq_governor *governor)
1683{ 1674{
1684 int err; 1675 int err;
@@ -1703,7 +1694,6 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
1703} 1694}
1704EXPORT_SYMBOL_GPL(cpufreq_register_governor); 1695EXPORT_SYMBOL_GPL(cpufreq_register_governor);
1705 1696
1706
1707void cpufreq_unregister_governor(struct cpufreq_governor *governor) 1697void cpufreq_unregister_governor(struct cpufreq_governor *governor)
1708{ 1698{
1709#ifdef CONFIG_HOTPLUG_CPU 1699#ifdef CONFIG_HOTPLUG_CPU
@@ -1733,7 +1723,6 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor)
1733EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); 1723EXPORT_SYMBOL_GPL(cpufreq_unregister_governor);
1734 1724
1735 1725
1736
1737/********************************************************************* 1726/*********************************************************************
1738 * POLICY INTERFACE * 1727 * POLICY INTERFACE *
1739 *********************************************************************/ 1728 *********************************************************************/
@@ -1762,7 +1751,6 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
1762} 1751}
1763EXPORT_SYMBOL(cpufreq_get_policy); 1752EXPORT_SYMBOL(cpufreq_get_policy);
1764 1753
1765
1766/* 1754/*
1767 * data : current policy. 1755 * data : current policy.
1768 * policy : policy to be set. 1756 * policy : policy to be set.
@@ -1796,8 +1784,10 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
1796 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 1784 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
1797 CPUFREQ_INCOMPATIBLE, policy); 1785 CPUFREQ_INCOMPATIBLE, policy);
1798 1786
1799 /* verify the cpu speed can be set within this limit, 1787 /*
1800 which might be different to the first one */ 1788 * verify the cpu speed can be set within this limit, which might be
1789 * different to the first one
1790 */
1801 ret = cpufreq_driver->verify(policy); 1791 ret = cpufreq_driver->verify(policy);
1802 if (ret) 1792 if (ret)
1803 goto error_out; 1793 goto error_out;
@@ -1899,8 +1889,10 @@ int cpufreq_update_policy(unsigned int cpu)
1899 policy.policy = data->user_policy.policy; 1889 policy.policy = data->user_policy.policy;
1900 policy.governor = data->user_policy.governor; 1890 policy.governor = data->user_policy.governor;
1901 1891
1902 /* BIOS might change freq behind our back 1892 /*
1903 -> ask driver for current freq and notify governors about a change */ 1893 * BIOS might change freq behind our back
1894 * -> ask driver for current freq and notify governors about a change
1895 */
1904 if (cpufreq_driver->get) { 1896 if (cpufreq_driver->get) {
1905 policy.cur = cpufreq_driver->get(cpu); 1897 policy.cur = cpufreq_driver->get(cpu);
1906 if (!data->cur) { 1898 if (!data->cur) {
@@ -1949,7 +1941,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1949} 1941}
1950 1942
1951static struct notifier_block __refdata cpufreq_cpu_notifier = { 1943static struct notifier_block __refdata cpufreq_cpu_notifier = {
1952 .notifier_call = cpufreq_cpu_callback, 1944 .notifier_call = cpufreq_cpu_callback,
1953}; 1945};
1954 1946
1955/********************************************************************* 1947/*********************************************************************
@@ -1961,7 +1953,7 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = {
1961 * @driver_data: A struct cpufreq_driver containing the values# 1953 * @driver_data: A struct cpufreq_driver containing the values#
1962 * submitted by the CPU Frequency driver. 1954 * submitted by the CPU Frequency driver.
1963 * 1955 *
1964 * Registers a CPU Frequency driver to this core code. This code 1956 * Registers a CPU Frequency driver to this core code. This code
1965 * returns zero on success, -EBUSY when another driver got here first 1957 * returns zero on success, -EBUSY when another driver got here first
1966 * (and isn't unregistered in the meantime). 1958 * (and isn't unregistered in the meantime).
1967 * 1959 *
@@ -2028,11 +2020,10 @@ err_null_driver:
2028} 2020}
2029EXPORT_SYMBOL_GPL(cpufreq_register_driver); 2021EXPORT_SYMBOL_GPL(cpufreq_register_driver);
2030 2022
2031
2032/** 2023/**
2033 * cpufreq_unregister_driver - unregister the current CPUFreq driver 2024 * cpufreq_unregister_driver - unregister the current CPUFreq driver
2034 * 2025 *
2035 * Unregister the current CPUFreq driver. Only call this if you have 2026 * Unregister the current CPUFreq driver. Only call this if you have
2036 * the right to do so, i.e. if you have succeeded in initialising before! 2027 * the right to do so, i.e. if you have succeeded in initialising before!
2037 * Returns zero if successful, and -EINVAL if the cpufreq_driver is 2028 * Returns zero if successful, and -EINVAL if the cpufreq_driver is
2038 * currently not initialised. 2029 * currently not initialised.
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index e7bbf767380d..6663ec3b3056 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -81,7 +81,7 @@ static ssize_t show_##file_name##_gov_sys \
81 return sprintf(buf, "%u\n", tuners->file_name); \ 81 return sprintf(buf, "%u\n", tuners->file_name); \
82} \ 82} \
83 \ 83 \
84static ssize_t show_##file_name##_gov_pol \ 84static ssize_t show_##file_name##_gov_pol \
85(struct cpufreq_policy *policy, char *buf) \ 85(struct cpufreq_policy *policy, char *buf) \
86{ \ 86{ \
87 struct dbs_data *dbs_data = policy->governor_data; \ 87 struct dbs_data *dbs_data = policy->governor_data; \
@@ -91,7 +91,7 @@ static ssize_t show_##file_name##_gov_pol \
91 91
92#define store_one(_gov, file_name) \ 92#define store_one(_gov, file_name) \
93static ssize_t store_##file_name##_gov_sys \ 93static ssize_t store_##file_name##_gov_sys \
94(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) \ 94(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) \
95{ \ 95{ \
96 struct dbs_data *dbs_data = _gov##_dbs_cdata.gdbs_data; \ 96 struct dbs_data *dbs_data = _gov##_dbs_cdata.gdbs_data; \
97 return store_##file_name(dbs_data, buf, count); \ 97 return store_##file_name(dbs_data, buf, count); \
diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c
index ceee06849b91..9fef7d6e4e6a 100644
--- a/drivers/cpufreq/cpufreq_performance.c
+++ b/drivers/cpufreq/cpufreq_performance.c
@@ -17,7 +17,6 @@
17#include <linux/cpufreq.h> 17#include <linux/cpufreq.h>
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20
21static int cpufreq_governor_performance(struct cpufreq_policy *policy, 20static int cpufreq_governor_performance(struct cpufreq_policy *policy,
22 unsigned int event) 21 unsigned int event)
23{ 22{
@@ -44,19 +43,16 @@ struct cpufreq_governor cpufreq_gov_performance = {
44 .owner = THIS_MODULE, 43 .owner = THIS_MODULE,
45}; 44};
46 45
47
48static int __init cpufreq_gov_performance_init(void) 46static int __init cpufreq_gov_performance_init(void)
49{ 47{
50 return cpufreq_register_governor(&cpufreq_gov_performance); 48 return cpufreq_register_governor(&cpufreq_gov_performance);
51} 49}
52 50
53
54static void __exit cpufreq_gov_performance_exit(void) 51static void __exit cpufreq_gov_performance_exit(void)
55{ 52{
56 cpufreq_unregister_governor(&cpufreq_gov_performance); 53 cpufreq_unregister_governor(&cpufreq_gov_performance);
57} 54}
58 55
59
60MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); 56MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
61MODULE_DESCRIPTION("CPUfreq policy governor 'performance'"); 57MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
62MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
index 2d948a171155..32109a14f5dc 100644
--- a/drivers/cpufreq/cpufreq_powersave.c
+++ b/drivers/cpufreq/cpufreq_powersave.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/cpufreq/cpufreq_powersave.c 2 * linux/drivers/cpufreq/cpufreq_powersave.c
3 * 3 *
4 * Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 4 * Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -48,13 +48,11 @@ static int __init cpufreq_gov_powersave_init(void)
48 return cpufreq_register_governor(&cpufreq_gov_powersave); 48 return cpufreq_register_governor(&cpufreq_gov_powersave);
49} 49}
50 50
51
52static void __exit cpufreq_gov_powersave_exit(void) 51static void __exit cpufreq_gov_powersave_exit(void)
53{ 52{
54 cpufreq_unregister_governor(&cpufreq_gov_powersave); 53 cpufreq_unregister_governor(&cpufreq_gov_powersave);
55} 54}
56 55
57
58MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); 56MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
59MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'"); 57MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'");
60MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index fb65decffa28..6d35caa91167 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -27,7 +27,7 @@ static spinlock_t cpufreq_stats_lock;
27struct cpufreq_stats { 27struct cpufreq_stats {
28 unsigned int cpu; 28 unsigned int cpu;
29 unsigned int total_trans; 29 unsigned int total_trans;
30 unsigned long long last_time; 30 unsigned long long last_time;
31 unsigned int max_state; 31 unsigned int max_state;
32 unsigned int state_num; 32 unsigned int state_num;
33 unsigned int last_index; 33 unsigned int last_index;
@@ -116,7 +116,7 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
116 len += snprintf(buf + len, PAGE_SIZE - len, "%9u: ", 116 len += snprintf(buf + len, PAGE_SIZE - len, "%9u: ",
117 stat->freq_table[i]); 117 stat->freq_table[i]);
118 118
119 for (j = 0; j < stat->state_num; j++) { 119 for (j = 0; j < stat->state_num; j++) {
120 if (len >= PAGE_SIZE) 120 if (len >= PAGE_SIZE)
121 break; 121 break;
122 len += snprintf(buf + len, PAGE_SIZE - len, "%9u ", 122 len += snprintf(buf + len, PAGE_SIZE - len, "%9u ",
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 5dc77b7a7594..03078090b5f7 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -55,7 +55,6 @@ static int cpufreq_set(struct cpufreq_policy *policy, unsigned int freq)
55 return ret; 55 return ret;
56} 56}
57 57
58
59static ssize_t show_speed(struct cpufreq_policy *policy, char *buf) 58static ssize_t show_speed(struct cpufreq_policy *policy, char *buf)
60{ 59{
61 return sprintf(buf, "%u\n", policy->cur); 60 return sprintf(buf, "%u\n", policy->cur);
@@ -101,7 +100,6 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
101 return rc; 100 return rc;
102} 101}
103 102
104
105#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE 103#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE
106static 104static
107#endif 105#endif
@@ -118,13 +116,11 @@ static int __init cpufreq_gov_userspace_init(void)
118 return cpufreq_register_governor(&cpufreq_gov_userspace); 116 return cpufreq_register_governor(&cpufreq_gov_userspace);
119} 117}
120 118
121
122static void __exit cpufreq_gov_userspace_exit(void) 119static void __exit cpufreq_gov_userspace_exit(void)
123{ 120{
124 cpufreq_unregister_governor(&cpufreq_gov_userspace); 121 cpufreq_unregister_governor(&cpufreq_gov_userspace);
125} 122}
126 123
127
128MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>, " 124MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>, "
129 "Russell King <rmk@arm.linux.org.uk>"); 125 "Russell King <rmk@arm.linux.org.uk>");
130MODULE_DESCRIPTION("CPUfreq policy governor 'userspace'"); 126MODULE_DESCRIPTION("CPUfreq policy governor 'userspace'");
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 125719d41285..3c7ee2f90370 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/include/linux/cpufreq.h 2 * linux/include/linux/cpufreq.h
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -26,7 +26,6 @@
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */ 26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) 27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28 28
29
30/********************************************************************* 29/*********************************************************************
31 * CPUFREQ NOTIFIER INTERFACE * 30 * CPUFREQ NOTIFIER INTERFACE *
32 *********************************************************************/ 31 *********************************************************************/
@@ -153,17 +152,18 @@ struct cpufreq_freqs {
153 u8 flags; /* flags of cpufreq_driver, see below. */ 152 u8 flags; /* flags of cpufreq_driver, see below. */
154}; 153};
155 154
156
157/** 155/**
158 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) 156 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
157 * safe)
159 * @old: old value 158 * @old: old value
160 * @div: divisor 159 * @div: divisor
161 * @mult: multiplier 160 * @mult: multiplier
162 * 161 *
163 * 162 *
164 * new = old * mult / div 163 * new = old * mult / div
165 */ 164 */
166static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) 165static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
166 u_int mult)
167{ 167{
168#if BITS_PER_LONG == 32 168#if BITS_PER_LONG == 32
169 169
@@ -216,14 +216,12 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
216 unsigned int target_freq, 216 unsigned int target_freq,
217 unsigned int relation); 217 unsigned int relation);
218 218
219
220extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 219extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
221 unsigned int cpu); 220 unsigned int cpu);
222 221
223int cpufreq_register_governor(struct cpufreq_governor *governor); 222int cpufreq_register_governor(struct cpufreq_governor *governor);
224void cpufreq_unregister_governor(struct cpufreq_governor *governor); 223void cpufreq_unregister_governor(struct cpufreq_governor *governor);
225 224
226
227/********************************************************************* 225/*********************************************************************
228 * CPUFREQ DRIVER INTERFACE * 226 * CPUFREQ DRIVER INTERFACE *
229 *********************************************************************/ 227 *********************************************************************/
@@ -234,7 +232,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor);
234struct freq_attr; 232struct freq_attr;
235 233
236struct cpufreq_driver { 234struct cpufreq_driver {
237 struct module *owner; 235 struct module *owner;
238 char name[CPUFREQ_NAME_LEN]; 236 char name[CPUFREQ_NAME_LEN];
239 u8 flags; 237 u8 flags;
240 /* 238 /*
@@ -282,11 +280,11 @@ struct cpufreq_driver {
282int cpufreq_register_driver(struct cpufreq_driver *driver_data); 280int cpufreq_register_driver(struct cpufreq_driver *driver_data);
283int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 281int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
284 282
285
286void cpufreq_notify_transition(struct cpufreq_policy *policy, 283void cpufreq_notify_transition(struct cpufreq_policy *policy,
287 struct cpufreq_freqs *freqs, unsigned int state); 284 struct cpufreq_freqs *freqs, unsigned int state);
288 285
289static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 286static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
287 unsigned int min, unsigned int max)
290{ 288{
291 if (policy->min < min) 289 if (policy->min < min)
292 policy->min = min; 290 policy->min = min;
@@ -349,7 +347,9 @@ bool have_governor_per_policy(void);
349struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); 347struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
350 348
351#ifdef CONFIG_CPU_FREQ 349#ifdef CONFIG_CPU_FREQ
352/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 350/*
351 * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it
352 */
353unsigned int cpufreq_get(unsigned int cpu); 353unsigned int cpufreq_get(unsigned int cpu);
354#else 354#else
355static inline unsigned int cpufreq_get(unsigned int cpu) 355static inline unsigned int cpufreq_get(unsigned int cpu)
@@ -358,7 +358,9 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
358} 358}
359#endif 359#endif
360 360
361/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 361/*
362 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
363 */
362#ifdef CONFIG_CPU_FREQ 364#ifdef CONFIG_CPU_FREQ
363unsigned int cpufreq_quick_get(unsigned int cpu); 365unsigned int cpufreq_quick_get(unsigned int cpu);
364unsigned int cpufreq_quick_get_max(unsigned int cpu); 366unsigned int cpufreq_quick_get_max(unsigned int cpu);
@@ -373,16 +375,14 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
373} 375}
374#endif 376#endif
375 377
376
377/********************************************************************* 378/*********************************************************************
378 * CPUFREQ DEFAULT GOVERNOR * 379 * CPUFREQ DEFAULT GOVERNOR *
379 *********************************************************************/ 380 *********************************************************************/
380 381
381
382/* 382/*
383 Performance governor is fallback governor if any other gov failed to 383 * Performance governor is fallback governor if any other gov failed to auto
384 auto load due latency restrictions 384 * load due latency restrictions
385*/ 385 */
386#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE 386#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
387extern struct cpufreq_governor cpufreq_gov_performance; 387extern struct cpufreq_governor cpufreq_gov_performance;
388#endif 388#endif
@@ -402,7 +402,6 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
402#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 402#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
403#endif 403#endif
404 404
405
406/********************************************************************* 405/*********************************************************************
407 * FREQUENCY TABLE HELPERS * 406 * FREQUENCY TABLE HELPERS *
408 *********************************************************************/ 407 *********************************************************************/