aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-07 15:03:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-07 15:03:30 -0500
commit7affca3537d74365128e477b40c529d6f2fe86c8 (patch)
tree20be92bd240029182fc89c2c4f25401b7715dcae /drivers/cpufreq
parent356b95424cfb456e14a59eaa579422ce014c424b (diff)
parentff4b8a57f0aaa2882d444ca44b2b9b333d22a4df (diff)
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (73 commits) arm: fix up some samsung merge sysdev conversion problems firmware: Fix an oops on reading fw_priv->fw in sysfs loading file Drivers:hv: Fix a bug in vmbus_driver_unregister() driver core: remove __must_check from device_create_file debugfs: add missing #ifdef HAS_IOMEM arm: time.h: remove device.h #include driver-core: remove sysdev.h usage. clockevents: remove sysdev.h arm: convert sysdev_class to a regular subsystem arm: leds: convert sysdev_class to a regular subsystem kobject: remove kset_find_obj_hinted() m86k: gpio - convert sysdev_class to a regular subsystem mips: txx9_sram - convert sysdev_class to a regular subsystem mips: 7segled - convert sysdev_class to a regular subsystem sh: dma - convert sysdev_class to a regular subsystem sh: intc - convert sysdev_class to a regular subsystem power: suspend - convert sysdev_class to a regular subsystem power: qe_ic - convert sysdev_class to a regular subsystem power: cmm - convert sysdev_class to a regular subsystem s390: time - convert sysdev_class to a regular subsystem ... Fix up conflicts with 'struct sysdev' removal from various platform drivers that got changed: - arch/arm/mach-exynos/cpu.c - arch/arm/mach-exynos/irq-eint.c - arch/arm/mach-s3c64xx/common.c - arch/arm/mach-s3c64xx/cpu.c - arch/arm/mach-s5p64x0/cpu.c - arch/arm/mach-s5pv210/common.c - arch/arm/plat-samsung/include/plat/cpu.h - arch/powerpc/kernel/sysfs.c and fix up cpu_is_hotpluggable() as per Greg in include/linux/cpu.h
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c79
-rw-r--r--drivers/cpufreq/cpufreq_stats.c1
2 files changed, 39 insertions, 41 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 987a165ede26..8c2df3499da7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -679,7 +679,7 @@ static struct kobj_type ktype_cpufreq = {
679 */ 679 */
680static int cpufreq_add_dev_policy(unsigned int cpu, 680static int cpufreq_add_dev_policy(unsigned int cpu,
681 struct cpufreq_policy *policy, 681 struct cpufreq_policy *policy,
682 struct sys_device *sys_dev) 682 struct device *dev)
683{ 683{
684 int ret = 0; 684 int ret = 0;
685#ifdef CONFIG_SMP 685#ifdef CONFIG_SMP
@@ -728,7 +728,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu,
728 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 728 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
729 729
730 pr_debug("CPU already managed, adding link\n"); 730 pr_debug("CPU already managed, adding link\n");
731 ret = sysfs_create_link(&sys_dev->kobj, 731 ret = sysfs_create_link(&dev->kobj,
732 &managed_policy->kobj, 732 &managed_policy->kobj,
733 "cpufreq"); 733 "cpufreq");
734 if (ret) 734 if (ret)
@@ -761,7 +761,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
761 761
762 for_each_cpu(j, policy->cpus) { 762 for_each_cpu(j, policy->cpus) {
763 struct cpufreq_policy *managed_policy; 763 struct cpufreq_policy *managed_policy;
764 struct sys_device *cpu_sys_dev; 764 struct device *cpu_dev;
765 765
766 if (j == cpu) 766 if (j == cpu)
767 continue; 767 continue;
@@ -770,8 +770,8 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
770 770
771 pr_debug("CPU %u already managed, adding link\n", j); 771 pr_debug("CPU %u already managed, adding link\n", j);
772 managed_policy = cpufreq_cpu_get(cpu); 772 managed_policy = cpufreq_cpu_get(cpu);
773 cpu_sys_dev = get_cpu_sysdev(j); 773 cpu_dev = get_cpu_device(j);
774 ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 774 ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
775 "cpufreq"); 775 "cpufreq");
776 if (ret) { 776 if (ret) {
777 cpufreq_cpu_put(managed_policy); 777 cpufreq_cpu_put(managed_policy);
@@ -783,7 +783,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
783 783
784static int cpufreq_add_dev_interface(unsigned int cpu, 784static int cpufreq_add_dev_interface(unsigned int cpu,
785 struct cpufreq_policy *policy, 785 struct cpufreq_policy *policy,
786 struct sys_device *sys_dev) 786 struct device *dev)
787{ 787{
788 struct cpufreq_policy new_policy; 788 struct cpufreq_policy new_policy;
789 struct freq_attr **drv_attr; 789 struct freq_attr **drv_attr;
@@ -793,7 +793,7 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
793 793
794 /* prepare interface data */ 794 /* prepare interface data */
795 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, 795 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
796 &sys_dev->kobj, "cpufreq"); 796 &dev->kobj, "cpufreq");
797 if (ret) 797 if (ret)
798 return ret; 798 return ret;
799 799
@@ -866,9 +866,9 @@ err_out_kobj_put:
866 * with with cpu hotplugging and all hell will break loose. Tried to clean this 866 * with with cpu hotplugging and all hell will break loose. Tried to clean this
867 * mess up, but more thorough testing is needed. - Mathieu 867 * mess up, but more thorough testing is needed. - Mathieu
868 */ 868 */
869static int cpufreq_add_dev(struct sys_device *sys_dev) 869static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
870{ 870{
871 unsigned int cpu = sys_dev->id; 871 unsigned int cpu = dev->id;
872 int ret = 0, found = 0; 872 int ret = 0, found = 0;
873 struct cpufreq_policy *policy; 873 struct cpufreq_policy *policy;
874 unsigned long flags; 874 unsigned long flags;
@@ -947,7 +947,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
947 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 947 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
948 CPUFREQ_START, policy); 948 CPUFREQ_START, policy);
949 949
950 ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); 950 ret = cpufreq_add_dev_policy(cpu, policy, dev);
951 if (ret) { 951 if (ret) {
952 if (ret > 0) 952 if (ret > 0)
953 /* This is a managed cpu, symlink created, 953 /* This is a managed cpu, symlink created,
@@ -956,7 +956,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
956 goto err_unlock_policy; 956 goto err_unlock_policy;
957 } 957 }
958 958
959 ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); 959 ret = cpufreq_add_dev_interface(cpu, policy, dev);
960 if (ret) 960 if (ret)
961 goto err_out_unregister; 961 goto err_out_unregister;
962 962
@@ -999,15 +999,15 @@ module_out:
999 * Caller should already have policy_rwsem in write mode for this CPU. 999 * Caller should already have policy_rwsem in write mode for this CPU.
1000 * This routine frees the rwsem before returning. 1000 * This routine frees the rwsem before returning.
1001 */ 1001 */
1002static int __cpufreq_remove_dev(struct sys_device *sys_dev) 1002static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1003{ 1003{
1004 unsigned int cpu = sys_dev->id; 1004 unsigned int cpu = dev->id;
1005 unsigned long flags; 1005 unsigned long flags;
1006 struct cpufreq_policy *data; 1006 struct cpufreq_policy *data;
1007 struct kobject *kobj; 1007 struct kobject *kobj;
1008 struct completion *cmp; 1008 struct completion *cmp;
1009#ifdef CONFIG_SMP 1009#ifdef CONFIG_SMP
1010 struct sys_device *cpu_sys_dev; 1010 struct device *cpu_dev;
1011 unsigned int j; 1011 unsigned int j;
1012#endif 1012#endif
1013 1013
@@ -1032,7 +1032,7 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1032 pr_debug("removing link\n"); 1032 pr_debug("removing link\n");
1033 cpumask_clear_cpu(cpu, data->cpus); 1033 cpumask_clear_cpu(cpu, data->cpus);
1034 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1034 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1035 kobj = &sys_dev->kobj; 1035 kobj = &dev->kobj;
1036 cpufreq_cpu_put(data); 1036 cpufreq_cpu_put(data);
1037 unlock_policy_rwsem_write(cpu); 1037 unlock_policy_rwsem_write(cpu);
1038 sysfs_remove_link(kobj, "cpufreq"); 1038 sysfs_remove_link(kobj, "cpufreq");
@@ -1071,8 +1071,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1071 strncpy(per_cpu(cpufreq_cpu_governor, j), 1071 strncpy(per_cpu(cpufreq_cpu_governor, j),
1072 data->governor->name, CPUFREQ_NAME_LEN); 1072 data->governor->name, CPUFREQ_NAME_LEN);
1073#endif 1073#endif
1074 cpu_sys_dev = get_cpu_sysdev(j); 1074 cpu_dev = get_cpu_device(j);
1075 kobj = &cpu_sys_dev->kobj; 1075 kobj = &cpu_dev->kobj;
1076 unlock_policy_rwsem_write(cpu); 1076 unlock_policy_rwsem_write(cpu);
1077 sysfs_remove_link(kobj, "cpufreq"); 1077 sysfs_remove_link(kobj, "cpufreq");
1078 lock_policy_rwsem_write(cpu); 1078 lock_policy_rwsem_write(cpu);
@@ -1112,11 +1112,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1112 if (unlikely(cpumask_weight(data->cpus) > 1)) { 1112 if (unlikely(cpumask_weight(data->cpus) > 1)) {
1113 /* first sibling now owns the new sysfs dir */ 1113 /* first sibling now owns the new sysfs dir */
1114 cpumask_clear_cpu(cpu, data->cpus); 1114 cpumask_clear_cpu(cpu, data->cpus);
1115 cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); 1115 cpufreq_add_dev(get_cpu_device(cpumask_first(data->cpus)), NULL);
1116 1116
1117 /* finally remove our own symlink */ 1117 /* finally remove our own symlink */
1118 lock_policy_rwsem_write(cpu); 1118 lock_policy_rwsem_write(cpu);
1119 __cpufreq_remove_dev(sys_dev); 1119 __cpufreq_remove_dev(dev, sif);
1120 } 1120 }
1121#endif 1121#endif
1122 1122
@@ -1128,9 +1128,9 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1128} 1128}
1129 1129
1130 1130
1131static int cpufreq_remove_dev(struct sys_device *sys_dev) 1131static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1132{ 1132{
1133 unsigned int cpu = sys_dev->id; 1133 unsigned int cpu = dev->id;
1134 int retval; 1134 int retval;
1135 1135
1136 if (cpu_is_offline(cpu)) 1136 if (cpu_is_offline(cpu))
@@ -1139,7 +1139,7 @@ static int cpufreq_remove_dev(struct sys_device *sys_dev)
1139 if (unlikely(lock_policy_rwsem_write(cpu))) 1139 if (unlikely(lock_policy_rwsem_write(cpu)))
1140 BUG(); 1140 BUG();
1141 1141
1142 retval = __cpufreq_remove_dev(sys_dev); 1142 retval = __cpufreq_remove_dev(dev, sif);
1143 return retval; 1143 return retval;
1144} 1144}
1145 1145
@@ -1271,9 +1271,11 @@ out:
1271} 1271}
1272EXPORT_SYMBOL(cpufreq_get); 1272EXPORT_SYMBOL(cpufreq_get);
1273 1273
1274static struct sysdev_driver cpufreq_sysdev_driver = { 1274static struct subsys_interface cpufreq_interface = {
1275 .add = cpufreq_add_dev, 1275 .name = "cpufreq",
1276 .remove = cpufreq_remove_dev, 1276 .subsys = &cpu_subsys,
1277 .add_dev = cpufreq_add_dev,
1278 .remove_dev = cpufreq_remove_dev,
1277}; 1279};
1278 1280
1279 1281
@@ -1765,25 +1767,25 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1765 unsigned long action, void *hcpu) 1767 unsigned long action, void *hcpu)
1766{ 1768{
1767 unsigned int cpu = (unsigned long)hcpu; 1769 unsigned int cpu = (unsigned long)hcpu;
1768 struct sys_device *sys_dev; 1770 struct device *dev;
1769 1771
1770 sys_dev = get_cpu_sysdev(cpu); 1772 dev = get_cpu_device(cpu);
1771 if (sys_dev) { 1773 if (dev) {
1772 switch (action) { 1774 switch (action) {
1773 case CPU_ONLINE: 1775 case CPU_ONLINE:
1774 case CPU_ONLINE_FROZEN: 1776 case CPU_ONLINE_FROZEN:
1775 cpufreq_add_dev(sys_dev); 1777 cpufreq_add_dev(dev, NULL);
1776 break; 1778 break;
1777 case CPU_DOWN_PREPARE: 1779 case CPU_DOWN_PREPARE:
1778 case CPU_DOWN_PREPARE_FROZEN: 1780 case CPU_DOWN_PREPARE_FROZEN:
1779 if (unlikely(lock_policy_rwsem_write(cpu))) 1781 if (unlikely(lock_policy_rwsem_write(cpu)))
1780 BUG(); 1782 BUG();
1781 1783
1782 __cpufreq_remove_dev(sys_dev); 1784 __cpufreq_remove_dev(dev, NULL);
1783 break; 1785 break;
1784 case CPU_DOWN_FAILED: 1786 case CPU_DOWN_FAILED:
1785 case CPU_DOWN_FAILED_FROZEN: 1787 case CPU_DOWN_FAILED_FROZEN:
1786 cpufreq_add_dev(sys_dev); 1788 cpufreq_add_dev(dev, NULL);
1787 break; 1789 break;
1788 } 1790 }
1789 } 1791 }
@@ -1830,8 +1832,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1830 cpufreq_driver = driver_data; 1832 cpufreq_driver = driver_data;
1831 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1833 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1832 1834
1833 ret = sysdev_driver_register(&cpu_sysdev_class, 1835 ret = subsys_interface_register(&cpufreq_interface);
1834 &cpufreq_sysdev_driver);
1835 if (ret) 1836 if (ret)
1836 goto err_null_driver; 1837 goto err_null_driver;
1837 1838
@@ -1850,7 +1851,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1850 if (ret) { 1851 if (ret) {
1851 pr_debug("no CPU initialized for driver %s\n", 1852 pr_debug("no CPU initialized for driver %s\n",
1852 driver_data->name); 1853 driver_data->name);
1853 goto err_sysdev_unreg; 1854 goto err_if_unreg;
1854 } 1855 }
1855 } 1856 }
1856 1857
@@ -1858,9 +1859,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1858 pr_debug("driver %s up and running\n", driver_data->name); 1859 pr_debug("driver %s up and running\n", driver_data->name);
1859 1860
1860 return 0; 1861 return 0;
1861err_sysdev_unreg: 1862err_if_unreg:
1862 sysdev_driver_unregister(&cpu_sysdev_class, 1863 subsys_interface_unregister(&cpufreq_interface);
1863 &cpufreq_sysdev_driver);
1864err_null_driver: 1864err_null_driver:
1865 spin_lock_irqsave(&cpufreq_driver_lock, flags); 1865 spin_lock_irqsave(&cpufreq_driver_lock, flags);
1866 cpufreq_driver = NULL; 1866 cpufreq_driver = NULL;
@@ -1887,7 +1887,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
1887 1887
1888 pr_debug("unregistering driver %s\n", driver->name); 1888 pr_debug("unregistering driver %s\n", driver->name);
1889 1889
1890 sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); 1890 subsys_interface_unregister(&cpufreq_interface);
1891 unregister_hotcpu_notifier(&cpufreq_cpu_notifier); 1891 unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
1892 1892
1893 spin_lock_irqsave(&cpufreq_driver_lock, flags); 1893 spin_lock_irqsave(&cpufreq_driver_lock, flags);
@@ -1907,8 +1907,7 @@ static int __init cpufreq_core_init(void)
1907 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); 1907 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));
1908 } 1908 }
1909 1909
1910 cpufreq_global_kobject = kobject_create_and_add("cpufreq", 1910 cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
1911 &cpu_sysdev_class.kset.kobj);
1912 BUG_ON(!cpufreq_global_kobject); 1911 BUG_ON(!cpufreq_global_kobject);
1913 register_syscore_ops(&cpufreq_syscore_ops); 1912 register_syscore_ops(&cpufreq_syscore_ops);
1914 1913
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 2a508edd768b..b40ee1403be9 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/sysdev.h>
15#include <linux/cpu.h> 14#include <linux/cpu.h>
16#include <linux/sysfs.h> 15#include <linux/sysfs.h>
17#include <linux/cpufreq.h> 16#include <linux/cpufreq.h>