diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-21 17:29:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-21 17:29:42 -0500 |
commit | 8a25a2fd126c621f44f3aeaef80d51f00fc11639 (patch) | |
tree | 41694ab1a9c82a7a02d9cd33c929fd039c98c815 /arch/avr32/kernel/cpu.c | |
parent | cb0c05c5fae12eeb7c85c205578df277bd706155 (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/avr32/kernel/cpu.c')
-rw-r--r-- | arch/avr32/kernel/cpu.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c index e84faffbbeca..2233be71e2e8 100644 --- a/arch/avr32/kernel/cpu.c +++ b/arch/avr32/kernel/cpu.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/sysdev.h> | 9 | #include <linux/device.h> |
10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
11 | #include <linux/cpu.h> | 11 | #include <linux/cpu.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
@@ -26,16 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be | 26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be |
27 | * made, we must make sure that the code executes on the correct CPU. | 27 | * made, we must make sure that the code executes on the correct CPU. |
28 | */ | 28 | */ |
29 | static ssize_t show_pc0event(struct sys_device *dev, | 29 | static ssize_t show_pc0event(struct device *dev, |
30 | struct sysdev_attribute *attr, char *buf) | 30 | struct device_attribute *attr, char *buf) |
31 | { | 31 | { |
32 | unsigned long pccr; | 32 | unsigned long pccr; |
33 | 33 | ||
34 | pccr = sysreg_read(PCCR); | 34 | pccr = sysreg_read(PCCR); |
35 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); | 35 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); |
36 | } | 36 | } |
37 | static ssize_t store_pc0event(struct sys_device *dev, | 37 | static ssize_t store_pc0event(struct device *dev, |
38 | struct sysdev_attribute *attr, const char *buf, | 38 | struct device_attribute *attr, const char *buf, |
39 | size_t count) | 39 | size_t count) |
40 | { | 40 | { |
41 | unsigned long val; | 41 | unsigned long val; |
@@ -48,16 +48,16 @@ static ssize_t store_pc0event(struct sys_device *dev, | |||
48 | sysreg_write(PCCR, val); | 48 | sysreg_write(PCCR, val); |
49 | return count; | 49 | return count; |
50 | } | 50 | } |
51 | static ssize_t show_pc0count(struct sys_device *dev, | 51 | static ssize_t show_pc0count(struct device *dev, |
52 | struct sysdev_attribute *attr, char *buf) | 52 | struct device_attribute *attr, char *buf) |
53 | { | 53 | { |
54 | unsigned long pcnt0; | 54 | unsigned long pcnt0; |
55 | 55 | ||
56 | pcnt0 = sysreg_read(PCNT0); | 56 | pcnt0 = sysreg_read(PCNT0); |
57 | return sprintf(buf, "%lu\n", pcnt0); | 57 | return sprintf(buf, "%lu\n", pcnt0); |
58 | } | 58 | } |
59 | static ssize_t store_pc0count(struct sys_device *dev, | 59 | static ssize_t store_pc0count(struct device *dev, |
60 | struct sysdev_attribute *attr, | 60 | struct device_attribute *attr, |
61 | const char *buf, size_t count) | 61 | const char *buf, size_t count) |
62 | { | 62 | { |
63 | unsigned long val; | 63 | unsigned long val; |
@@ -71,16 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev, | |||
71 | return count; | 71 | return count; |
72 | } | 72 | } |
73 | 73 | ||
74 | static ssize_t show_pc1event(struct sys_device *dev, | 74 | static ssize_t show_pc1event(struct device *dev, |
75 | struct sysdev_attribute *attr, char *buf) | 75 | struct device_attribute *attr, char *buf) |
76 | { | 76 | { |
77 | unsigned long pccr; | 77 | unsigned long pccr; |
78 | 78 | ||
79 | pccr = sysreg_read(PCCR); | 79 | pccr = sysreg_read(PCCR); |
80 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); | 80 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); |
81 | } | 81 | } |
82 | static ssize_t store_pc1event(struct sys_device *dev, | 82 | static ssize_t store_pc1event(struct device *dev, |
83 | struct sysdev_attribute *attr, const char *buf, | 83 | struct device_attribute *attr, const char *buf, |
84 | size_t count) | 84 | size_t count) |
85 | { | 85 | { |
86 | unsigned long val; | 86 | unsigned long val; |
@@ -93,16 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev, | |||
93 | sysreg_write(PCCR, val); | 93 | sysreg_write(PCCR, val); |
94 | return count; | 94 | return count; |
95 | } | 95 | } |
96 | static ssize_t show_pc1count(struct sys_device *dev, | 96 | static ssize_t show_pc1count(struct device *dev, |
97 | struct sysdev_attribute *attr, char *buf) | 97 | struct device_attribute *attr, char *buf) |
98 | { | 98 | { |
99 | unsigned long pcnt1; | 99 | unsigned long pcnt1; |
100 | 100 | ||
101 | pcnt1 = sysreg_read(PCNT1); | 101 | pcnt1 = sysreg_read(PCNT1); |
102 | return sprintf(buf, "%lu\n", pcnt1); | 102 | return sprintf(buf, "%lu\n", pcnt1); |
103 | } | 103 | } |
104 | static ssize_t store_pc1count(struct sys_device *dev, | 104 | static ssize_t store_pc1count(struct device *dev, |
105 | struct sysdev_attribute *attr, const char *buf, | 105 | struct device_attribute *attr, const char *buf, |
106 | size_t count) | 106 | size_t count) |
107 | { | 107 | { |
108 | unsigned long val; | 108 | unsigned long val; |
@@ -116,16 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev, | |||
116 | return count; | 116 | return count; |
117 | } | 117 | } |
118 | 118 | ||
119 | static ssize_t show_pccycles(struct sys_device *dev, | 119 | static ssize_t show_pccycles(struct device *dev, |
120 | struct sysdev_attribute *attr, char *buf) | 120 | struct device_attribute *attr, char *buf) |
121 | { | 121 | { |
122 | unsigned long pccnt; | 122 | unsigned long pccnt; |
123 | 123 | ||
124 | pccnt = sysreg_read(PCCNT); | 124 | pccnt = sysreg_read(PCCNT); |
125 | return sprintf(buf, "%lu\n", pccnt); | 125 | return sprintf(buf, "%lu\n", pccnt); |
126 | } | 126 | } |
127 | static ssize_t store_pccycles(struct sys_device *dev, | 127 | static ssize_t store_pccycles(struct device *dev, |
128 | struct sysdev_attribute *attr, const char *buf, | 128 | struct device_attribute *attr, const char *buf, |
129 | size_t count) | 129 | size_t count) |
130 | { | 130 | { |
131 | unsigned long val; | 131 | unsigned long val; |
@@ -139,16 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev, | |||
139 | return count; | 139 | return count; |
140 | } | 140 | } |
141 | 141 | ||
142 | static ssize_t show_pcenable(struct sys_device *dev, | 142 | static ssize_t show_pcenable(struct device *dev, |
143 | struct sysdev_attribute *attr, char *buf) | 143 | struct device_attribute *attr, char *buf) |
144 | { | 144 | { |
145 | unsigned long pccr; | 145 | unsigned long pccr; |
146 | 146 | ||
147 | pccr = sysreg_read(PCCR); | 147 | pccr = sysreg_read(PCCR); |
148 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); | 148 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); |
149 | } | 149 | } |
150 | static ssize_t store_pcenable(struct sys_device *dev, | 150 | static ssize_t store_pcenable(struct device *dev, |
151 | struct sysdev_attribute *attr, const char *buf, | 151 | struct device_attribute *attr, const char *buf, |
152 | size_t count) | 152 | size_t count) |
153 | { | 153 | { |
154 | unsigned long pccr, val; | 154 | unsigned long pccr, val; |
@@ -167,12 +167,12 @@ static ssize_t store_pcenable(struct sys_device *dev, | |||
167 | return count; | 167 | return count; |
168 | } | 168 | } |
169 | 169 | ||
170 | static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event); | 170 | static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event); |
171 | static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count); | 171 | static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count); |
172 | static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event); | 172 | static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event); |
173 | static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count); | 173 | static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count); |
174 | static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles); | 174 | static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles); |
175 | static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable); | 175 | static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable); |
176 | 176 | ||
177 | #endif /* CONFIG_PERFORMANCE_COUNTERS */ | 177 | #endif /* CONFIG_PERFORMANCE_COUNTERS */ |
178 | 178 | ||
@@ -186,12 +186,12 @@ static int __init topology_init(void) | |||
186 | register_cpu(c, cpu); | 186 | register_cpu(c, cpu); |
187 | 187 | ||
188 | #ifdef CONFIG_PERFORMANCE_COUNTERS | 188 | #ifdef CONFIG_PERFORMANCE_COUNTERS |
189 | sysdev_create_file(&c->sysdev, &attr_pc0event); | 189 | device_create_file(&c->dev, &dev_attr_pc0event); |
190 | sysdev_create_file(&c->sysdev, &attr_pc0count); | 190 | device_create_file(&c->dev, &dev_attr_pc0count); |
191 | sysdev_create_file(&c->sysdev, &attr_pc1event); | 191 | device_create_file(&c->dev, &dev_attr_pc1event); |
192 | sysdev_create_file(&c->sysdev, &attr_pc1count); | 192 | device_create_file(&c->dev, &dev_attr_pc1count); |
193 | sysdev_create_file(&c->sysdev, &attr_pccycles); | 193 | device_create_file(&c->dev, &dev_attr_pccycles); |
194 | sysdev_create_file(&c->sysdev, &attr_pcenable); | 194 | device_create_file(&c->dev, &dev_attr_pcenable); |
195 | #endif | 195 | #endif |
196 | } | 196 | } |
197 | 197 | ||