aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile
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 /arch/tile
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 'arch/tile')
-rw-r--r--arch/tile/kernel/sysfs.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index b671a86f4515..e7ce2a5161b8 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -14,7 +14,7 @@
14 * /sys entry support. 14 * /sys entry support.
15 */ 15 */
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
@@ -31,55 +31,55 @@ static ssize_t get_hv_confstr(char *page, int query)
31 return n; 31 return n;
32} 32}
33 33
34static ssize_t chip_width_show(struct sysdev_class *dev, 34static ssize_t chip_width_show(struct device *dev,
35 struct sysdev_class_attribute *attr, 35 struct device_attribute *attr,
36 char *page) 36 char *page)
37{ 37{
38 return sprintf(page, "%u\n", smp_width); 38 return sprintf(page, "%u\n", smp_width);
39} 39}
40static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL); 40static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
41 41
42static ssize_t chip_height_show(struct sysdev_class *dev, 42static ssize_t chip_height_show(struct device *dev,
43 struct sysdev_class_attribute *attr, 43 struct device_attribute *attr,
44 char *page) 44 char *page)
45{ 45{
46 return sprintf(page, "%u\n", smp_height); 46 return sprintf(page, "%u\n", smp_height);
47} 47}
48static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL); 48static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
49 49
50static ssize_t chip_serial_show(struct sysdev_class *dev, 50static ssize_t chip_serial_show(struct device *dev,
51 struct sysdev_class_attribute *attr, 51 struct device_attribute *attr,
52 char *page) 52 char *page)
53{ 53{
54 return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM); 54 return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
55} 55}
56static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL); 56static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
57 57
58static ssize_t chip_revision_show(struct sysdev_class *dev, 58static ssize_t chip_revision_show(struct device *dev,
59 struct sysdev_class_attribute *attr, 59 struct device_attribute *attr,
60 char *page) 60 char *page)
61{ 61{
62 return get_hv_confstr(page, HV_CONFSTR_CHIP_REV); 62 return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
63} 63}
64static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL); 64static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
65 65
66 66
67static ssize_t type_show(struct sysdev_class *dev, 67static ssize_t type_show(struct device *dev,
68 struct sysdev_class_attribute *attr, 68 struct device_attribute *attr,
69 char *page) 69 char *page)
70{ 70{
71 return sprintf(page, "tilera\n"); 71 return sprintf(page, "tilera\n");
72} 72}
73static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL); 73static DEVICE_ATTR(type, 0444, type_show, NULL);
74 74
75#define HV_CONF_ATTR(name, conf) \ 75#define HV_CONF_ATTR(name, conf) \
76 static ssize_t name ## _show(struct sysdev_class *dev, \ 76 static ssize_t name ## _show(struct device *dev, \
77 struct sysdev_class_attribute *attr, \ 77 struct device_attribute *attr, \
78 char *page) \ 78 char *page) \
79 { \ 79 { \
80 return get_hv_confstr(page, conf); \ 80 return get_hv_confstr(page, conf); \
81 } \ 81 } \
82 static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL); 82 static DEVICE_ATTR(name, 0444, name ## _show, NULL);
83 83
84HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER) 84HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER)
85HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER) 85HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER)
@@ -95,15 +95,15 @@ HV_CONF_ATTR(mezz_description, HV_CONFSTR_MEZZ_DESC)
95HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL) 95HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL)
96 96
97static struct attribute *board_attrs[] = { 97static struct attribute *board_attrs[] = {
98 &attr_board_part.attr, 98 &dev_attr_board_part.attr,
99 &attr_board_serial.attr, 99 &dev_attr_board_serial.attr,
100 &attr_board_revision.attr, 100 &dev_attr_board_revision.attr,
101 &attr_board_description.attr, 101 &dev_attr_board_description.attr,
102 &attr_mezz_part.attr, 102 &dev_attr_mezz_part.attr,
103 &attr_mezz_serial.attr, 103 &dev_attr_mezz_serial.attr,
104 &attr_mezz_revision.attr, 104 &dev_attr_mezz_revision.attr,
105 &attr_mezz_description.attr, 105 &dev_attr_mezz_description.attr,
106 &attr_switch_control.attr, 106 &dev_attr_switch_control.attr,
107 NULL 107 NULL
108}; 108};
109 109
@@ -150,12 +150,11 @@ hvconfig_bin_read(struct file *filp, struct kobject *kobj,
150 150
151static int __init create_sysfs_entries(void) 151static int __init create_sysfs_entries(void)
152{ 152{
153 struct sysdev_class *cls = &cpu_sysdev_class;
154 int err = 0; 153 int err = 0;
155 154
156#define create_cpu_attr(name) \ 155#define create_cpu_attr(name) \
157 if (!err) \ 156 if (!err) \
158 err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr); 157 err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name);
159 create_cpu_attr(chip_width); 158 create_cpu_attr(chip_width);
160 create_cpu_attr(chip_height); 159 create_cpu_attr(chip_height);
161 create_cpu_attr(chip_serial); 160 create_cpu_attr(chip_serial);
@@ -163,7 +162,7 @@ static int __init create_sysfs_entries(void)
163 162
164#define create_hv_attr(name) \ 163#define create_hv_attr(name) \
165 if (!err) \ 164 if (!err) \
166 err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr); 165 err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name);
167 create_hv_attr(type); 166 create_hv_attr(type);
168 create_hv_attr(version); 167 create_hv_attr(version);
169 create_hv_attr(config_version); 168 create_hv_attr(config_version);