diff options
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 31d6f535a79..9044b911d8a 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 | } |