aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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
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')
-rw-r--r--arch/powerpc/include/asm/spu.h12
-rw-r--r--arch/powerpc/include/asm/topology.h10
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/sysfs.c267
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/powerpc/platforms/cell/cbe_thermal.c144
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c61
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c67
-rw-r--r--arch/powerpc/platforms/pseries/pseries_energy.c71
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c33
-rw-r--r--arch/powerpc/sysdev/ppc4xx_cpm.c6
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c12
-rw-r--r--arch/powerpc/sysdev/uic.c1
18 files changed, 355 insertions, 357 deletions
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 4e360bd4a35a..fff921345ddc 100644
--- a/arch/powerpc/include/asm/spu.h
+++ b/arch/powerpc/include/asm/spu.h
@@ -25,7 +25,7 @@
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26 26
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/sysdev.h> 28#include <linux/device.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30 30
31#define LS_SIZE (256 * 1024) 31#define LS_SIZE (256 * 1024)
@@ -166,7 +166,7 @@ struct spu {
166 /* beat only */ 166 /* beat only */
167 u64 shadow_int_mask_RW[3]; 167 u64 shadow_int_mask_RW[3];
168 168
169 struct sys_device sysdev; 169 struct device dev;
170 170
171 int has_mem_affinity; 171 int has_mem_affinity;
172 struct list_head aff_list; 172 struct list_head aff_list;
@@ -270,11 +270,11 @@ struct spufs_calls {
270int register_spu_syscalls(struct spufs_calls *calls); 270int register_spu_syscalls(struct spufs_calls *calls);
271void unregister_spu_syscalls(struct spufs_calls *calls); 271void unregister_spu_syscalls(struct spufs_calls *calls);
272 272
273int spu_add_sysdev_attr(struct sysdev_attribute *attr); 273int spu_add_dev_attr(struct device_attribute *attr);
274void spu_remove_sysdev_attr(struct sysdev_attribute *attr); 274void spu_remove_dev_attr(struct device_attribute *attr);
275 275
276int spu_add_sysdev_attr_group(struct attribute_group *attrs); 276int spu_add_dev_attr_group(struct attribute_group *attrs);
277void spu_remove_sysdev_attr_group(struct attribute_group *attrs); 277void spu_remove_dev_attr_group(struct attribute_group *attrs);
278 278
279int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, 279int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
280 unsigned long dsisr, unsigned *flt); 280 unsigned long dsisr, unsigned *flt);
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 1e104af08483..c97185885c6d 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -3,7 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5 5
6struct sys_device; 6struct device;
7struct device_node; 7struct device_node;
8 8
9#ifdef CONFIG_NUMA 9#ifdef CONFIG_NUMA
@@ -86,19 +86,19 @@ extern int __node_distance(int, int);
86 86
87extern void __init dump_numa_cpu_topology(void); 87extern void __init dump_numa_cpu_topology(void);
88 88
89extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); 89extern int sysfs_add_device_to_node(struct device *dev, int nid);
90extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); 90extern void sysfs_remove_device_from_node(struct device *dev, int nid);
91 91
92#else 92#else
93 93
94static inline void dump_numa_cpu_topology(void) {} 94static inline void dump_numa_cpu_topology(void) {}
95 95
96static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) 96static inline int sysfs_add_device_to_node(struct device *dev, int nid)
97{ 97{
98 return 0; 98 return 0;
99} 99}
100 100
101static inline void sysfs_remove_device_from_node(struct sys_device *dev, 101static inline void sysfs_remove_device_from_node(struct device *dev,
102 int nid) 102 int nid)
103{ 103{
104} 104}
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))
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c0189c169bbb..fe92f7007051 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1440,7 +1440,7 @@ int arch_update_cpu_topology(void)
1440{ 1440{
1441 int cpu, nid, old_nid; 1441 int cpu, nid, old_nid;
1442 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; 1442 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
1443 struct sys_device *sysdev; 1443 struct device *dev;
1444 1444
1445 for_each_cpu(cpu,&cpu_associativity_changes_mask) { 1445 for_each_cpu(cpu,&cpu_associativity_changes_mask) {
1446 vphn_get_associativity(cpu, associativity); 1446 vphn_get_associativity(cpu, associativity);
@@ -1461,9 +1461,9 @@ int arch_update_cpu_topology(void)
1461 register_cpu_under_node(cpu, nid); 1461 register_cpu_under_node(cpu, nid);
1462 put_online_cpus(); 1462 put_online_cpus();
1463 1463
1464 sysdev = get_cpu_sysdev(cpu); 1464 dev = get_cpu_device(cpu);
1465 if (sysdev) 1465 if (dev)
1466 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 1466 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
1467 } 1467 }
1468 1468
1469 return 1; 1469 return 1;
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c
index 4d4c8c169124..94560db788bf 100644
--- a/arch/powerpc/platforms/cell/cbe_thermal.c
+++ b/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -46,7 +46,7 @@
46 */ 46 */
47 47
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/sysdev.h> 49#include <linux/device.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/cpu.h> 51#include <linux/cpu.h>
52#include <asm/spu.h> 52#include <asm/spu.h>
@@ -59,8 +59,8 @@
59#define TEMP_MIN 65 59#define TEMP_MIN 65
60#define TEMP_MAX 125 60#define TEMP_MAX 125
61 61
62#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ 62#define DEVICE_PREFIX_ATTR(_prefix,_name,_mode) \
63struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ 63struct device_attribute attr_ ## _prefix ## _ ## _name = { \
64 .attr = { .name = __stringify(_name), .mode = _mode }, \ 64 .attr = { .name = __stringify(_name), .mode = _mode }, \
65 .show = _prefix ## _show_ ## _name, \ 65 .show = _prefix ## _show_ ## _name, \
66 .store = _prefix ## _store_ ## _name, \ 66 .store = _prefix ## _store_ ## _name, \
@@ -76,36 +76,36 @@ static inline u8 temp_to_reg(u8 temp)
76 return ((temp - TEMP_MIN) >> 1) & 0x3f; 76 return ((temp - TEMP_MIN) >> 1) & 0x3f;
77} 77}
78 78
79static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) 79static struct cbe_pmd_regs __iomem *get_pmd_regs(struct device *dev)
80{ 80{
81 struct spu *spu; 81 struct spu *spu;
82 82
83 spu = container_of(sysdev, struct spu, sysdev); 83 spu = container_of(dev, struct spu, dev);
84 84
85 return cbe_get_pmd_regs(spu_devnode(spu)); 85 return cbe_get_pmd_regs(spu_devnode(spu));
86} 86}
87 87
88/* returns the value for a given spu in a given register */ 88/* returns the value for a given spu in a given register */
89static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) 89static u8 spu_read_register_value(struct device *dev, union spe_reg __iomem *reg)
90{ 90{
91 union spe_reg value; 91 union spe_reg value;
92 struct spu *spu; 92 struct spu *spu;
93 93
94 spu = container_of(sysdev, struct spu, sysdev); 94 spu = container_of(dev, struct spu, dev);
95 value.val = in_be64(&reg->val); 95 value.val = in_be64(&reg->val);
96 96
97 return value.spe[spu->spe_id]; 97 return value.spe[spu->spe_id];
98} 98}
99 99
100static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, 100static ssize_t spu_show_temp(struct device *dev, struct device_attribute *attr,
101 char *buf) 101 char *buf)
102{ 102{
103 u8 value; 103 u8 value;
104 struct cbe_pmd_regs __iomem *pmd_regs; 104 struct cbe_pmd_regs __iomem *pmd_regs;
105 105
106 pmd_regs = get_pmd_regs(sysdev); 106 pmd_regs = get_pmd_regs(dev);
107 107
108 value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); 108 value = spu_read_register_value(dev, &pmd_regs->ts_ctsr1);
109 109
110 return sprintf(buf, "%d\n", reg_to_temp(value)); 110 return sprintf(buf, "%d\n", reg_to_temp(value));
111} 111}
@@ -147,48 +147,48 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char
147 return size; 147 return size;
148} 148}
149 149
150static ssize_t spu_show_throttle_end(struct sys_device *sysdev, 150static ssize_t spu_show_throttle_end(struct device *dev,
151 struct sysdev_attribute *attr, char *buf) 151 struct device_attribute *attr, char *buf)
152{ 152{
153 return show_throttle(get_pmd_regs(sysdev), buf, 0); 153 return show_throttle(get_pmd_regs(dev), buf, 0);
154} 154}
155 155
156static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, 156static ssize_t spu_show_throttle_begin(struct device *dev,
157 struct sysdev_attribute *attr, char *buf) 157 struct device_attribute *attr, char *buf)
158{ 158{
159 return show_throttle(get_pmd_regs(sysdev), buf, 8); 159 return show_throttle(get_pmd_regs(dev), buf, 8);
160} 160}
161 161
162static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, 162static ssize_t spu_show_throttle_full_stop(struct device *dev,
163 struct sysdev_attribute *attr, char *buf) 163 struct device_attribute *attr, char *buf)
164{ 164{
165 return show_throttle(get_pmd_regs(sysdev), buf, 16); 165 return show_throttle(get_pmd_regs(dev), buf, 16);
166} 166}
167 167
168static ssize_t spu_store_throttle_end(struct sys_device *sysdev, 168static ssize_t spu_store_throttle_end(struct device *dev,
169 struct sysdev_attribute *attr, const char *buf, size_t size) 169 struct device_attribute *attr, const char *buf, size_t size)
170{ 170{
171 return store_throttle(get_pmd_regs(sysdev), buf, size, 0); 171 return store_throttle(get_pmd_regs(dev), buf, size, 0);
172} 172}
173 173
174static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, 174static ssize_t spu_store_throttle_begin(struct device *dev,
175 struct sysdev_attribute *attr, const char *buf, size_t size) 175 struct device_attribute *attr, const char *buf, size_t size)
176{ 176{
177 return store_throttle(get_pmd_regs(sysdev), buf, size, 8); 177 return store_throttle(get_pmd_regs(dev), buf, size, 8);
178} 178}
179 179
180static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, 180static ssize_t spu_store_throttle_full_stop(struct device *dev,
181 struct sysdev_attribute *attr, const char *buf, size_t size) 181 struct device_attribute *attr, const char *buf, size_t size)
182{ 182{
183 return store_throttle(get_pmd_regs(sysdev), buf, size, 16); 183 return store_throttle(get_pmd_regs(dev), buf, size, 16);
184} 184}
185 185
186static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) 186static ssize_t ppe_show_temp(struct device *dev, char *buf, int pos)
187{ 187{
188 struct cbe_pmd_regs __iomem *pmd_regs; 188 struct cbe_pmd_regs __iomem *pmd_regs;
189 u64 value; 189 u64 value;
190 190
191 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 191 pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
192 value = in_be64(&pmd_regs->ts_ctsr2); 192 value = in_be64(&pmd_regs->ts_ctsr2);
193 193
194 value = (value >> pos) & 0x3f; 194 value = (value >> pos) & 0x3f;
@@ -199,64 +199,64 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
199 199
200/* shows the temperature of the DTS on the PPE, 200/* shows the temperature of the DTS on the PPE,
201 * located near the linear thermal sensor */ 201 * located near the linear thermal sensor */
202static ssize_t ppe_show_temp0(struct sys_device *sysdev, 202static ssize_t ppe_show_temp0(struct device *dev,
203 struct sysdev_attribute *attr, char *buf) 203 struct device_attribute *attr, char *buf)
204{ 204{
205 return ppe_show_temp(sysdev, buf, 32); 205 return ppe_show_temp(dev, buf, 32);
206} 206}
207 207
208/* shows the temperature of the second DTS on the PPE */ 208/* shows the temperature of the second DTS on the PPE */
209static ssize_t ppe_show_temp1(struct sys_device *sysdev, 209static ssize_t ppe_show_temp1(struct device *dev,
210 struct sysdev_attribute *attr, char *buf) 210 struct device_attribute *attr, char *buf)
211{ 211{
212 return ppe_show_temp(sysdev, buf, 0); 212 return ppe_show_temp(dev, buf, 0);
213} 213}
214 214
215static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, 215static ssize_t ppe_show_throttle_end(struct device *dev,
216 struct sysdev_attribute *attr, char *buf) 216 struct device_attribute *attr, char *buf)
217{ 217{
218 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); 218 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 32);
219} 219}
220 220
221static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, 221static ssize_t ppe_show_throttle_begin(struct device *dev,
222 struct sysdev_attribute *attr, char *buf) 222 struct device_attribute *attr, char *buf)
223{ 223{
224 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); 224 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 40);
225} 225}
226 226
227static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, 227static ssize_t ppe_show_throttle_full_stop(struct device *dev,
228 struct sysdev_attribute *attr, char *buf) 228 struct device_attribute *attr, char *buf)
229{ 229{
230 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); 230 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 48);
231} 231}
232 232
233static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, 233static ssize_t ppe_store_throttle_end(struct device *dev,
234 struct sysdev_attribute *attr, const char *buf, size_t size) 234 struct device_attribute *attr, const char *buf, size_t size)
235{ 235{
236 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); 236 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 32);
237} 237}
238 238
239static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, 239static ssize_t ppe_store_throttle_begin(struct device *dev,
240 struct sysdev_attribute *attr, const char *buf, size_t size) 240 struct device_attribute *attr, const char *buf, size_t size)
241{ 241{
242 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); 242 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 40);
243} 243}
244 244
245static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, 245static ssize_t ppe_store_throttle_full_stop(struct device *dev,
246 struct sysdev_attribute *attr, const char *buf, size_t size) 246 struct device_attribute *attr, const char *buf, size_t size)
247{ 247{
248 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); 248 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 48);
249} 249}
250 250
251 251
252static struct sysdev_attribute attr_spu_temperature = { 252static struct device_attribute attr_spu_temperature = {
253 .attr = {.name = "temperature", .mode = 0400 }, 253 .attr = {.name = "temperature", .mode = 0400 },
254 .show = spu_show_temp, 254 .show = spu_show_temp,
255}; 255};
256 256
257static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); 257static DEVICE_PREFIX_ATTR(spu, throttle_end, 0600);
258static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); 258static DEVICE_PREFIX_ATTR(spu, throttle_begin, 0600);
259static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); 259static DEVICE_PREFIX_ATTR(spu, throttle_full_stop, 0600);
260 260
261 261
262static struct attribute *spu_attributes[] = { 262static struct attribute *spu_attributes[] = {
@@ -272,19 +272,19 @@ static struct attribute_group spu_attribute_group = {
272 .attrs = spu_attributes, 272 .attrs = spu_attributes,
273}; 273};
274 274
275static struct sysdev_attribute attr_ppe_temperature0 = { 275static struct device_attribute attr_ppe_temperature0 = {
276 .attr = {.name = "temperature0", .mode = 0400 }, 276 .attr = {.name = "temperature0", .mode = 0400 },
277 .show = ppe_show_temp0, 277 .show = ppe_show_temp0,
278}; 278};
279 279
280static struct sysdev_attribute attr_ppe_temperature1 = { 280static struct device_attribute attr_ppe_temperature1 = {
281 .attr = {.name = "temperature1", .mode = 0400 }, 281 .attr = {.name = "temperature1", .mode = 0400 },
282 .show = ppe_show_temp1, 282 .show = ppe_show_temp1,
283}; 283};
284 284
285static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); 285static DEVICE_PREFIX_ATTR(ppe, throttle_end, 0600);
286static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); 286static DEVICE_PREFIX_ATTR(ppe, throttle_begin, 0600);
287static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); 287static DEVICE_PREFIX_ATTR(ppe, throttle_full_stop, 0600);
288 288
289static struct attribute *ppe_attributes[] = { 289static struct attribute *ppe_attributes[] = {
290 &attr_ppe_temperature0.attr, 290 &attr_ppe_temperature0.attr,
@@ -307,7 +307,7 @@ static int __init init_default_values(void)
307{ 307{
308 int cpu; 308 int cpu;
309 struct cbe_pmd_regs __iomem *pmd_regs; 309 struct cbe_pmd_regs __iomem *pmd_regs;
310 struct sys_device *sysdev; 310 struct device *dev;
311 union ppe_spe_reg tpr; 311 union ppe_spe_reg tpr;
312 union spe_reg str1; 312 union spe_reg str1;
313 u64 str2; 313 u64 str2;
@@ -349,14 +349,14 @@ static int __init init_default_values(void)
349 349
350 for_each_possible_cpu (cpu) { 350 for_each_possible_cpu (cpu) {
351 pr_debug("processing cpu %d\n", cpu); 351 pr_debug("processing cpu %d\n", cpu);
352 sysdev = get_cpu_sysdev(cpu); 352 dev = get_cpu_device(cpu);
353 353
354 if (!sysdev) { 354 if (!dev) {
355 pr_info("invalid sysdev pointer for cbe_thermal\n"); 355 pr_info("invalid dev pointer for cbe_thermal\n");
356 return -EINVAL; 356 return -EINVAL;
357 } 357 }
358 358
359 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 359 pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
360 360
361 if (!pmd_regs) { 361 if (!pmd_regs) {
362 pr_info("invalid CBE regs pointer for cbe_thermal\n"); 362 pr_info("invalid CBE regs pointer for cbe_thermal\n");
@@ -379,8 +379,8 @@ static int __init thermal_init(void)
379 int rc = init_default_values(); 379 int rc = init_default_values();
380 380
381 if (rc == 0) { 381 if (rc == 0) {
382 spu_add_sysdev_attr_group(&spu_attribute_group); 382 spu_add_dev_attr_group(&spu_attribute_group);
383 cpu_add_sysdev_attr_group(&ppe_attribute_group); 383 cpu_add_dev_attr_group(&ppe_attribute_group);
384 } 384 }
385 385
386 return rc; 386 return rc;
@@ -389,8 +389,8 @@ module_init(thermal_init);
389 389
390static void __exit thermal_exit(void) 390static void __exit thermal_exit(void)
391{ 391{
392 spu_remove_sysdev_attr_group(&spu_attribute_group); 392 spu_remove_dev_attr_group(&spu_attribute_group);
393 cpu_remove_sysdev_attr_group(&ppe_attribute_group); 393 cpu_remove_dev_attr_group(&ppe_attribute_group);
394} 394}
395module_exit(thermal_exit); 395module_exit(thermal_exit);
396 396
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index f5c5c762d5a3..4a255cf8cd17 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -23,7 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/cache.h> 24#include <linux/cache.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28 28
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index e94d3ecdd8bb..8b1213993b10 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -519,31 +519,32 @@ void spu_init_channels(struct spu *spu)
519} 519}
520EXPORT_SYMBOL_GPL(spu_init_channels); 520EXPORT_SYMBOL_GPL(spu_init_channels);
521 521
522static struct sysdev_class spu_sysdev_class = { 522static struct bus_type spu_subsys = {
523 .name = "spu", 523 .name = "spu",
524 .dev_name = "spu",
524}; 525};
525 526
526int spu_add_sysdev_attr(struct sysdev_attribute *attr) 527int spu_add_dev_attr(struct device_attribute *attr)
527{ 528{
528 struct spu *spu; 529 struct spu *spu;
529 530
530 mutex_lock(&spu_full_list_mutex); 531 mutex_lock(&spu_full_list_mutex);
531 list_for_each_entry(spu, &spu_full_list, full_list) 532 list_for_each_entry(spu, &spu_full_list, full_list)
532 sysdev_create_file(&spu->sysdev, attr); 533 device_create_file(&spu->dev, attr);
533 mutex_unlock(&spu_full_list_mutex); 534 mutex_unlock(&spu_full_list_mutex);
534 535
535 return 0; 536 return 0;
536} 537}
537EXPORT_SYMBOL_GPL(spu_add_sysdev_attr); 538EXPORT_SYMBOL_GPL(spu_add_dev_attr);
538 539
539int spu_add_sysdev_attr_group(struct attribute_group *attrs) 540int spu_add_dev_attr_group(struct attribute_group *attrs)
540{ 541{
541 struct spu *spu; 542 struct spu *spu;
542 int rc = 0; 543 int rc = 0;
543 544
544 mutex_lock(&spu_full_list_mutex); 545 mutex_lock(&spu_full_list_mutex);
545 list_for_each_entry(spu, &spu_full_list, full_list) { 546 list_for_each_entry(spu, &spu_full_list, full_list) {
546 rc = sysfs_create_group(&spu->sysdev.kobj, attrs); 547 rc = sysfs_create_group(&spu->dev.kobj, attrs);
547 548
548 /* we're in trouble here, but try unwinding anyway */ 549 /* we're in trouble here, but try unwinding anyway */
549 if (rc) { 550 if (rc) {
@@ -552,7 +553,7 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
552 553
553 list_for_each_entry_continue_reverse(spu, 554 list_for_each_entry_continue_reverse(spu,
554 &spu_full_list, full_list) 555 &spu_full_list, full_list)
555 sysfs_remove_group(&spu->sysdev.kobj, attrs); 556 sysfs_remove_group(&spu->dev.kobj, attrs);
556 break; 557 break;
557 } 558 }
558 } 559 }
@@ -561,45 +562,45 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
561 562
562 return rc; 563 return rc;
563} 564}
564EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); 565EXPORT_SYMBOL_GPL(spu_add_dev_attr_group);
565 566
566 567
567void spu_remove_sysdev_attr(struct sysdev_attribute *attr) 568void spu_remove_dev_attr(struct device_attribute *attr)
568{ 569{
569 struct spu *spu; 570 struct spu *spu;
570 571
571 mutex_lock(&spu_full_list_mutex); 572 mutex_lock(&spu_full_list_mutex);
572 list_for_each_entry(spu, &spu_full_list, full_list) 573 list_for_each_entry(spu, &spu_full_list, full_list)
573 sysdev_remove_file(&spu->sysdev, attr); 574 device_remove_file(&spu->dev, attr);
574 mutex_unlock(&spu_full_list_mutex); 575 mutex_unlock(&spu_full_list_mutex);
575} 576}
576EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr); 577EXPORT_SYMBOL_GPL(spu_remove_dev_attr);
577 578
578void spu_remove_sysdev_attr_group(struct attribute_group *attrs) 579void spu_remove_dev_attr_group(struct attribute_group *attrs)
579{ 580{
580 struct spu *spu; 581 struct spu *spu;
581 582
582 mutex_lock(&spu_full_list_mutex); 583 mutex_lock(&spu_full_list_mutex);
583 list_for_each_entry(spu, &spu_full_list, full_list) 584 list_for_each_entry(spu, &spu_full_list, full_list)
584 sysfs_remove_group(&spu->sysdev.kobj, attrs); 585 sysfs_remove_group(&spu->dev.kobj, attrs);
585 mutex_unlock(&spu_full_list_mutex); 586 mutex_unlock(&spu_full_list_mutex);
586} 587}
587EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group); 588EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group);
588 589
589static int spu_create_sysdev(struct spu *spu) 590static int spu_create_dev(struct spu *spu)
590{ 591{
591 int ret; 592 int ret;
592 593
593 spu->sysdev.id = spu->number; 594 spu->dev.id = spu->number;
594 spu->sysdev.cls = &spu_sysdev_class; 595 spu->dev.bus = &spu_subsys;
595 ret = sysdev_register(&spu->sysdev); 596 ret = device_register(&spu->dev);
596 if (ret) { 597 if (ret) {
597 printk(KERN_ERR "Can't register SPU %d with sysfs\n", 598 printk(KERN_ERR "Can't register SPU %d with sysfs\n",
598 spu->number); 599 spu->number);
599 return ret; 600 return ret;
600 } 601 }
601 602
602 sysfs_add_device_to_node(&spu->sysdev, spu->node); 603 sysfs_add_device_to_node(&spu->dev, spu->node);
603 604
604 return 0; 605 return 0;
605} 606}
@@ -635,7 +636,7 @@ static int __init create_spu(void *data)
635 if (ret) 636 if (ret)
636 goto out_destroy; 637 goto out_destroy;
637 638
638 ret = spu_create_sysdev(spu); 639 ret = spu_create_dev(spu);
639 if (ret) 640 if (ret)
640 goto out_free_irqs; 641 goto out_free_irqs;
641 642
@@ -692,10 +693,10 @@ static unsigned long long spu_acct_time(struct spu *spu,
692} 693}
693 694
694 695
695static ssize_t spu_stat_show(struct sys_device *sysdev, 696static ssize_t spu_stat_show(struct device *dev,
696 struct sysdev_attribute *attr, char *buf) 697 struct device_attribute *attr, char *buf)
697{ 698{
698 struct spu *spu = container_of(sysdev, struct spu, sysdev); 699 struct spu *spu = container_of(dev, struct spu, dev);
699 700
700 return sprintf(buf, "%s %llu %llu %llu %llu " 701 return sprintf(buf, "%s %llu %llu %llu %llu "
701 "%llu %llu %llu %llu %llu %llu %llu %llu\n", 702 "%llu %llu %llu %llu %llu %llu %llu %llu\n",
@@ -714,7 +715,7 @@ static ssize_t spu_stat_show(struct sys_device *sysdev,
714 spu->stats.libassist); 715 spu->stats.libassist);
715} 716}
716 717
717static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 718static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL);
718 719
719#ifdef CONFIG_KEXEC 720#ifdef CONFIG_KEXEC
720 721
@@ -813,8 +814,8 @@ static int __init init_spu_base(void)
813 if (!spu_management_ops) 814 if (!spu_management_ops)
814 goto out; 815 goto out;
815 816
816 /* create sysdev class for spus */ 817 /* create system subsystem for spus */
817 ret = sysdev_class_register(&spu_sysdev_class); 818 ret = subsys_system_register(&spu_subsys, NULL);
818 if (ret) 819 if (ret)
819 goto out; 820 goto out;
820 821
@@ -823,7 +824,7 @@ static int __init init_spu_base(void)
823 if (ret < 0) { 824 if (ret < 0) {
824 printk(KERN_WARNING "%s: Error initializing spus\n", 825 printk(KERN_WARNING "%s: Error initializing spus\n",
825 __func__); 826 __func__);
826 goto out_unregister_sysdev_class; 827 goto out_unregister_subsys;
827 } 828 }
828 829
829 if (ret > 0) 830 if (ret > 0)
@@ -833,15 +834,15 @@ static int __init init_spu_base(void)
833 xmon_register_spus(&spu_full_list); 834 xmon_register_spus(&spu_full_list);
834 crash_register_spus(&spu_full_list); 835 crash_register_spus(&spu_full_list);
835 mutex_unlock(&spu_full_list_mutex); 836 mutex_unlock(&spu_full_list_mutex);
836 spu_add_sysdev_attr(&attr_stat); 837 spu_add_dev_attr(&dev_attr_stat);
837 register_syscore_ops(&spu_syscore_ops); 838 register_syscore_ops(&spu_syscore_ops);
838 839
839 spu_init_affinity(); 840 spu_init_affinity();
840 841
841 return 0; 842 return 0;
842 843
843 out_unregister_sysdev_class: 844 out_unregister_subsys:
844 sysdev_class_unregister(&spu_sysdev_class); 845 bus_unregister(&spu_subsys);
845 out: 846 out:
846 return ret; 847 return ret;
847} 848}
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 7e2a5515ed76..02df49fb59f0 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -24,7 +24,7 @@
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/cache.h> 25#include <linux/cache.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/cpu.h> 28#include <linux/cpu.h>
29 29
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 04af5f48b4eb..1fc386a23f18 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -23,7 +23,7 @@
23#include <linux/pmu.h> 23#include <linux/pmu.h>
24#include <linux/cpufreq.h> 24#include <linux/cpufreq.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/hardirq.h> 27#include <linux/hardirq.h>
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/machdep.h> 29#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 3cafc306b971..c638535753df 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -33,7 +33,7 @@
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/stringify.h> 34#include <linux/stringify.h>
35#include <linux/swap.h> 35#include <linux/swap.h>
36#include <linux/sysdev.h> 36#include <linux/device.h>
37#include <asm/firmware.h> 37#include <asm/firmware.h>
38#include <asm/hvcall.h> 38#include <asm/hvcall.h>
39#include <asm/mmu.h> 39#include <asm/mmu.h>
@@ -65,7 +65,7 @@ static unsigned int oom_kb = CMM_OOM_KB;
65static unsigned int cmm_debug = CMM_DEBUG; 65static unsigned int cmm_debug = CMM_DEBUG;
66static unsigned int cmm_disabled = CMM_DISABLE; 66static unsigned int cmm_disabled = CMM_DISABLE;
67static unsigned long min_mem_mb = CMM_MIN_MEM_MB; 67static unsigned long min_mem_mb = CMM_MIN_MEM_MB;
68static struct sys_device cmm_sysdev; 68static struct device cmm_dev;
69 69
70MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>"); 70MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>");
71MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager"); 71MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager");
@@ -347,25 +347,25 @@ static int cmm_thread(void *dummy)
347} 347}
348 348
349#define CMM_SHOW(name, format, args...) \ 349#define CMM_SHOW(name, format, args...) \
350 static ssize_t show_##name(struct sys_device *dev, \ 350 static ssize_t show_##name(struct device *dev, \
351 struct sysdev_attribute *attr, \ 351 struct device_attribute *attr, \
352 char *buf) \ 352 char *buf) \
353 { \ 353 { \
354 return sprintf(buf, format, ##args); \ 354 return sprintf(buf, format, ##args); \
355 } \ 355 } \
356 static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) 356 static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
357 357
358CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages)); 358CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages));
359CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target)); 359CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target));
360 360
361static ssize_t show_oom_pages(struct sys_device *dev, 361static ssize_t show_oom_pages(struct device *dev,
362 struct sysdev_attribute *attr, char *buf) 362 struct device_attribute *attr, char *buf)
363{ 363{
364 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages)); 364 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages));
365} 365}
366 366
367static ssize_t store_oom_pages(struct sys_device *dev, 367static ssize_t store_oom_pages(struct device *dev,
368 struct sysdev_attribute *attr, 368 struct device_attribute *attr,
369 const char *buf, size_t count) 369 const char *buf, size_t count)
370{ 370{
371 unsigned long val = simple_strtoul (buf, NULL, 10); 371 unsigned long val = simple_strtoul (buf, NULL, 10);
@@ -379,17 +379,18 @@ static ssize_t store_oom_pages(struct sys_device *dev,
379 return count; 379 return count;
380} 380}
381 381
382static SYSDEV_ATTR(oom_freed_kb, S_IWUSR| S_IRUGO, 382static DEVICE_ATTR(oom_freed_kb, S_IWUSR | S_IRUGO,
383 show_oom_pages, store_oom_pages); 383 show_oom_pages, store_oom_pages);
384 384
385static struct sysdev_attribute *cmm_attrs[] = { 385static struct device_attribute *cmm_attrs[] = {
386 &attr_loaned_kb, 386 &dev_attr_loaned_kb,
387 &attr_loaned_target_kb, 387 &dev_attr_loaned_target_kb,
388 &attr_oom_freed_kb, 388 &dev_attr_oom_freed_kb,
389}; 389};
390 390
391static struct sysdev_class cmm_sysdev_class = { 391static struct bus_type cmm_subsys = {
392 .name = "cmm", 392 .name = "cmm",
393 .dev_name = "cmm",
393}; 394};
394 395
395/** 396/**
@@ -398,21 +399,21 @@ static struct sysdev_class cmm_sysdev_class = {
398 * Return value: 399 * Return value:
399 * 0 on success / other on failure 400 * 0 on success / other on failure
400 **/ 401 **/
401static int cmm_sysfs_register(struct sys_device *sysdev) 402static int cmm_sysfs_register(struct device *dev)
402{ 403{
403 int i, rc; 404 int i, rc;
404 405
405 if ((rc = sysdev_class_register(&cmm_sysdev_class))) 406 if ((rc = subsys_system_register(&cmm_subsys, NULL)))
406 return rc; 407 return rc;
407 408
408 sysdev->id = 0; 409 dev->id = 0;
409 sysdev->cls = &cmm_sysdev_class; 410 dev->bus = &cmm_subsys;
410 411
411 if ((rc = sysdev_register(sysdev))) 412 if ((rc = device_register(dev)))
412 goto class_unregister; 413 goto subsys_unregister;
413 414
414 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) { 415 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) {
415 if ((rc = sysdev_create_file(sysdev, cmm_attrs[i]))) 416 if ((rc = device_create_file(dev, cmm_attrs[i])))
416 goto fail; 417 goto fail;
417 } 418 }
418 419
@@ -420,10 +421,10 @@ static int cmm_sysfs_register(struct sys_device *sysdev)
420 421
421fail: 422fail:
422 while (--i >= 0) 423 while (--i >= 0)
423 sysdev_remove_file(sysdev, cmm_attrs[i]); 424 device_remove_file(dev, cmm_attrs[i]);
424 sysdev_unregister(sysdev); 425 device_unregister(dev);
425class_unregister: 426subsys_unregister:
426 sysdev_class_unregister(&cmm_sysdev_class); 427 bus_unregister(&cmm_subsys);
427 return rc; 428 return rc;
428} 429}
429 430
@@ -431,14 +432,14 @@ class_unregister:
431 * cmm_unregister_sysfs - Unregister from sysfs 432 * cmm_unregister_sysfs - Unregister from sysfs
432 * 433 *
433 **/ 434 **/
434static void cmm_unregister_sysfs(struct sys_device *sysdev) 435static void cmm_unregister_sysfs(struct device *dev)
435{ 436{
436 int i; 437 int i;
437 438
438 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) 439 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++)
439 sysdev_remove_file(sysdev, cmm_attrs[i]); 440 device_remove_file(dev, cmm_attrs[i]);
440 sysdev_unregister(sysdev); 441 device_unregister(dev);
441 sysdev_class_unregister(&cmm_sysdev_class); 442 bus_unregister(&cmm_subsys);
442} 443}
443 444
444/** 445/**
@@ -657,7 +658,7 @@ static int cmm_init(void)
657 if ((rc = register_reboot_notifier(&cmm_reboot_nb))) 658 if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
658 goto out_oom_notifier; 659 goto out_oom_notifier;
659 660
660 if ((rc = cmm_sysfs_register(&cmm_sysdev))) 661 if ((rc = cmm_sysfs_register(&cmm_dev)))
661 goto out_reboot_notifier; 662 goto out_reboot_notifier;
662 663
663 if (register_memory_notifier(&cmm_mem_nb) || 664 if (register_memory_notifier(&cmm_mem_nb) ||
@@ -678,7 +679,7 @@ static int cmm_init(void)
678out_unregister_notifier: 679out_unregister_notifier:
679 unregister_memory_notifier(&cmm_mem_nb); 680 unregister_memory_notifier(&cmm_mem_nb);
680 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); 681 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
681 cmm_unregister_sysfs(&cmm_sysdev); 682 cmm_unregister_sysfs(&cmm_dev);
682out_reboot_notifier: 683out_reboot_notifier:
683 unregister_reboot_notifier(&cmm_reboot_nb); 684 unregister_reboot_notifier(&cmm_reboot_nb);
684out_oom_notifier: 685out_oom_notifier:
@@ -701,7 +702,7 @@ static void cmm_exit(void)
701 unregister_memory_notifier(&cmm_mem_nb); 702 unregister_memory_notifier(&cmm_mem_nb);
702 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); 703 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
703 cmm_free_pages(loaned_pages); 704 cmm_free_pages(loaned_pages);
704 cmm_unregister_sysfs(&cmm_sysdev); 705 cmm_unregister_sysfs(&cmm_dev);
705} 706}
706 707
707/** 708/**
diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c b/arch/powerpc/platforms/pseries/pseries_energy.c
index c8b3c69fe891..af281dce510a 100644
--- a/arch/powerpc/platforms/pseries/pseries_energy.c
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -15,7 +15,7 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/sysdev.h> 18#include <linux/device.h>
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <asm/cputhreads.h> 21#include <asm/cputhreads.h>
@@ -184,7 +184,7 @@ static ssize_t get_best_energy_list(char *page, int activate)
184 return s-page; 184 return s-page;
185} 185}
186 186
187static ssize_t get_best_energy_data(struct sys_device *dev, 187static ssize_t get_best_energy_data(struct device *dev,
188 char *page, int activate) 188 char *page, int activate)
189{ 189{
190 int rc; 190 int rc;
@@ -207,26 +207,26 @@ static ssize_t get_best_energy_data(struct sys_device *dev,
207 207
208/* Wrapper functions */ 208/* Wrapper functions */
209 209
210static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class, 210static ssize_t cpu_activate_hint_list_show(struct device *dev,
211 struct sysdev_class_attribute *attr, char *page) 211 struct device_attribute *attr, char *page)
212{ 212{
213 return get_best_energy_list(page, 1); 213 return get_best_energy_list(page, 1);
214} 214}
215 215
216static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class, 216static ssize_t cpu_deactivate_hint_list_show(struct device *dev,
217 struct sysdev_class_attribute *attr, char *page) 217 struct device_attribute *attr, char *page)
218{ 218{
219 return get_best_energy_list(page, 0); 219 return get_best_energy_list(page, 0);
220} 220}
221 221
222static ssize_t percpu_activate_hint_show(struct sys_device *dev, 222static ssize_t percpu_activate_hint_show(struct device *dev,
223 struct sysdev_attribute *attr, char *page) 223 struct device_attribute *attr, char *page)
224{ 224{
225 return get_best_energy_data(dev, page, 1); 225 return get_best_energy_data(dev, page, 1);
226} 226}
227 227
228static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, 228static ssize_t percpu_deactivate_hint_show(struct device *dev,
229 struct sysdev_attribute *attr, char *page) 229 struct device_attribute *attr, char *page)
230{ 230{
231 return get_best_energy_data(dev, page, 0); 231 return get_best_energy_data(dev, page, 0);
232} 232}
@@ -241,48 +241,48 @@ static ssize_t percpu_deactivate_hint_show(struct sys_device *dev,
241 * Per-cpu value of the hint 241 * Per-cpu value of the hint
242 */ 242 */
243 243
244struct sysdev_class_attribute attr_cpu_activate_hint_list = 244struct device_attribute attr_cpu_activate_hint_list =
245 _SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444, 245 __ATTR(pseries_activate_hint_list, 0444,
246 cpu_activate_hint_list_show, NULL); 246 cpu_activate_hint_list_show, NULL);
247 247
248struct sysdev_class_attribute attr_cpu_deactivate_hint_list = 248struct device_attribute attr_cpu_deactivate_hint_list =
249 _SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444, 249 __ATTR(pseries_deactivate_hint_list, 0444,
250 cpu_deactivate_hint_list_show, NULL); 250 cpu_deactivate_hint_list_show, NULL);
251 251
252struct sysdev_attribute attr_percpu_activate_hint = 252struct device_attribute attr_percpu_activate_hint =
253 _SYSDEV_ATTR(pseries_activate_hint, 0444, 253 __ATTR(pseries_activate_hint, 0444,
254 percpu_activate_hint_show, NULL); 254 percpu_activate_hint_show, NULL);
255 255
256struct sysdev_attribute attr_percpu_deactivate_hint = 256struct device_attribute attr_percpu_deactivate_hint =
257 _SYSDEV_ATTR(pseries_deactivate_hint, 0444, 257 __ATTR(pseries_deactivate_hint, 0444,
258 percpu_deactivate_hint_show, NULL); 258 percpu_deactivate_hint_show, NULL);
259 259
260static int __init pseries_energy_init(void) 260static int __init pseries_energy_init(void)
261{ 261{
262 int cpu, err; 262 int cpu, err;
263 struct sys_device *cpu_sys_dev; 263 struct device *cpu_dev;
264 264
265 if (!check_for_h_best_energy()) { 265 if (!check_for_h_best_energy()) {
266 printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n"); 266 printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n");
267 return 0; 267 return 0;
268 } 268 }
269 /* Create the sysfs files */ 269 /* Create the sysfs files */
270 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 270 err = device_create_file(cpu_subsys.dev_root,
271 &attr_cpu_activate_hint_list.attr); 271 &attr_cpu_activate_hint_list);
272 if (!err) 272 if (!err)
273 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 273 err = device_create_file(cpu_subsys.dev_root,
274 &attr_cpu_deactivate_hint_list.attr); 274 &attr_cpu_deactivate_hint_list);
275 275
276 if (err) 276 if (err)
277 return err; 277 return err;
278 for_each_possible_cpu(cpu) { 278 for_each_possible_cpu(cpu) {
279 cpu_sys_dev = get_cpu_sysdev(cpu); 279 cpu_dev = get_cpu_device(cpu);
280 err = sysfs_create_file(&cpu_sys_dev->kobj, 280 err = device_create_file(cpu_dev,
281 &attr_percpu_activate_hint.attr); 281 &attr_percpu_activate_hint);
282 if (err) 282 if (err)
283 break; 283 break;
284 err = sysfs_create_file(&cpu_sys_dev->kobj, 284 err = device_create_file(cpu_dev,
285 &attr_percpu_deactivate_hint.attr); 285 &attr_percpu_deactivate_hint);
286 if (err) 286 if (err)
287 break; 287 break;
288 } 288 }
@@ -298,23 +298,20 @@ static int __init pseries_energy_init(void)
298static void __exit pseries_energy_cleanup(void) 298static void __exit pseries_energy_cleanup(void)
299{ 299{
300 int cpu; 300 int cpu;
301 struct sys_device *cpu_sys_dev; 301 struct device *cpu_dev;
302 302
303 if (!sysfs_entries) 303 if (!sysfs_entries)
304 return; 304 return;
305 305
306 /* Remove the sysfs files */ 306 /* Remove the sysfs files */
307 sysfs_remove_file(&cpu_sysdev_class.kset.kobj, 307 device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list);
308 &attr_cpu_activate_hint_list.attr); 308 device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list);
309
310 sysfs_remove_file(&cpu_sysdev_class.kset.kobj,
311 &attr_cpu_deactivate_hint_list.attr);
312 309
313 for_each_possible_cpu(cpu) { 310 for_each_possible_cpu(cpu) {
314 cpu_sys_dev = get_cpu_sysdev(cpu); 311 cpu_dev = get_cpu_device(cpu);
315 sysfs_remove_file(&cpu_sys_dev->kobj, 312 sysfs_remove_file(&cpu_dev->kobj,
316 &attr_percpu_activate_hint.attr); 313 &attr_percpu_activate_hint.attr);
317 sysfs_remove_file(&cpu_sys_dev->kobj, 314 sysfs_remove_file(&cpu_dev->kobj,
318 &attr_percpu_deactivate_hint.attr); 315 &attr_percpu_deactivate_hint.attr);
319 } 316 }
320} 317}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index bbc3c42f6730..eadba9521a35 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -22,7 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/cache.h> 23#include <linux/cache.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27 27
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index d3de0849f296..b84a8b2238dd 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -26,7 +26,7 @@
26#include <asm/rtas.h> 26#include <asm/rtas.h>
27 27
28static u64 stream_id; 28static u64 stream_id;
29static struct sys_device suspend_sysdev; 29static struct device suspend_dev;
30static DECLARE_COMPLETION(suspend_work); 30static DECLARE_COMPLETION(suspend_work);
31static struct rtas_suspend_me_data suspend_data; 31static struct rtas_suspend_me_data suspend_data;
32static atomic_t suspending; 32static atomic_t suspending;
@@ -110,8 +110,8 @@ static int pseries_prepare_late(void)
110 110
111/** 111/**
112 * store_hibernate - Initiate partition hibernation 112 * store_hibernate - Initiate partition hibernation
113 * @classdev: sysdev class struct 113 * @dev: subsys root device
114 * @attr: class device attribute struct 114 * @attr: device attribute struct
115 * @buf: buffer 115 * @buf: buffer
116 * @count: buffer size 116 * @count: buffer size
117 * 117 *
@@ -121,8 +121,8 @@ static int pseries_prepare_late(void)
121 * Return value: 121 * Return value:
122 * number of bytes printed to buffer / other on failure 122 * number of bytes printed to buffer / other on failure
123 **/ 123 **/
124static ssize_t store_hibernate(struct sysdev_class *classdev, 124static ssize_t store_hibernate(struct device *dev,
125 struct sysdev_class_attribute *attr, 125 struct device_attribute *attr,
126 const char *buf, size_t count) 126 const char *buf, size_t count)
127{ 127{
128 int rc; 128 int rc;
@@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,
148 return rc; 148 return rc;
149} 149}
150 150
151static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); 151static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
152 152
153static struct sysdev_class suspend_sysdev_class = { 153static struct bus_type suspend_subsys = {
154 .name = "power", 154 .name = "power",
155 .dev_name = "power",
155}; 156};
156 157
157static const struct platform_suspend_ops pseries_suspend_ops = { 158static const struct platform_suspend_ops pseries_suspend_ops = {
@@ -167,23 +168,23 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
167 * Return value: 168 * Return value:
168 * 0 on success / other on failure 169 * 0 on success / other on failure
169 **/ 170 **/
170static int pseries_suspend_sysfs_register(struct sys_device *sysdev) 171static int pseries_suspend_sysfs_register(struct device *dev)
171{ 172{
172 int rc; 173 int rc;
173 174
174 if ((rc = sysdev_class_register(&suspend_sysdev_class))) 175 if ((rc = subsys_system_register(&suspend_subsys, NULL)))
175 return rc; 176 return rc;
176 177
177 sysdev->id = 0; 178 dev->id = 0;
178 sysdev->cls = &suspend_sysdev_class; 179 dev->bus = &suspend_subsys;
179 180
180 if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate))) 181 if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
181 goto class_unregister; 182 goto subsys_unregister;
182 183
183 return 0; 184 return 0;
184 185
185class_unregister: 186subsys_unregister:
186 sysdev_class_unregister(&suspend_sysdev_class); 187 bus_unregister(&suspend_subsys);
187 return rc; 188 return rc;
188} 189}
189 190
@@ -204,7 +205,7 @@ static int __init pseries_suspend_init(void)
204 if (suspend_data.token == RTAS_UNKNOWN_SERVICE) 205 if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
205 return 0; 206 return 0;
206 207
207 if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev))) 208 if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
208 return rc; 209 return rc;
209 210
210 ppc_md.suspend_disable_cpu = pseries_suspend_cpu; 211 ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
index 73b86cc5ea74..82e2cfe35c62 100644
--- a/arch/powerpc/sysdev/ppc4xx_cpm.c
+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
@@ -179,12 +179,12 @@ static struct kobj_attribute cpm_idle_attr =
179 179
180static void cpm_idle_config_sysfs(void) 180static void cpm_idle_config_sysfs(void)
181{ 181{
182 struct sys_device *sys_dev; 182 struct device *dev;
183 unsigned long ret; 183 unsigned long ret;
184 184
185 sys_dev = get_cpu_sysdev(0); 185 dev = get_cpu_device(0);
186 186
187 ret = sysfs_create_file(&sys_dev->kobj, 187 ret = sysfs_create_file(&dev->kobj,
188 &cpm_idle_attr.attr); 188 &cpm_idle_attr.attr);
189 if (ret) 189 if (ret)
190 printk(KERN_WARNING 190 printk(KERN_WARNING
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 18e75ca19fe6..73034bd203c4 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -22,7 +22,6 @@
22#include <linux/stddef.h> 22#include <linux/stddef.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/signal.h> 24#include <linux/signal.h>
25#include <linux/sysdev.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/bootmem.h> 26#include <linux/bootmem.h>
28#include <linux/spinlock.h> 27#include <linux/spinlock.h>
@@ -484,13 +483,14 @@ int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high)
484 return 0; 483 return 0;
485} 484}
486 485
487static struct sysdev_class qe_ic_sysclass = { 486static struct bus_type qe_ic_subsys = {
488 .name = "qe_ic", 487 .name = "qe_ic",
488 .dev_name = "qe_ic",
489}; 489};
490 490
491static struct sys_device device_qe_ic = { 491static struct device device_qe_ic = {
492 .id = 0, 492 .id = 0,
493 .cls = &qe_ic_sysclass, 493 .bus = &qe_ic_subsys,
494}; 494};
495 495
496static int __init init_qe_ic_sysfs(void) 496static int __init init_qe_ic_sysfs(void)
@@ -499,12 +499,12 @@ static int __init init_qe_ic_sysfs(void)
499 499
500 printk(KERN_DEBUG "Registering qe_ic with sysfs...\n"); 500 printk(KERN_DEBUG "Registering qe_ic with sysfs...\n");
501 501
502 rc = sysdev_class_register(&qe_ic_sysclass); 502 rc = subsys_system_register(&qe_ic_subsys, NULL);
503 if (rc) { 503 if (rc) {
504 printk(KERN_ERR "Failed registering qe_ic sys class\n"); 504 printk(KERN_ERR "Failed registering qe_ic sys class\n");
505 return -ENODEV; 505 return -ENODEV;
506 } 506 }
507 rc = sysdev_register(&device_qe_ic); 507 rc = device_register(&device_qe_ic);
508 if (rc) { 508 if (rc) {
509 printk(KERN_ERR "Failed registering qe_ic sys device\n"); 509 printk(KERN_ERR "Failed registering qe_ic sys device\n");
510 return -ENODEV; 510 return -ENODEV;
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 3330feca7502..063c901b1265 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -18,7 +18,6 @@
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/sysdev.h>
22#include <linux/device.h> 21#include <linux/device.h>
23#include <linux/bootmem.h> 22#include <linux/bootmem.h>
24#include <linux/spinlock.h> 23#include <linux/spinlock.h>