aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
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 /arch/powerpc/kernel
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 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/sysfs.c267
3 files changed, 139 insertions, 140 deletions
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index a3c684b4c862..92c6b008dd2b 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -451,15 +451,15 @@ out:
451static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) 451static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id)
452{ 452{
453 struct cache_dir *cache_dir; 453 struct cache_dir *cache_dir;
454 struct sys_device *sysdev; 454 struct device *dev;
455 struct kobject *kobj = NULL; 455 struct kobject *kobj = NULL;
456 456
457 sysdev = get_cpu_sysdev(cpu_id); 457 dev = get_cpu_device(cpu_id);
458 WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); 458 WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id);
459 if (!sysdev) 459 if (!dev)
460 goto err; 460 goto err;
461 461
462 kobj = kobject_create_and_add("cache", &sysdev->kobj); 462 kobj = kobject_create_and_add("cache", &dev->kobj);
463 if (!kobj) 463 if (!kobj)
464 goto err; 464 goto err;
465 465
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index f0abe92f63f2..46695febc09f 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -27,7 +27,7 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/sysdev.h> 30#include <linux/device.h>
31#include <linux/cpu.h> 31#include <linux/cpu.h>
32#include <linux/notifier.h> 32#include <linux/notifier.h>
33#include <linux/topology.h> 33#include <linux/topology.h>
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 6fdf5ffe8c44..883e74c0d1b3 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -1,4 +1,4 @@
1#include <linux/sysdev.h> 1#include <linux/device.h>
2#include <linux/cpu.h> 2#include <linux/cpu.h>
3#include <linux/smp.h> 3#include <linux/smp.h>
4#include <linux/percpu.h> 4#include <linux/percpu.h>
@@ -38,12 +38,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
38/* Time in microseconds we delay before sleeping in the idle loop */ 38/* Time in microseconds we delay before sleeping in the idle loop */
39DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; 39DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
40 40
41static ssize_t store_smt_snooze_delay(struct sys_device *dev, 41static ssize_t store_smt_snooze_delay(struct device *dev,
42 struct sysdev_attribute *attr, 42 struct device_attribute *attr,
43 const char *buf, 43 const char *buf,
44 size_t count) 44 size_t count)
45{ 45{
46 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 46 struct cpu *cpu = container_of(dev, struct cpu, dev);
47 ssize_t ret; 47 ssize_t ret;
48 long snooze; 48 long snooze;
49 49
@@ -51,22 +51,22 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev,
51 if (ret != 1) 51 if (ret != 1)
52 return -EINVAL; 52 return -EINVAL;
53 53
54 per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; 54 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
55 update_smt_snooze_delay(snooze); 55 update_smt_snooze_delay(snooze);
56 56
57 return count; 57 return count;
58} 58}
59 59
60static ssize_t show_smt_snooze_delay(struct sys_device *dev, 60static ssize_t show_smt_snooze_delay(struct device *dev,
61 struct sysdev_attribute *attr, 61 struct device_attribute *attr,
62 char *buf) 62 char *buf)
63{ 63{
64 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 64 struct cpu *cpu = container_of(dev, struct cpu, dev);
65 65
66 return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); 66 return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
67} 67}
68 68
69static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, 69static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
70 store_smt_snooze_delay); 70 store_smt_snooze_delay);
71 71
72static int __init setup_smt_snooze_delay(char *str) 72static int __init setup_smt_snooze_delay(char *str)
@@ -119,25 +119,25 @@ static void write_##NAME(void *val) \
119 ppc_enable_pmcs(); \ 119 ppc_enable_pmcs(); \
120 mtspr(ADDRESS, *(unsigned long *)val); \ 120 mtspr(ADDRESS, *(unsigned long *)val); \
121} \ 121} \
122static ssize_t show_##NAME(struct sys_device *dev, \ 122static ssize_t show_##NAME(struct device *dev, \
123 struct sysdev_attribute *attr, \ 123 struct device_attribute *attr, \
124 char *buf) \ 124 char *buf) \
125{ \ 125{ \
126 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 126 struct cpu *cpu = container_of(dev, struct cpu, dev); \
127 unsigned long val; \ 127 unsigned long val; \
128 smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ 128 smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \
129 return sprintf(buf, "%lx\n", val); \ 129 return sprintf(buf, "%lx\n", val); \
130} \ 130} \
131static ssize_t __used \ 131static ssize_t __used \
132 store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ 132 store_##NAME(struct device *dev, struct device_attribute *attr, \
133 const char *buf, size_t count) \ 133 const char *buf, size_t count) \
134{ \ 134{ \
135 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 135 struct cpu *cpu = container_of(dev, struct cpu, dev); \
136 unsigned long val; \ 136 unsigned long val; \
137 int ret = sscanf(buf, "%lx", &val); \ 137 int ret = sscanf(buf, "%lx", &val); \
138 if (ret != 1) \ 138 if (ret != 1) \
139 return -EINVAL; \ 139 return -EINVAL; \
140 smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ 140 smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
141 return count; \ 141 return count; \
142} 142}
143 143
@@ -181,23 +181,23 @@ SYSFS_PMCSETUP(spurr, SPRN_SPURR);
181SYSFS_PMCSETUP(dscr, SPRN_DSCR); 181SYSFS_PMCSETUP(dscr, SPRN_DSCR);
182SYSFS_PMCSETUP(pir, SPRN_PIR); 182SYSFS_PMCSETUP(pir, SPRN_PIR);
183 183
184static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 184static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
185static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); 185static DEVICE_ATTR(spurr, 0600, show_spurr, NULL);
186static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); 186static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
187static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); 187static DEVICE_ATTR(purr, 0600, show_purr, store_purr);
188static SYSDEV_ATTR(pir, 0400, show_pir, NULL); 188static DEVICE_ATTR(pir, 0400, show_pir, NULL);
189 189
190unsigned long dscr_default = 0; 190unsigned long dscr_default = 0;
191EXPORT_SYMBOL(dscr_default); 191EXPORT_SYMBOL(dscr_default);
192 192
193static ssize_t show_dscr_default(struct sysdev_class *class, 193static ssize_t show_dscr_default(struct device *dev,
194 struct sysdev_class_attribute *attr, char *buf) 194 struct device_attribute *attr, char *buf)
195{ 195{
196 return sprintf(buf, "%lx\n", dscr_default); 196 return sprintf(buf, "%lx\n", dscr_default);
197} 197}
198 198
199static ssize_t __used store_dscr_default(struct sysdev_class *class, 199static ssize_t __used store_dscr_default(struct device *dev,
200 struct sysdev_class_attribute *attr, const char *buf, 200 struct device_attribute *attr, const char *buf,
201 size_t count) 201 size_t count)
202{ 202{
203 unsigned long val; 203 unsigned long val;
@@ -211,15 +211,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class,
211 return count; 211 return count;
212} 212}
213 213
214static SYSDEV_CLASS_ATTR(dscr_default, 0600, 214static DEVICE_ATTR(dscr_default, 0600,
215 show_dscr_default, store_dscr_default); 215 show_dscr_default, store_dscr_default);
216 216
217static void sysfs_create_dscr_default(void) 217static void sysfs_create_dscr_default(void)
218{ 218{
219 int err = 0; 219 int err = 0;
220 if (cpu_has_feature(CPU_FTR_DSCR)) 220 if (cpu_has_feature(CPU_FTR_DSCR))
221 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 221 err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
222 &attr_dscr_default.attr);
223} 222}
224#endif /* CONFIG_PPC64 */ 223#endif /* CONFIG_PPC64 */
225 224
@@ -263,72 +262,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
263#endif /* HAS_PPC_PMC_PA6T */ 262#endif /* HAS_PPC_PMC_PA6T */
264 263
265#ifdef HAS_PPC_PMC_IBM 264#ifdef HAS_PPC_PMC_IBM
266static struct sysdev_attribute ibm_common_attrs[] = { 265static struct device_attribute ibm_common_attrs[] = {
267 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 266 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
268 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 267 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
269}; 268};
270#endif /* HAS_PPC_PMC_G4 */ 269#endif /* HAS_PPC_PMC_G4 */
271 270
272#ifdef HAS_PPC_PMC_G4 271#ifdef HAS_PPC_PMC_G4
273static struct sysdev_attribute g4_common_attrs[] = { 272static struct device_attribute g4_common_attrs[] = {
274 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 273 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
275 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 274 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
276 _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), 275 __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
277}; 276};
278#endif /* HAS_PPC_PMC_G4 */ 277#endif /* HAS_PPC_PMC_G4 */
279 278
280static struct sysdev_attribute classic_pmc_attrs[] = { 279static struct device_attribute classic_pmc_attrs[] = {
281 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), 280 __ATTR(pmc1, 0600, show_pmc1, store_pmc1),
282 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), 281 __ATTR(pmc2, 0600, show_pmc2, store_pmc2),
283 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), 282 __ATTR(pmc3, 0600, show_pmc3, store_pmc3),
284 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), 283 __ATTR(pmc4, 0600, show_pmc4, store_pmc4),
285 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), 284 __ATTR(pmc5, 0600, show_pmc5, store_pmc5),
286 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), 285 __ATTR(pmc6, 0600, show_pmc6, store_pmc6),
287#ifdef CONFIG_PPC64 286#ifdef CONFIG_PPC64
288 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), 287 __ATTR(pmc7, 0600, show_pmc7, store_pmc7),
289 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), 288 __ATTR(pmc8, 0600, show_pmc8, store_pmc8),
290#endif 289#endif
291}; 290};
292 291
293#ifdef HAS_PPC_PMC_PA6T 292#ifdef HAS_PPC_PMC_PA6T
294static struct sysdev_attribute pa6t_attrs[] = { 293static struct device_attribute pa6t_attrs[] = {
295 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 294 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
296 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 295 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
297 _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), 296 __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0),
298 _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), 297 __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1),
299 _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), 298 __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2),
300 _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), 299 __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
301 _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), 300 __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
302 _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), 301 __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
303#ifdef CONFIG_DEBUG_KERNEL 302#ifdef CONFIG_DEBUG_KERNEL
304 _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), 303 __ATTR(hid0, 0600, show_hid0, store_hid0),
305 _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), 304 __ATTR(hid1, 0600, show_hid1, store_hid1),
306 _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), 305 __ATTR(hid4, 0600, show_hid4, store_hid4),
307 _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), 306 __ATTR(hid5, 0600, show_hid5, store_hid5),
308 _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), 307 __ATTR(ima0, 0600, show_ima0, store_ima0),
309 _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), 308 __ATTR(ima1, 0600, show_ima1, store_ima1),
310 _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), 309 __ATTR(ima2, 0600, show_ima2, store_ima2),
311 _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), 310 __ATTR(ima3, 0600, show_ima3, store_ima3),
312 _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), 311 __ATTR(ima4, 0600, show_ima4, store_ima4),
313 _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), 312 __ATTR(ima5, 0600, show_ima5, store_ima5),
314 _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), 313 __ATTR(ima6, 0600, show_ima6, store_ima6),
315 _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), 314 __ATTR(ima7, 0600, show_ima7, store_ima7),
316 _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), 315 __ATTR(ima8, 0600, show_ima8, store_ima8),
317 _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), 316 __ATTR(ima9, 0600, show_ima9, store_ima9),
318 _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), 317 __ATTR(imaat, 0600, show_imaat, store_imaat),
319 _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), 318 __ATTR(btcr, 0600, show_btcr, store_btcr),
320 _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), 319 __ATTR(pccr, 0600, show_pccr, store_pccr),
321 _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), 320 __ATTR(rpccr, 0600, show_rpccr, store_rpccr),
322 _SYSDEV_ATTR(der, 0600, show_der, store_der), 321 __ATTR(der, 0600, show_der, store_der),
323 _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), 322 __ATTR(mer, 0600, show_mer, store_mer),
324 _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), 323 __ATTR(ber, 0600, show_ber, store_ber),
325 _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), 324 __ATTR(ier, 0600, show_ier, store_ier),
326 _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), 325 __ATTR(sier, 0600, show_sier, store_sier),
327 _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), 326 __ATTR(siar, 0600, show_siar, store_siar),
328 _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), 327 __ATTR(tsr0, 0600, show_tsr0, store_tsr0),
329 _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), 328 __ATTR(tsr1, 0600, show_tsr1, store_tsr1),
330 _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), 329 __ATTR(tsr2, 0600, show_tsr2, store_tsr2),
331 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), 330 __ATTR(tsr3, 0600, show_tsr3, store_tsr3),
332#endif /* CONFIG_DEBUG_KERNEL */ 331#endif /* CONFIG_DEBUG_KERNEL */
333}; 332};
334#endif /* HAS_PPC_PMC_PA6T */ 333#endif /* HAS_PPC_PMC_PA6T */
@@ -337,14 +336,14 @@ static struct sysdev_attribute pa6t_attrs[] = {
337static void __cpuinit register_cpu_online(unsigned int cpu) 336static void __cpuinit register_cpu_online(unsigned int cpu)
338{ 337{
339 struct cpu *c = &per_cpu(cpu_devices, cpu); 338 struct cpu *c = &per_cpu(cpu_devices, cpu);
340 struct sys_device *s = &c->sysdev; 339 struct device *s = &c->dev;
341 struct sysdev_attribute *attrs, *pmc_attrs; 340 struct device_attribute *attrs, *pmc_attrs;
342 int i, nattrs; 341 int i, nattrs;
343 342
344#ifdef CONFIG_PPC64 343#ifdef CONFIG_PPC64
345 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 344 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
346 cpu_has_feature(CPU_FTR_SMT)) 345 cpu_has_feature(CPU_FTR_SMT))
347 sysdev_create_file(s, &attr_smt_snooze_delay); 346 device_create_file(s, &dev_attr_smt_snooze_delay);
348#endif 347#endif
349 348
350 /* PMC stuff */ 349 /* PMC stuff */
@@ -352,14 +351,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
352#ifdef HAS_PPC_PMC_IBM 351#ifdef HAS_PPC_PMC_IBM
353 case PPC_PMC_IBM: 352 case PPC_PMC_IBM:
354 attrs = ibm_common_attrs; 353 attrs = ibm_common_attrs;
355 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 354 nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
356 pmc_attrs = classic_pmc_attrs; 355 pmc_attrs = classic_pmc_attrs;
357 break; 356 break;
358#endif /* HAS_PPC_PMC_IBM */ 357#endif /* HAS_PPC_PMC_IBM */
359#ifdef HAS_PPC_PMC_G4 358#ifdef HAS_PPC_PMC_G4
360 case PPC_PMC_G4: 359 case PPC_PMC_G4:
361 attrs = g4_common_attrs; 360 attrs = g4_common_attrs;
362 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 361 nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
363 pmc_attrs = classic_pmc_attrs; 362 pmc_attrs = classic_pmc_attrs;
364 break; 363 break;
365#endif /* HAS_PPC_PMC_G4 */ 364#endif /* HAS_PPC_PMC_G4 */
@@ -367,7 +366,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
367 case PPC_PMC_PA6T: 366 case PPC_PMC_PA6T:
368 /* PA Semi starts counting at PMC0 */ 367 /* PA Semi starts counting at PMC0 */
369 attrs = pa6t_attrs; 368 attrs = pa6t_attrs;
370 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 369 nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
371 pmc_attrs = NULL; 370 pmc_attrs = NULL;
372 break; 371 break;
373#endif /* HAS_PPC_PMC_PA6T */ 372#endif /* HAS_PPC_PMC_PA6T */
@@ -378,27 +377,27 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
378 } 377 }
379 378
380 for (i = 0; i < nattrs; i++) 379 for (i = 0; i < nattrs; i++)
381 sysdev_create_file(s, &attrs[i]); 380 device_create_file(s, &attrs[i]);
382 381
383 if (pmc_attrs) 382 if (pmc_attrs)
384 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 383 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
385 sysdev_create_file(s, &pmc_attrs[i]); 384 device_create_file(s, &pmc_attrs[i]);
386 385
387#ifdef CONFIG_PPC64 386#ifdef CONFIG_PPC64
388 if (cpu_has_feature(CPU_FTR_MMCRA)) 387 if (cpu_has_feature(CPU_FTR_MMCRA))
389 sysdev_create_file(s, &attr_mmcra); 388 device_create_file(s, &dev_attr_mmcra);
390 389
391 if (cpu_has_feature(CPU_FTR_PURR)) 390 if (cpu_has_feature(CPU_FTR_PURR))
392 sysdev_create_file(s, &attr_purr); 391 device_create_file(s, &dev_attr_purr);
393 392
394 if (cpu_has_feature(CPU_FTR_SPURR)) 393 if (cpu_has_feature(CPU_FTR_SPURR))
395 sysdev_create_file(s, &attr_spurr); 394 device_create_file(s, &dev_attr_spurr);
396 395
397 if (cpu_has_feature(CPU_FTR_DSCR)) 396 if (cpu_has_feature(CPU_FTR_DSCR))
398 sysdev_create_file(s, &attr_dscr); 397 device_create_file(s, &dev_attr_dscr);
399 398
400 if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2)) 399 if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
401 sysdev_create_file(s, &attr_pir); 400 device_create_file(s, &dev_attr_pir);
402#endif /* CONFIG_PPC64 */ 401#endif /* CONFIG_PPC64 */
403 402
404 cacheinfo_cpu_online(cpu); 403 cacheinfo_cpu_online(cpu);
@@ -408,8 +407,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
408static void unregister_cpu_online(unsigned int cpu) 407static void unregister_cpu_online(unsigned int cpu)
409{ 408{
410 struct cpu *c = &per_cpu(cpu_devices, cpu); 409 struct cpu *c = &per_cpu(cpu_devices, cpu);
411 struct sys_device *s = &c->sysdev; 410 struct device *s = &c->dev;
412 struct sysdev_attribute *attrs, *pmc_attrs; 411 struct device_attribute *attrs, *pmc_attrs;
413 int i, nattrs; 412 int i, nattrs;
414 413
415 BUG_ON(!c->hotpluggable); 414 BUG_ON(!c->hotpluggable);
@@ -417,7 +416,7 @@ static void unregister_cpu_online(unsigned int cpu)
417#ifdef CONFIG_PPC64 416#ifdef CONFIG_PPC64
418 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 417 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
419 cpu_has_feature(CPU_FTR_SMT)) 418 cpu_has_feature(CPU_FTR_SMT))
420 sysdev_remove_file(s, &attr_smt_snooze_delay); 419 device_remove_file(s, &dev_attr_smt_snooze_delay);
421#endif 420#endif
422 421
423 /* PMC stuff */ 422 /* PMC stuff */
@@ -425,14 +424,14 @@ static void unregister_cpu_online(unsigned int cpu)
425#ifdef HAS_PPC_PMC_IBM 424#ifdef HAS_PPC_PMC_IBM
426 case PPC_PMC_IBM: 425 case PPC_PMC_IBM:
427 attrs = ibm_common_attrs; 426 attrs = ibm_common_attrs;
428 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 427 nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
429 pmc_attrs = classic_pmc_attrs; 428 pmc_attrs = classic_pmc_attrs;
430 break; 429 break;
431#endif /* HAS_PPC_PMC_IBM */ 430#endif /* HAS_PPC_PMC_IBM */
432#ifdef HAS_PPC_PMC_G4 431#ifdef HAS_PPC_PMC_G4
433 case PPC_PMC_G4: 432 case PPC_PMC_G4:
434 attrs = g4_common_attrs; 433 attrs = g4_common_attrs;
435 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 434 nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
436 pmc_attrs = classic_pmc_attrs; 435 pmc_attrs = classic_pmc_attrs;
437 break; 436 break;
438#endif /* HAS_PPC_PMC_G4 */ 437#endif /* HAS_PPC_PMC_G4 */
@@ -440,7 +439,7 @@ static void unregister_cpu_online(unsigned int cpu)
440 case PPC_PMC_PA6T: 439 case PPC_PMC_PA6T:
441 /* PA Semi starts counting at PMC0 */ 440 /* PA Semi starts counting at PMC0 */
442 attrs = pa6t_attrs; 441 attrs = pa6t_attrs;
443 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 442 nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
444 pmc_attrs = NULL; 443 pmc_attrs = NULL;
445 break; 444 break;
446#endif /* HAS_PPC_PMC_PA6T */ 445#endif /* HAS_PPC_PMC_PA6T */
@@ -451,27 +450,27 @@ static void unregister_cpu_online(unsigned int cpu)
451 } 450 }
452 451
453 for (i = 0; i < nattrs; i++) 452 for (i = 0; i < nattrs; i++)
454 sysdev_remove_file(s, &attrs[i]); 453 device_remove_file(s, &attrs[i]);
455 454
456 if (pmc_attrs) 455 if (pmc_attrs)
457 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 456 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
458 sysdev_remove_file(s, &pmc_attrs[i]); 457 device_remove_file(s, &pmc_attrs[i]);
459 458
460#ifdef CONFIG_PPC64 459#ifdef CONFIG_PPC64
461 if (cpu_has_feature(CPU_FTR_MMCRA)) 460 if (cpu_has_feature(CPU_FTR_MMCRA))
462 sysdev_remove_file(s, &attr_mmcra); 461 device_remove_file(s, &dev_attr_mmcra);
463 462
464 if (cpu_has_feature(CPU_FTR_PURR)) 463 if (cpu_has_feature(CPU_FTR_PURR))
465 sysdev_remove_file(s, &attr_purr); 464 device_remove_file(s, &dev_attr_purr);
466 465
467 if (cpu_has_feature(CPU_FTR_SPURR)) 466 if (cpu_has_feature(CPU_FTR_SPURR))
468 sysdev_remove_file(s, &attr_spurr); 467 device_remove_file(s, &dev_attr_spurr);
469 468
470 if (cpu_has_feature(CPU_FTR_DSCR)) 469 if (cpu_has_feature(CPU_FTR_DSCR))
471 sysdev_remove_file(s, &attr_dscr); 470 device_remove_file(s, &dev_attr_dscr);
472 471
473 if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2)) 472 if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
474 sysdev_remove_file(s, &attr_pir); 473 device_remove_file(s, &dev_attr_pir);
475#endif /* CONFIG_PPC64 */ 474#endif /* CONFIG_PPC64 */
476 475
477 cacheinfo_cpu_offline(cpu); 476 cacheinfo_cpu_offline(cpu);
@@ -523,70 +522,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
523 522
524static DEFINE_MUTEX(cpu_mutex); 523static DEFINE_MUTEX(cpu_mutex);
525 524
526int cpu_add_sysdev_attr(struct sysdev_attribute *attr) 525int cpu_add_dev_attr(struct device_attribute *attr)
527{ 526{
528 int cpu; 527 int cpu;
529 528
530 mutex_lock(&cpu_mutex); 529 mutex_lock(&cpu_mutex);
531 530
532 for_each_possible_cpu(cpu) { 531 for_each_possible_cpu(cpu) {
533 sysdev_create_file(get_cpu_sysdev(cpu), attr); 532 device_create_file(get_cpu_device(cpu), attr);
534 } 533 }
535 534
536 mutex_unlock(&cpu_mutex); 535 mutex_unlock(&cpu_mutex);
537 return 0; 536 return 0;
538} 537}
539EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); 538EXPORT_SYMBOL_GPL(cpu_add_dev_attr);
540 539
541int cpu_add_sysdev_attr_group(struct attribute_group *attrs) 540int cpu_add_dev_attr_group(struct attribute_group *attrs)
542{ 541{
543 int cpu; 542 int cpu;
544 struct sys_device *sysdev; 543 struct device *dev;
545 int ret; 544 int ret;
546 545
547 mutex_lock(&cpu_mutex); 546 mutex_lock(&cpu_mutex);
548 547
549 for_each_possible_cpu(cpu) { 548 for_each_possible_cpu(cpu) {
550 sysdev = get_cpu_sysdev(cpu); 549 dev = get_cpu_device(cpu);
551 ret = sysfs_create_group(&sysdev->kobj, attrs); 550 ret = sysfs_create_group(&dev->kobj, attrs);
552 WARN_ON(ret != 0); 551 WARN_ON(ret != 0);
553 } 552 }
554 553
555 mutex_unlock(&cpu_mutex); 554 mutex_unlock(&cpu_mutex);
556 return 0; 555 return 0;
557} 556}
558EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); 557EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group);
559 558
560 559
561void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) 560void cpu_remove_dev_attr(struct device_attribute *attr)
562{ 561{
563 int cpu; 562 int cpu;
564 563
565 mutex_lock(&cpu_mutex); 564 mutex_lock(&cpu_mutex);
566 565
567 for_each_possible_cpu(cpu) { 566 for_each_possible_cpu(cpu) {
568 sysdev_remove_file(get_cpu_sysdev(cpu), attr); 567 device_remove_file(get_cpu_device(cpu), attr);
569 } 568 }
570 569
571 mutex_unlock(&cpu_mutex); 570 mutex_unlock(&cpu_mutex);
572} 571}
573EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); 572EXPORT_SYMBOL_GPL(cpu_remove_dev_attr);
574 573
575void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) 574void cpu_remove_dev_attr_group(struct attribute_group *attrs)
576{ 575{
577 int cpu; 576 int cpu;
578 struct sys_device *sysdev; 577 struct device *dev;
579 578
580 mutex_lock(&cpu_mutex); 579 mutex_lock(&cpu_mutex);
581 580
582 for_each_possible_cpu(cpu) { 581 for_each_possible_cpu(cpu) {
583 sysdev = get_cpu_sysdev(cpu); 582 dev = get_cpu_device(cpu);
584 sysfs_remove_group(&sysdev->kobj, attrs); 583 sysfs_remove_group(&dev->kobj, attrs);
585 } 584 }
586 585
587 mutex_unlock(&cpu_mutex); 586 mutex_unlock(&cpu_mutex);
588} 587}
589EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); 588EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group);
590 589
591 590
592/* NUMA stuff */ 591/* NUMA stuff */
@@ -600,18 +599,18 @@ static void register_nodes(void)
600 register_one_node(i); 599 register_one_node(i);
601} 600}
602 601
603int sysfs_add_device_to_node(struct sys_device *dev, int nid) 602int sysfs_add_device_to_node(struct device *dev, int nid)
604{ 603{
605 struct node *node = &node_devices[nid]; 604 struct node *node = &node_devices[nid];
606 return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, 605 return sysfs_create_link(&node->dev.kobj, &dev->kobj,
607 kobject_name(&dev->kobj)); 606 kobject_name(&dev->kobj));
608} 607}
609EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); 608EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
610 609
611void sysfs_remove_device_from_node(struct sys_device *dev, int nid) 610void sysfs_remove_device_from_node(struct device *dev, int nid)
612{ 611{
613 struct node *node = &node_devices[nid]; 612 struct node *node = &node_devices[nid];
614 sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); 613 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
615} 614}
616EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 615EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
617 616
@@ -624,14 +623,14 @@ static void register_nodes(void)
624#endif 623#endif
625 624
626/* Only valid if CPU is present. */ 625/* Only valid if CPU is present. */
627static ssize_t show_physical_id(struct sys_device *dev, 626static ssize_t show_physical_id(struct device *dev,
628 struct sysdev_attribute *attr, char *buf) 627 struct device_attribute *attr, char *buf)
629{ 628{
630 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 629 struct cpu *cpu = container_of(dev, struct cpu, dev);
631 630
632 return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); 631 return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id));
633} 632}
634static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); 633static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL);
635 634
636static int __init topology_init(void) 635static int __init topology_init(void)
637{ 636{
@@ -656,7 +655,7 @@ static int __init topology_init(void)
656 if (cpu_online(cpu) || c->hotpluggable) { 655 if (cpu_online(cpu) || c->hotpluggable) {
657 register_cpu(c, cpu); 656 register_cpu(c, cpu);
658 657
659 sysdev_create_file(&c->sysdev, &attr_physical_id); 658 device_create_file(&c->dev, &dev_attr_physical_id);
660 } 659 }
661 660
662 if (cpu_online(cpu)) 661 if (cpu_online(cpu))