diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-26 14:04:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-26 14:04:08 -0400 |
commit | ada19a31a90b4f46c040c25ef4ef8ffc203c7fc6 (patch) | |
tree | 7d523d2d90dbaa973c5843d6219ec149b5949243 /drivers/cpufreq/cpufreq.c | |
parent | 8d80ce80e1d58ba9cd3e3972b112cccd6b4008f4 (diff) | |
parent | 36e8abf3edcd2d207193ec5741d1a2a645d470a5 (diff) |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: (35 commits)
[CPUFREQ] Prevent p4-clockmod from auto-binding to the ondemand governor.
[CPUFREQ] Make cpufreq-nforce2 less obnoxious
[CPUFREQ] p4-clockmod reports wrong frequency.
[CPUFREQ] powernow-k8: Use a common exit path.
[CPUFREQ] Change link order of x86 cpufreq modules
[CPUFREQ] conservative: remove 10x from def_sampling_rate
[CPUFREQ] conservative: fixup governor to function more like ondemand logic
[CPUFREQ] conservative: fix dbs_cpufreq_notifier so freq is not locked
[CPUFREQ] conservative: amend author's email address
[CPUFREQ] Use swap() in longhaul.c
[CPUFREQ] checkpatch cleanups for acpi-cpufreq
[CPUFREQ] powernow-k8: Only print error message once, not per core.
[CPUFREQ] ondemand/conservative: sanitize sampling_rate restrictions
[CPUFREQ] ondemand/conservative: deprecate sampling_rate{min,max}
[CPUFREQ] powernow-k8: Always compile powernow-k8 driver with ACPI support
[CPUFREQ] Introduce /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_transition_latency
[CPUFREQ] checkpatch cleanups for powernow-k8
[CPUFREQ] checkpatch cleanups for ondemand governor.
[CPUFREQ] checkpatch cleanups for powernow-k7
[CPUFREQ] checkpatch cleanups for speedstep related drivers.
...
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d6daf3c507d3..d270e8eb3e67 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -104,7 +104,8 @@ EXPORT_SYMBOL_GPL(unlock_policy_rwsem_write); | |||
104 | 104 | ||
105 | 105 | ||
106 | /* internal prototypes */ | 106 | /* internal prototypes */ |
107 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 107 | static int __cpufreq_governor(struct cpufreq_policy *policy, |
108 | unsigned int event); | ||
108 | static unsigned int __cpufreq_get(unsigned int cpu); | 109 | static unsigned int __cpufreq_get(unsigned int cpu); |
109 | static void handle_update(struct work_struct *work); | 110 | static void handle_update(struct work_struct *work); |
110 | 111 | ||
@@ -128,7 +129,7 @@ static int __init init_cpufreq_transition_notifier_list(void) | |||
128 | pure_initcall(init_cpufreq_transition_notifier_list); | 129 | pure_initcall(init_cpufreq_transition_notifier_list); |
129 | 130 | ||
130 | static LIST_HEAD(cpufreq_governor_list); | 131 | static LIST_HEAD(cpufreq_governor_list); |
131 | static DEFINE_MUTEX (cpufreq_governor_mutex); | 132 | static DEFINE_MUTEX(cpufreq_governor_mutex); |
132 | 133 | ||
133 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) | 134 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) |
134 | { | 135 | { |
@@ -371,7 +372,7 @@ static struct cpufreq_governor *__find_governor(const char *str_governor) | |||
371 | struct cpufreq_governor *t; | 372 | struct cpufreq_governor *t; |
372 | 373 | ||
373 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) | 374 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) |
374 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) | 375 | if (!strnicmp(str_governor, t->name, CPUFREQ_NAME_LEN)) |
375 | return t; | 376 | return t; |
376 | 377 | ||
377 | return NULL; | 378 | return NULL; |
@@ -429,15 +430,11 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, | |||
429 | 430 | ||
430 | mutex_unlock(&cpufreq_governor_mutex); | 431 | mutex_unlock(&cpufreq_governor_mutex); |
431 | } | 432 | } |
432 | out: | 433 | out: |
433 | return err; | 434 | return err; |
434 | } | 435 | } |
435 | 436 | ||
436 | 437 | ||
437 | /* drivers/base/cpu.c */ | ||
438 | extern struct sysdev_class cpu_sysdev_class; | ||
439 | |||
440 | |||
441 | /** | 438 | /** |
442 | * cpufreq_per_cpu_attr_read() / show_##file_name() - | 439 | * cpufreq_per_cpu_attr_read() / show_##file_name() - |
443 | * print out cpufreq information | 440 | * print out cpufreq information |
@@ -450,11 +447,12 @@ extern struct sysdev_class cpu_sysdev_class; | |||
450 | static ssize_t show_##file_name \ | 447 | static ssize_t show_##file_name \ |
451 | (struct cpufreq_policy *policy, char *buf) \ | 448 | (struct cpufreq_policy *policy, char *buf) \ |
452 | { \ | 449 | { \ |
453 | return sprintf (buf, "%u\n", policy->object); \ | 450 | return sprintf(buf, "%u\n", policy->object); \ |
454 | } | 451 | } |
455 | 452 | ||
456 | show_one(cpuinfo_min_freq, cpuinfo.min_freq); | 453 | show_one(cpuinfo_min_freq, cpuinfo.min_freq); |
457 | show_one(cpuinfo_max_freq, cpuinfo.max_freq); | 454 | show_one(cpuinfo_max_freq, cpuinfo.max_freq); |
455 | show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); | ||
458 | show_one(scaling_min_freq, min); | 456 | show_one(scaling_min_freq, min); |
459 | show_one(scaling_max_freq, max); | 457 | show_one(scaling_max_freq, max); |
460 | show_one(scaling_cur_freq, cur); | 458 | show_one(scaling_cur_freq, cur); |
@@ -476,7 +474,7 @@ static ssize_t store_##file_name \ | |||
476 | if (ret) \ | 474 | if (ret) \ |
477 | return -EINVAL; \ | 475 | return -EINVAL; \ |
478 | \ | 476 | \ |
479 | ret = sscanf (buf, "%u", &new_policy.object); \ | 477 | ret = sscanf(buf, "%u", &new_policy.object); \ |
480 | if (ret != 1) \ | 478 | if (ret != 1) \ |
481 | return -EINVAL; \ | 479 | return -EINVAL; \ |
482 | \ | 480 | \ |
@@ -486,8 +484,8 @@ static ssize_t store_##file_name \ | |||
486 | return ret ? ret : count; \ | 484 | return ret ? ret : count; \ |
487 | } | 485 | } |
488 | 486 | ||
489 | store_one(scaling_min_freq,min); | 487 | store_one(scaling_min_freq, min); |
490 | store_one(scaling_max_freq,max); | 488 | store_one(scaling_max_freq, max); |
491 | 489 | ||
492 | /** | 490 | /** |
493 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware | 491 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware |
@@ -507,12 +505,13 @@ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, | |||
507 | */ | 505 | */ |
508 | static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) | 506 | static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) |
509 | { | 507 | { |
510 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) | 508 | if (policy->policy == CPUFREQ_POLICY_POWERSAVE) |
511 | return sprintf(buf, "powersave\n"); | 509 | return sprintf(buf, "powersave\n"); |
512 | else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) | 510 | else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) |
513 | return sprintf(buf, "performance\n"); | 511 | return sprintf(buf, "performance\n"); |
514 | else if (policy->governor) | 512 | else if (policy->governor) |
515 | return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", policy->governor->name); | 513 | return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", |
514 | policy->governor->name); | ||
516 | return -EINVAL; | 515 | return -EINVAL; |
517 | } | 516 | } |
518 | 517 | ||
@@ -531,7 +530,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, | |||
531 | if (ret) | 530 | if (ret) |
532 | return ret; | 531 | return ret; |
533 | 532 | ||
534 | ret = sscanf (buf, "%15s", str_governor); | 533 | ret = sscanf(buf, "%15s", str_governor); |
535 | if (ret != 1) | 534 | if (ret != 1) |
536 | return -EINVAL; | 535 | return -EINVAL; |
537 | 536 | ||
@@ -575,7 +574,8 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, | |||
575 | } | 574 | } |
576 | 575 | ||
577 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 576 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { |
578 | if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) - (CPUFREQ_NAME_LEN + 2))) | 577 | if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) |
578 | - (CPUFREQ_NAME_LEN + 2))) | ||
579 | goto out; | 579 | goto out; |
580 | i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); | 580 | i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); |
581 | } | 581 | } |
@@ -594,7 +594,7 @@ static ssize_t show_cpus(const struct cpumask *mask, char *buf) | |||
594 | i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " "); | 594 | i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " "); |
595 | i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu); | 595 | i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu); |
596 | if (i >= (PAGE_SIZE - 5)) | 596 | if (i >= (PAGE_SIZE - 5)) |
597 | break; | 597 | break; |
598 | } | 598 | } |
599 | i += sprintf(&buf[i], "\n"); | 599 | i += sprintf(&buf[i], "\n"); |
600 | return i; | 600 | return i; |
@@ -660,6 +660,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name) | |||
660 | define_one_ro0400(cpuinfo_cur_freq); | 660 | define_one_ro0400(cpuinfo_cur_freq); |
661 | define_one_ro(cpuinfo_min_freq); | 661 | define_one_ro(cpuinfo_min_freq); |
662 | define_one_ro(cpuinfo_max_freq); | 662 | define_one_ro(cpuinfo_max_freq); |
663 | define_one_ro(cpuinfo_transition_latency); | ||
663 | define_one_ro(scaling_available_governors); | 664 | define_one_ro(scaling_available_governors); |
664 | define_one_ro(scaling_driver); | 665 | define_one_ro(scaling_driver); |
665 | define_one_ro(scaling_cur_freq); | 666 | define_one_ro(scaling_cur_freq); |
@@ -673,6 +674,7 @@ define_one_rw(scaling_setspeed); | |||
673 | static struct attribute *default_attrs[] = { | 674 | static struct attribute *default_attrs[] = { |
674 | &cpuinfo_min_freq.attr, | 675 | &cpuinfo_min_freq.attr, |
675 | &cpuinfo_max_freq.attr, | 676 | &cpuinfo_max_freq.attr, |
677 | &cpuinfo_transition_latency.attr, | ||
676 | &scaling_min_freq.attr, | 678 | &scaling_min_freq.attr, |
677 | &scaling_max_freq.attr, | 679 | &scaling_max_freq.attr, |
678 | &affected_cpus.attr, | 680 | &affected_cpus.attr, |
@@ -684,10 +686,10 @@ static struct attribute *default_attrs[] = { | |||
684 | NULL | 686 | NULL |
685 | }; | 687 | }; |
686 | 688 | ||
687 | #define to_policy(k) container_of(k,struct cpufreq_policy,kobj) | 689 | #define to_policy(k) container_of(k, struct cpufreq_policy, kobj) |
688 | #define to_attr(a) container_of(a,struct freq_attr,attr) | 690 | #define to_attr(a) container_of(a, struct freq_attr, attr) |
689 | 691 | ||
690 | static ssize_t show(struct kobject *kobj, struct attribute *attr ,char *buf) | 692 | static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf) |
691 | { | 693 | { |
692 | struct cpufreq_policy *policy = to_policy(kobj); | 694 | struct cpufreq_policy *policy = to_policy(kobj); |
693 | struct freq_attr *fattr = to_attr(attr); | 695 | struct freq_attr *fattr = to_attr(attr); |
@@ -853,10 +855,10 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
853 | if (cpu == j) | 855 | if (cpu == j) |
854 | continue; | 856 | continue; |
855 | 857 | ||
856 | /* check for existing affected CPUs. They may not be aware | 858 | /* Check for existing affected CPUs. |
857 | * of it due to CPU Hotplug. | 859 | * They may not be aware of it due to CPU Hotplug. |
858 | */ | 860 | */ |
859 | managed_policy = cpufreq_cpu_get(j); // FIXME: Where is this released? What about error paths? | 861 | managed_policy = cpufreq_cpu_get(j); /* FIXME: Where is this released? What about error paths? */ |
860 | if (unlikely(managed_policy)) { | 862 | if (unlikely(managed_policy)) { |
861 | 863 | ||
862 | /* Set proper policy_cpu */ | 864 | /* Set proper policy_cpu */ |
@@ -1127,8 +1129,8 @@ static void handle_update(struct work_struct *work) | |||
1127 | * @old_freq: CPU frequency the kernel thinks the CPU runs at | 1129 | * @old_freq: CPU frequency the kernel thinks the CPU runs at |
1128 | * @new_freq: CPU frequency the CPU actually runs at | 1130 | * @new_freq: CPU frequency the CPU actually runs at |
1129 | * | 1131 | * |
1130 | * We adjust to current frequency first, and need to clean up later. So either call | 1132 | * We adjust to current frequency first, and need to clean up later. |
1131 | * to cpufreq_update_policy() or schedule handle_update()). | 1133 | * So either call to cpufreq_update_policy() or schedule handle_update()). |
1132 | */ | 1134 | */ |
1133 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, | 1135 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, |
1134 | unsigned int new_freq) | 1136 | unsigned int new_freq) |
@@ -1610,7 +1612,8 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); | |||
1610 | 1612 | ||
1611 | /** | 1613 | /** |
1612 | * cpufreq_get_policy - get the current cpufreq_policy | 1614 | * cpufreq_get_policy - get the current cpufreq_policy |
1613 | * @policy: struct cpufreq_policy into which the current cpufreq_policy is written | 1615 | * @policy: struct cpufreq_policy into which the current cpufreq_policy |
1616 | * is written | ||
1614 | * | 1617 | * |
1615 | * Reads the current cpufreq policy. | 1618 | * Reads the current cpufreq policy. |
1616 | */ | 1619 | */ |