aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/topology.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-21 17:29:42 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-21 17:29:42 -0500
commit8a25a2fd126c621f44f3aeaef80d51f00fc11639 (patch)
tree41694ab1a9c82a7a02d9cd33c929fd039c98c815 /drivers/base/topology.c
parentcb0c05c5fae12eeb7c85c205578df277bd706155 (diff)
cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem
This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem and converts the devices to regular devices. The sysdev drivers are implemented as subsystem interfaces now. After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Userspace relies on events and generic sysfs subsystem infrastructure from sysdev devices, which are made available with this conversion. Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Borislav Petkov <bp@amd64.org> Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk> Cc: Len Brown <lenb@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Dave Jones <davej@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/topology.c')
-rw-r--r--drivers/base/topology.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index f6f37a05a0c..ae989c57cd5 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -23,7 +23,6 @@
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * 24 *
25 */ 25 */
26#include <linux/sysdev.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/cpu.h> 28#include <linux/cpu.h>
@@ -32,14 +31,14 @@
32#include <linux/topology.h> 31#include <linux/topology.h>
33 32
34#define define_one_ro_named(_name, _func) \ 33#define define_one_ro_named(_name, _func) \
35static SYSDEV_ATTR(_name, 0444, _func, NULL) 34 static DEVICE_ATTR(_name, 0444, _func, NULL)
36 35
37#define define_one_ro(_name) \ 36#define define_one_ro(_name) \
38static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) 37 static DEVICE_ATTR(_name, 0444, show_##_name, NULL)
39 38
40#define define_id_show_func(name) \ 39#define define_id_show_func(name) \
41static ssize_t show_##name(struct sys_device *dev, \ 40static ssize_t show_##name(struct device *dev, \
42 struct sysdev_attribute *attr, char *buf) \ 41 struct device_attribute *attr, char *buf) \
43{ \ 42{ \
44 unsigned int cpu = dev->id; \ 43 unsigned int cpu = dev->id; \
45 return sprintf(buf, "%d\n", topology_##name(cpu)); \ 44 return sprintf(buf, "%d\n", topology_##name(cpu)); \
@@ -65,16 +64,16 @@ static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf)
65 64
66#ifdef arch_provides_topology_pointers 65#ifdef arch_provides_topology_pointers
67#define define_siblings_show_map(name) \ 66#define define_siblings_show_map(name) \
68static ssize_t show_##name(struct sys_device *dev, \ 67static ssize_t show_##name(struct device *dev, \
69 struct sysdev_attribute *attr, char *buf) \ 68 struct device_attribute *attr, char *buf) \
70{ \ 69{ \
71 unsigned int cpu = dev->id; \ 70 unsigned int cpu = dev->id; \
72 return show_cpumap(0, topology_##name(cpu), buf); \ 71 return show_cpumap(0, topology_##name(cpu), buf); \
73} 72}
74 73
75#define define_siblings_show_list(name) \ 74#define define_siblings_show_list(name) \
76static ssize_t show_##name##_list(struct sys_device *dev, \ 75static ssize_t show_##name##_list(struct device *dev, \
77 struct sysdev_attribute *attr, \ 76 struct device_attribute *attr, \
78 char *buf) \ 77 char *buf) \
79{ \ 78{ \
80 unsigned int cpu = dev->id; \ 79 unsigned int cpu = dev->id; \
@@ -83,15 +82,15 @@ static ssize_t show_##name##_list(struct sys_device *dev, \
83 82
84#else 83#else
85#define define_siblings_show_map(name) \ 84#define define_siblings_show_map(name) \
86static ssize_t show_##name(struct sys_device *dev, \ 85static ssize_t show_##name(struct device *dev, \
87 struct sysdev_attribute *attr, char *buf) \ 86 struct device_attribute *attr, char *buf) \
88{ \ 87{ \
89 return show_cpumap(0, topology_##name(dev->id), buf); \ 88 return show_cpumap(0, topology_##name(dev->id), buf); \
90} 89}
91 90
92#define define_siblings_show_list(name) \ 91#define define_siblings_show_list(name) \
93static ssize_t show_##name##_list(struct sys_device *dev, \ 92static ssize_t show_##name##_list(struct device *dev, \
94 struct sysdev_attribute *attr, \ 93 struct device_attribute *attr, \
95 char *buf) \ 94 char *buf) \
96{ \ 95{ \
97 return show_cpumap(1, topology_##name(dev->id), buf); \ 96 return show_cpumap(1, topology_##name(dev->id), buf); \
@@ -124,16 +123,16 @@ define_one_ro_named(book_siblings_list, show_book_cpumask_list);
124#endif 123#endif
125 124
126static struct attribute *default_attrs[] = { 125static struct attribute *default_attrs[] = {
127 &attr_physical_package_id.attr, 126 &dev_attr_physical_package_id.attr,
128 &attr_core_id.attr, 127 &dev_attr_core_id.attr,
129 &attr_thread_siblings.attr, 128 &dev_attr_thread_siblings.attr,
130 &attr_thread_siblings_list.attr, 129 &dev_attr_thread_siblings_list.attr,
131 &attr_core_siblings.attr, 130 &dev_attr_core_siblings.attr,
132 &attr_core_siblings_list.attr, 131 &dev_attr_core_siblings_list.attr,
133#ifdef CONFIG_SCHED_BOOK 132#ifdef CONFIG_SCHED_BOOK
134 &attr_book_id.attr, 133 &dev_attr_book_id.attr,
135 &attr_book_siblings.attr, 134 &dev_attr_book_siblings.attr,
136 &attr_book_siblings_list.attr, 135 &dev_attr_book_siblings_list.attr,
137#endif 136#endif
138 NULL 137 NULL
139}; 138};
@@ -146,16 +145,16 @@ static struct attribute_group topology_attr_group = {
146/* Add/Remove cpu_topology interface for CPU device */ 145/* Add/Remove cpu_topology interface for CPU device */
147static int __cpuinit topology_add_dev(unsigned int cpu) 146static int __cpuinit topology_add_dev(unsigned int cpu)
148{ 147{
149 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 148 struct device *dev = get_cpu_device(cpu);
150 149
151 return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); 150 return sysfs_create_group(&dev->kobj, &topology_attr_group);
152} 151}
153 152
154static void __cpuinit topology_remove_dev(unsigned int cpu) 153static void __cpuinit topology_remove_dev(unsigned int cpu)
155{ 154{
156 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 155 struct device *dev = get_cpu_device(cpu);
157 156
158 sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); 157 sysfs_remove_group(&dev->kobj, &topology_attr_group);
159} 158}
160 159
161static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, 160static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,