diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index c6a4ff7a0b0d..0f10ce21d879 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -216,7 +216,7 @@ static void cpufreq_debug_disable_ratelimit(void) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | void cpufreq_debug_printk(unsigned int type, const char *prefix, | 218 | void cpufreq_debug_printk(unsigned int type, const char *prefix, |
219 | const char *fmt, ...) | 219 | const char *fmt, ...) |
220 | { | 220 | { |
221 | char s[256]; | 221 | char s[256]; |
222 | va_list args; | 222 | va_list args; |
@@ -378,7 +378,7 @@ static struct cpufreq_governor *__find_governor(const char *str_governor) | |||
378 | /** | 378 | /** |
379 | * cpufreq_parse_governor - parse a governor string | 379 | * cpufreq_parse_governor - parse a governor string |
380 | */ | 380 | */ |
381 | static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | 381 | static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, |
382 | struct cpufreq_governor **governor) | 382 | struct cpufreq_governor **governor) |
383 | { | 383 | { |
384 | int err = -EINVAL; | 384 | int err = -EINVAL; |
@@ -446,7 +446,7 @@ extern struct sysdev_class cpu_sysdev_class; | |||
446 | 446 | ||
447 | #define show_one(file_name, object) \ | 447 | #define show_one(file_name, object) \ |
448 | static ssize_t show_##file_name \ | 448 | static ssize_t show_##file_name \ |
449 | (struct cpufreq_policy * policy, char *buf) \ | 449 | (struct cpufreq_policy *policy, char *buf) \ |
450 | { \ | 450 | { \ |
451 | return sprintf (buf, "%u\n", policy->object); \ | 451 | return sprintf (buf, "%u\n", policy->object); \ |
452 | } | 452 | } |
@@ -465,7 +465,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
465 | */ | 465 | */ |
466 | #define store_one(file_name, object) \ | 466 | #define store_one(file_name, object) \ |
467 | static ssize_t store_##file_name \ | 467 | static ssize_t store_##file_name \ |
468 | (struct cpufreq_policy * policy, const char *buf, size_t count) \ | 468 | (struct cpufreq_policy *policy, const char *buf, size_t count) \ |
469 | { \ | 469 | { \ |
470 | unsigned int ret = -EINVAL; \ | 470 | unsigned int ret = -EINVAL; \ |
471 | struct cpufreq_policy new_policy; \ | 471 | struct cpufreq_policy new_policy; \ |
@@ -490,8 +490,8 @@ store_one(scaling_max_freq,max); | |||
490 | /** | 490 | /** |
491 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware | 491 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware |
492 | */ | 492 | */ |
493 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, | 493 | static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, |
494 | char *buf) | 494 | char *buf) |
495 | { | 495 | { |
496 | unsigned int cur_freq = __cpufreq_get(policy->cpu); | 496 | unsigned int cur_freq = __cpufreq_get(policy->cpu); |
497 | if (!cur_freq) | 497 | if (!cur_freq) |
@@ -503,8 +503,7 @@ static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, | |||
503 | /** | 503 | /** |
504 | * show_scaling_governor - show the current policy for the specified CPU | 504 | * show_scaling_governor - show the current policy for the specified CPU |
505 | */ | 505 | */ |
506 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, | 506 | static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) |
507 | char *buf) | ||
508 | { | 507 | { |
509 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) | 508 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) |
510 | return sprintf(buf, "powersave\n"); | 509 | return sprintf(buf, "powersave\n"); |
@@ -519,8 +518,8 @@ static ssize_t show_scaling_governor (struct cpufreq_policy * policy, | |||
519 | /** | 518 | /** |
520 | * store_scaling_governor - store policy for the specified CPU | 519 | * store_scaling_governor - store policy for the specified CPU |
521 | */ | 520 | */ |
522 | static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | 521 | static ssize_t store_scaling_governor(struct cpufreq_policy *policy, |
523 | const char *buf, size_t count) | 522 | const char *buf, size_t count) |
524 | { | 523 | { |
525 | unsigned int ret = -EINVAL; | 524 | unsigned int ret = -EINVAL; |
526 | char str_governor[16]; | 525 | char str_governor[16]; |
@@ -554,7 +553,7 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
554 | /** | 553 | /** |
555 | * show_scaling_driver - show the cpufreq driver currently loaded | 554 | * show_scaling_driver - show the cpufreq driver currently loaded |
556 | */ | 555 | */ |
557 | static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) | 556 | static ssize_t show_scaling_driver(struct cpufreq_policy *policy, char *buf) |
558 | { | 557 | { |
559 | return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name); | 558 | return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name); |
560 | } | 559 | } |
@@ -562,8 +561,8 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) | |||
562 | /** | 561 | /** |
563 | * show_scaling_available_governors - show the available CPUfreq governors | 562 | * show_scaling_available_governors - show the available CPUfreq governors |
564 | */ | 563 | */ |
565 | static ssize_t show_scaling_available_governors (struct cpufreq_policy *policy, | 564 | static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, |
566 | char *buf) | 565 | char *buf) |
567 | { | 566 | { |
568 | ssize_t i = 0; | 567 | ssize_t i = 0; |
569 | struct cpufreq_governor *t; | 568 | struct cpufreq_governor *t; |
@@ -585,7 +584,7 @@ out: | |||
585 | /** | 584 | /** |
586 | * show_affected_cpus - show the CPUs affected by each transition | 585 | * show_affected_cpus - show the CPUs affected by each transition |
587 | */ | 586 | */ |
588 | static ssize_t show_affected_cpus (struct cpufreq_policy * policy, char *buf) | 587 | static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf) |
589 | { | 588 | { |
590 | ssize_t i = 0; | 589 | ssize_t i = 0; |
591 | unsigned int cpu; | 590 | unsigned int cpu; |
@@ -602,7 +601,7 @@ static ssize_t show_affected_cpus (struct cpufreq_policy * policy, char *buf) | |||
602 | } | 601 | } |
603 | 602 | ||
604 | static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, | 603 | static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, |
605 | const char *buf, size_t count) | 604 | const char *buf, size_t count) |
606 | { | 605 | { |
607 | unsigned int freq = 0; | 606 | unsigned int freq = 0; |
608 | unsigned int ret; | 607 | unsigned int ret; |
@@ -651,7 +650,7 @@ define_one_rw(scaling_max_freq); | |||
651 | define_one_rw(scaling_governor); | 650 | define_one_rw(scaling_governor); |
652 | define_one_rw(scaling_setspeed); | 651 | define_one_rw(scaling_setspeed); |
653 | 652 | ||
654 | static struct attribute * default_attrs[] = { | 653 | static struct attribute *default_attrs[] = { |
655 | &cpuinfo_min_freq.attr, | 654 | &cpuinfo_min_freq.attr, |
656 | &cpuinfo_max_freq.attr, | 655 | &cpuinfo_max_freq.attr, |
657 | &scaling_min_freq.attr, | 656 | &scaling_min_freq.attr, |
@@ -667,10 +666,10 @@ static struct attribute * default_attrs[] = { | |||
667 | #define to_policy(k) container_of(k,struct cpufreq_policy,kobj) | 666 | #define to_policy(k) container_of(k,struct cpufreq_policy,kobj) |
668 | #define to_attr(a) container_of(a,struct freq_attr,attr) | 667 | #define to_attr(a) container_of(a,struct freq_attr,attr) |
669 | 668 | ||
670 | static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) | 669 | static ssize_t show(struct kobject *kobj, struct attribute *attr ,char *buf) |
671 | { | 670 | { |
672 | struct cpufreq_policy * policy = to_policy(kobj); | 671 | struct cpufreq_policy *policy = to_policy(kobj); |
673 | struct freq_attr * fattr = to_attr(attr); | 672 | struct freq_attr *fattr = to_attr(attr); |
674 | ssize_t ret = -EINVAL; | 673 | ssize_t ret = -EINVAL; |
675 | policy = cpufreq_cpu_get(policy->cpu); | 674 | policy = cpufreq_cpu_get(policy->cpu); |
676 | if (!policy) | 675 | if (!policy) |
@@ -691,11 +690,11 @@ no_policy: | |||
691 | return ret; | 690 | return ret; |
692 | } | 691 | } |
693 | 692 | ||
694 | static ssize_t store(struct kobject * kobj, struct attribute * attr, | 693 | static ssize_t store(struct kobject *kobj, struct attribute *attr, |
695 | const char * buf, size_t count) | 694 | const char *buf, size_t count) |
696 | { | 695 | { |
697 | struct cpufreq_policy * policy = to_policy(kobj); | 696 | struct cpufreq_policy *policy = to_policy(kobj); |
698 | struct freq_attr * fattr = to_attr(attr); | 697 | struct freq_attr *fattr = to_attr(attr); |
699 | ssize_t ret = -EINVAL; | 698 | ssize_t ret = -EINVAL; |
700 | policy = cpufreq_cpu_get(policy->cpu); | 699 | policy = cpufreq_cpu_get(policy->cpu); |
701 | if (!policy) | 700 | if (!policy) |
@@ -716,9 +715,9 @@ no_policy: | |||
716 | return ret; | 715 | return ret; |
717 | } | 716 | } |
718 | 717 | ||
719 | static void cpufreq_sysfs_release(struct kobject * kobj) | 718 | static void cpufreq_sysfs_release(struct kobject *kobj) |
720 | { | 719 | { |
721 | struct cpufreq_policy * policy = to_policy(kobj); | 720 | struct cpufreq_policy *policy = to_policy(kobj); |
722 | dprintk("last reference is dropped\n"); | 721 | dprintk("last reference is dropped\n"); |
723 | complete(&policy->kobj_unregister); | 722 | complete(&policy->kobj_unregister); |
724 | } | 723 | } |
@@ -740,7 +739,7 @@ static struct kobj_type ktype_cpufreq = { | |||
740 | * | 739 | * |
741 | * Adds the cpufreq interface for a CPU device. | 740 | * Adds the cpufreq interface for a CPU device. |
742 | */ | 741 | */ |
743 | static int cpufreq_add_dev (struct sys_device * sys_dev) | 742 | static int cpufreq_add_dev(struct sys_device *sys_dev) |
744 | { | 743 | { |
745 | unsigned int cpu = sys_dev->id; | 744 | unsigned int cpu = sys_dev->id; |
746 | int ret = 0; | 745 | int ret = 0; |
@@ -967,7 +966,7 @@ module_out: | |||
967 | * Caller should already have policy_rwsem in write mode for this CPU. | 966 | * Caller should already have policy_rwsem in write mode for this CPU. |
968 | * This routine frees the rwsem before returning. | 967 | * This routine frees the rwsem before returning. |
969 | */ | 968 | */ |
970 | static int __cpufreq_remove_dev (struct sys_device * sys_dev) | 969 | static int __cpufreq_remove_dev(struct sys_device *sys_dev) |
971 | { | 970 | { |
972 | unsigned int cpu = sys_dev->id; | 971 | unsigned int cpu = sys_dev->id; |
973 | unsigned long flags; | 972 | unsigned long flags; |
@@ -1071,7 +1070,7 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev) | |||
1071 | } | 1070 | } |
1072 | 1071 | ||
1073 | 1072 | ||
1074 | static int cpufreq_remove_dev (struct sys_device * sys_dev) | 1073 | static int cpufreq_remove_dev(struct sys_device *sys_dev) |
1075 | { | 1074 | { |
1076 | unsigned int cpu = sys_dev->id; | 1075 | unsigned int cpu = sys_dev->id; |
1077 | int retval; | 1076 | int retval; |
@@ -1199,7 +1198,7 @@ EXPORT_SYMBOL(cpufreq_get); | |||
1199 | * cpufreq_suspend - let the low level driver prepare for suspend | 1198 | * cpufreq_suspend - let the low level driver prepare for suspend |
1200 | */ | 1199 | */ |
1201 | 1200 | ||
1202 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) | 1201 | static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) |
1203 | { | 1202 | { |
1204 | int cpu = sysdev->id; | 1203 | int cpu = sysdev->id; |
1205 | int ret = 0; | 1204 | int ret = 0; |
@@ -1277,7 +1276,7 @@ out: | |||
1277 | * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are | 1276 | * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are |
1278 | * restored. | 1277 | * restored. |
1279 | */ | 1278 | */ |
1280 | static int cpufreq_resume(struct sys_device * sysdev) | 1279 | static int cpufreq_resume(struct sys_device *sysdev) |
1281 | { | 1280 | { |
1282 | int cpu = sysdev->id; | 1281 | int cpu = sysdev->id; |
1283 | int ret = 0; | 1282 | int ret = 0; |