diff options
author | Matthew Garrett <mjg@redhat.com> | 2008-11-25 13:29:47 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2008-12-05 15:20:10 -0500 |
commit | e088e4c9cdb618675874becb91b2fd581ee707e6 (patch) | |
tree | 48231c406061308502f13c7781a6957ef396a739 /drivers/cpufreq | |
parent | 10db2e5cbda5b4e13d2e2f134b963bee2e129999 (diff) |
[CPUFREQ] Disable sysfs ui for p4-clockmod.
p4-clockmod has a long history of abuse. It pretends to be a CPU
frequency scaling driver, even though it doesn't actually change
the CPU frequency, but instead just modulates the frequency with
wait-states.
The biggest misconception is that when running at the lower 'frequency'
p4-clockmod is saving power. This isn't the case, as workloads running
slower take longer to complete, preventing the CPU from entering deep C states.
However p4-clockmod does have a purpose. It can prevent overheating.
Having it hooked up to the cpufreq interfaces is the wrong way to achieve
cooling however. It should instead be hooked up to ACPI.
This diff introduces a means for a cpufreq driver to register with the
cpufreq core, but not present a sysfs interface.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 31d6f535a79d..9044b911d8ae 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -754,6 +754,11 @@ static struct kobj_type ktype_cpufreq = { | |||
754 | .release = cpufreq_sysfs_release, | 754 | .release = cpufreq_sysfs_release, |
755 | }; | 755 | }; |
756 | 756 | ||
757 | static struct kobj_type ktype_empty_cpufreq = { | ||
758 | .sysfs_ops = &sysfs_ops, | ||
759 | .release = cpufreq_sysfs_release, | ||
760 | }; | ||
761 | |||
757 | 762 | ||
758 | /** | 763 | /** |
759 | * cpufreq_add_dev - add a CPU device | 764 | * cpufreq_add_dev - add a CPU device |
@@ -876,26 +881,36 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
876 | memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); | 881 | memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); |
877 | 882 | ||
878 | /* prepare interface data */ | 883 | /* prepare interface data */ |
879 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, | 884 | if (!cpufreq_driver->hide_interface) { |
880 | "cpufreq"); | 885 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, |
881 | if (ret) | 886 | &sys_dev->kobj, "cpufreq"); |
882 | goto err_out_driver_exit; | ||
883 | |||
884 | /* set up files for this cpu device */ | ||
885 | drv_attr = cpufreq_driver->attr; | ||
886 | while ((drv_attr) && (*drv_attr)) { | ||
887 | ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); | ||
888 | if (ret) | 887 | if (ret) |
889 | goto err_out_driver_exit; | 888 | goto err_out_driver_exit; |
890 | drv_attr++; | 889 | |
891 | } | 890 | /* set up files for this cpu device */ |
892 | if (cpufreq_driver->get) { | 891 | drv_attr = cpufreq_driver->attr; |
893 | ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); | 892 | while ((drv_attr) && (*drv_attr)) { |
894 | if (ret) | 893 | ret = sysfs_create_file(&policy->kobj, |
895 | goto err_out_driver_exit; | 894 | &((*drv_attr)->attr)); |
896 | } | 895 | if (ret) |
897 | if (cpufreq_driver->target) { | 896 | goto err_out_driver_exit; |
898 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); | 897 | drv_attr++; |
898 | } | ||
899 | if (cpufreq_driver->get) { | ||
900 | ret = sysfs_create_file(&policy->kobj, | ||
901 | &cpuinfo_cur_freq.attr); | ||
902 | if (ret) | ||
903 | goto err_out_driver_exit; | ||
904 | } | ||
905 | if (cpufreq_driver->target) { | ||
906 | ret = sysfs_create_file(&policy->kobj, | ||
907 | &scaling_cur_freq.attr); | ||
908 | if (ret) | ||
909 | goto err_out_driver_exit; | ||
910 | } | ||
911 | } else { | ||
912 | ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq, | ||
913 | &sys_dev->kobj, "cpufreq"); | ||
899 | if (ret) | 914 | if (ret) |
900 | goto err_out_driver_exit; | 915 | goto err_out_driver_exit; |
901 | } | 916 | } |