aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 31d6f535a79d..01dde80597f7 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
757static 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
@@ -822,8 +827,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
822 dprintk("initialization failed\n"); 827 dprintk("initialization failed\n");
823 goto err_out; 828 goto err_out;
824 } 829 }
825 policy->user_policy.min = policy->cpuinfo.min_freq; 830 policy->user_policy.min = policy->min;
826 policy->user_policy.max = policy->cpuinfo.max_freq; 831 policy->user_policy.max = policy->max;
827 832
828 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 833 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
829 CPUFREQ_START, policy); 834 CPUFREQ_START, policy);
@@ -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 }