aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
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/platforms
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/platforms')
-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
9 files changed, 192 insertions, 192 deletions
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;