diff options
author | Dave Jones <davej@redhat.com> | 2006-02-02 17:03:42 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-02-02 17:03:42 -0500 |
commit | 7d5e350fab47f1273bc8b52d5f133ed6e4baeb7f (patch) | |
tree | 24318712260f30ea36db8e47c40a1ba5f0dd66a5 | |
parent | a85f7bd310dbc9010309bfe70b6b02432a11ef59 (diff) |
[CPUFREQ] Whitespace/CodingStyle cleanups
Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 35eafbcf5ad5..9582de1c9cad 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -35,8 +35,8 @@ | |||
35 | * level driver of CPUFreq support, and its spinlock. This lock | 35 | * level driver of CPUFreq support, and its spinlock. This lock |
36 | * also protects the cpufreq_cpu_data array. | 36 | * also protects the cpufreq_cpu_data array. |
37 | */ | 37 | */ |
38 | static struct cpufreq_driver *cpufreq_driver; | 38 | static struct cpufreq_driver *cpufreq_driver; |
39 | static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; | 39 | static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; |
40 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 40 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
41 | 41 | ||
42 | /* internal prototypes */ | 42 | /* internal prototypes */ |
@@ -50,15 +50,15 @@ static void handle_update(void *data); | |||
50 | * changes to devices when the CPU clock speed changes. | 50 | * changes to devices when the CPU clock speed changes. |
51 | * The mutex locks both lists. | 51 | * The mutex locks both lists. |
52 | */ | 52 | */ |
53 | static struct notifier_block *cpufreq_policy_notifier_list; | 53 | static struct notifier_block *cpufreq_policy_notifier_list; |
54 | static struct notifier_block *cpufreq_transition_notifier_list; | 54 | static struct notifier_block *cpufreq_transition_notifier_list; |
55 | static DECLARE_RWSEM (cpufreq_notifier_rwsem); | 55 | static DECLARE_RWSEM (cpufreq_notifier_rwsem); |
56 | 56 | ||
57 | 57 | ||
58 | static LIST_HEAD(cpufreq_governor_list); | 58 | static LIST_HEAD(cpufreq_governor_list); |
59 | static DEFINE_MUTEX (cpufreq_governor_mutex); | 59 | static DEFINE_MUTEX (cpufreq_governor_mutex); |
60 | 60 | ||
61 | struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu) | 61 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) |
62 | { | 62 | { |
63 | struct cpufreq_policy *data; | 63 | struct cpufreq_policy *data; |
64 | unsigned long flags; | 64 | unsigned long flags; |
@@ -85,20 +85,19 @@ struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu) | |||
85 | if (!kobject_get(&data->kobj)) | 85 | if (!kobject_get(&data->kobj)) |
86 | goto err_out_put_module; | 86 | goto err_out_put_module; |
87 | 87 | ||
88 | |||
89 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 88 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
90 | |||
91 | return data; | 89 | return data; |
92 | 90 | ||
93 | err_out_put_module: | 91 | err_out_put_module: |
94 | module_put(cpufreq_driver->owner); | 92 | module_put(cpufreq_driver->owner); |
95 | err_out_unlock: | 93 | err_out_unlock: |
96 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 94 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
97 | err_out: | 95 | err_out: |
98 | return NULL; | 96 | return NULL; |
99 | } | 97 | } |
100 | EXPORT_SYMBOL_GPL(cpufreq_cpu_get); | 98 | EXPORT_SYMBOL_GPL(cpufreq_cpu_get); |
101 | 99 | ||
100 | |||
102 | void cpufreq_cpu_put(struct cpufreq_policy *data) | 101 | void cpufreq_cpu_put(struct cpufreq_policy *data) |
103 | { | 102 | { |
104 | kobject_put(&data->kobj); | 103 | kobject_put(&data->kobj); |
@@ -317,7 +316,7 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
317 | return 0; | 316 | return 0; |
318 | } | 317 | } |
319 | } | 318 | } |
320 | out: | 319 | out: |
321 | mutex_unlock(&cpufreq_governor_mutex); | 320 | mutex_unlock(&cpufreq_governor_mutex); |
322 | } | 321 | } |
323 | return -EINVAL; | 322 | return -EINVAL; |
@@ -424,7 +423,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
424 | return -EINVAL; | 423 | return -EINVAL; |
425 | 424 | ||
426 | ret = cpufreq_set_policy(&new_policy); | 425 | ret = cpufreq_set_policy(&new_policy); |
427 | |||
428 | return ret ? ret : count; | 426 | return ret ? ret : count; |
429 | } | 427 | } |
430 | 428 | ||
@@ -455,7 +453,7 @@ static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy, | |||
455 | goto out; | 453 | goto out; |
456 | i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); | 454 | i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); |
457 | } | 455 | } |
458 | out: | 456 | out: |
459 | i += sprintf(&buf[i], "\n"); | 457 | i += sprintf(&buf[i], "\n"); |
460 | return i; | 458 | return i; |
461 | } | 459 | } |
@@ -798,7 +796,6 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
798 | kfree(data); | 796 | kfree(data); |
799 | 797 | ||
800 | cpufreq_debug_enable_ratelimit(); | 798 | cpufreq_debug_enable_ratelimit(); |
801 | |||
802 | return 0; | 799 | return 0; |
803 | } | 800 | } |
804 | 801 | ||
@@ -879,8 +876,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
879 | 876 | ||
880 | ret = cpufreq_driver->get(cpu); | 877 | ret = cpufreq_driver->get(cpu); |
881 | 878 | ||
882 | if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) | 879 | if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
883 | { | ||
884 | /* verify no discrepancy between actual and saved value exists */ | 880 | /* verify no discrepancy between actual and saved value exists */ |
885 | if (unlikely(ret != policy->cur)) { | 881 | if (unlikely(ret != policy->cur)) { |
886 | cpufreq_out_of_sync(cpu, policy->cur, ret); | 882 | cpufreq_out_of_sync(cpu, policy->cur, ret); |
@@ -890,7 +886,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
890 | 886 | ||
891 | mutex_unlock(&policy->lock); | 887 | mutex_unlock(&policy->lock); |
892 | 888 | ||
893 | out: | 889 | out: |
894 | cpufreq_cpu_put(policy); | 890 | cpufreq_cpu_put(policy); |
895 | 891 | ||
896 | return (ret); | 892 | return (ret); |
@@ -971,7 +967,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) | |||
971 | cpu_policy->cur = cur_freq; | 967 | cpu_policy->cur = cur_freq; |
972 | } | 968 | } |
973 | 969 | ||
974 | out: | 970 | out: |
975 | cpufreq_cpu_put(cpu_policy); | 971 | cpufreq_cpu_put(cpu_policy); |
976 | return 0; | 972 | return 0; |
977 | } | 973 | } |
@@ -1178,7 +1174,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1178 | mutex_unlock(&policy->lock); | 1174 | mutex_unlock(&policy->lock); |
1179 | 1175 | ||
1180 | cpufreq_cpu_put(policy); | 1176 | cpufreq_cpu_put(policy); |
1181 | |||
1182 | return ret; | 1177 | return ret; |
1183 | } | 1178 | } |
1184 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); | 1179 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); |
@@ -1217,7 +1212,6 @@ int cpufreq_governor(unsigned int cpu, unsigned int event) | |||
1217 | mutex_unlock(&policy->lock); | 1212 | mutex_unlock(&policy->lock); |
1218 | 1213 | ||
1219 | cpufreq_cpu_put(policy); | 1214 | cpufreq_cpu_put(policy); |
1220 | |||
1221 | return ret; | 1215 | return ret; |
1222 | } | 1216 | } |
1223 | EXPORT_SYMBOL_GPL(cpufreq_governor); | 1217 | EXPORT_SYMBOL_GPL(cpufreq_governor); |
@@ -1241,7 +1235,6 @@ int cpufreq_register_governor(struct cpufreq_governor *governor) | |||
1241 | list_add(&governor->governor_list, &cpufreq_governor_list); | 1235 | list_add(&governor->governor_list, &cpufreq_governor_list); |
1242 | 1236 | ||
1243 | mutex_unlock(&cpufreq_governor_mutex); | 1237 | mutex_unlock(&cpufreq_governor_mutex); |
1244 | |||
1245 | return 0; | 1238 | return 0; |
1246 | } | 1239 | } |
1247 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); | 1240 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); |
@@ -1286,7 +1279,6 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu) | |||
1286 | mutex_unlock(&cpu_policy->lock); | 1279 | mutex_unlock(&cpu_policy->lock); |
1287 | 1280 | ||
1288 | cpufreq_cpu_put(cpu_policy); | 1281 | cpufreq_cpu_put(cpu_policy); |
1289 | |||
1290 | return 0; | 1282 | return 0; |
1291 | } | 1283 | } |
1292 | EXPORT_SYMBOL(cpufreq_get_policy); | 1284 | EXPORT_SYMBOL(cpufreq_get_policy); |
@@ -1300,9 +1292,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1300 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, | 1292 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, |
1301 | policy->min, policy->max); | 1293 | policy->min, policy->max); |
1302 | 1294 | ||
1303 | memcpy(&policy->cpuinfo, | 1295 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); |
1304 | &data->cpuinfo, | ||
1305 | sizeof(struct cpufreq_cpuinfo)); | ||
1306 | 1296 | ||
1307 | /* verify the cpu speed can be set within this limit */ | 1297 | /* verify the cpu speed can be set within this limit */ |
1308 | ret = cpufreq_driver->verify(policy); | 1298 | ret = cpufreq_driver->verify(policy); |
@@ -1333,8 +1323,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1333 | 1323 | ||
1334 | up_read(&cpufreq_notifier_rwsem); | 1324 | up_read(&cpufreq_notifier_rwsem); |
1335 | 1325 | ||
1336 | data->min = policy->min; | 1326 | data->min = policy->min; |
1337 | data->max = policy->max; | 1327 | data->max = policy->max; |
1338 | 1328 | ||
1339 | dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); | 1329 | dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); |
1340 | 1330 | ||
@@ -1371,7 +1361,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1371 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | 1361 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); |
1372 | } | 1362 | } |
1373 | 1363 | ||
1374 | error_out: | 1364 | error_out: |
1375 | cpufreq_debug_enable_ratelimit(); | 1365 | cpufreq_debug_enable_ratelimit(); |
1376 | return ret; | 1366 | return ret; |
1377 | } | 1367 | } |
@@ -1430,9 +1420,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1430 | mutex_lock(&data->lock); | 1420 | mutex_lock(&data->lock); |
1431 | 1421 | ||
1432 | dprintk("updating policy for CPU %u\n", cpu); | 1422 | dprintk("updating policy for CPU %u\n", cpu); |
1433 | memcpy(&policy, | 1423 | memcpy(&policy, data, sizeof(struct cpufreq_policy)); |
1434 | data, | ||
1435 | sizeof(struct cpufreq_policy)); | ||
1436 | policy.min = data->user_policy.min; | 1424 | policy.min = data->user_policy.min; |
1437 | policy.max = data->user_policy.max; | 1425 | policy.max = data->user_policy.max; |
1438 | policy.policy = data->user_policy.policy; | 1426 | policy.policy = data->user_policy.policy; |