aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-13 10:00:22 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-01-13 10:00:22 -0500
commit4de3a8e101150feaefa1139611a50ff37467f33e (patch)
treedaada742542518b02d7db7c5d32e715eaa5f166d /arch/powerpc
parent294064f58953f9964e5945424b09c51800330a83 (diff)
parent099469502f62fbe0d7e4f0b83a2f22538367f734 (diff)
Merge branch 'master' into fixes
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/asm/io.h2
-rw-r--r--arch/powerpc/include/asm/keylargo.h2
-rw-r--r--arch/powerpc/include/asm/kvm.h4
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h1
-rw-r--r--arch/powerpc/include/asm/pci.h5
-rw-r--r--arch/powerpc/include/asm/spu.h14
-rw-r--r--arch/powerpc/include/asm/thread_info.h2
-rw-r--r--arch/powerpc/include/asm/topology.h10
-rw-r--r--arch/powerpc/include/asm/types.h6
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/iomap.c19
-rw-r--r--arch/powerpc/kernel/legacy_serial.c3
-rw-r--r--arch/powerpc/kernel/lparcfg.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec_32.c4
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c6
-rw-r--r--arch/powerpc/kernel/pci-common.c30
-rw-r--r--arch/powerpc/kernel/pci_64.c40
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/sysfs.c267
-rw-r--r--arch/powerpc/kernel/vio.c1
-rw-r--r--arch/powerpc/kvm/book3s.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_builtin.c2
-rw-r--r--arch/powerpc/mm/numa.c12
-rw-r--r--arch/powerpc/platforms/40x/Kconfig40
-rw-r--r--arch/powerpc/platforms/44x/Kconfig18
-rw-r--r--arch/powerpc/platforms/512x/Kconfig1
-rw-r--r--arch/powerpc/platforms/Kconfig3
-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/cell/spu_syscalls.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c17
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h4
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-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/nvram.c1
-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/axonram.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_cpm.c6
-rw-r--r--arch/powerpc/sysdev/qe_lib/gpio.c42
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c12
-rw-r--r--arch/powerpc/sysdev/uic.c1
47 files changed, 436 insertions, 547 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 692ac7588e20..1919634a9b32 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -718,6 +718,7 @@ config PCI
718 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx 718 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
719 default PCI_QSPAN if !4xx && !CPM2 && 8xx 719 default PCI_QSPAN if !4xx && !CPM2 && 8xx
720 select ARCH_SUPPORTS_MSI 720 select ARCH_SUPPORTS_MSI
721 select GENERIC_PCI_IOMAP
721 help 722 help
722 Find out whether your system includes a PCI bus. PCI is the name of 723 Find out whether your system includes a PCI bus. PCI is the name of
723 a bus system, i.e. the way the CPU talks to the other stuff inside 724 a bus system, i.e. the way the CPU talks to the other stuff inside
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 45698d55cd6a..a3855b81eada 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -394,7 +394,7 @@ __do_out_asm(_rec_outl, "stwbrx")
394#endif /* CONFIG_PPC32 */ 394#endif /* CONFIG_PPC32 */
395 395
396/* The "__do_*" operations below provide the actual "base" implementation 396/* The "__do_*" operations below provide the actual "base" implementation
397 * for each of the defined acccessor. Some of them use the out_* functions 397 * for each of the defined accessors. Some of them use the out_* functions
398 * directly, some of them still use EEH, though we might change that in the 398 * directly, some of them still use EEH, though we might change that in the
399 * future. Those macros below provide the necessary argument swapping and 399 * future. Those macros below provide the necessary argument swapping and
400 * handling of the IO base for PIO. 400 * handling of the IO base for PIO.
diff --git a/arch/powerpc/include/asm/keylargo.h b/arch/powerpc/include/asm/keylargo.h
index d8520ef121f9..fc195d0b3c34 100644
--- a/arch/powerpc/include/asm/keylargo.h
+++ b/arch/powerpc/include/asm/keylargo.h
@@ -51,7 +51,7 @@
51 51
52#define KL_GPIO_SOUND_POWER (KEYLARGO_GPIO_0+0x05) 52#define KL_GPIO_SOUND_POWER (KEYLARGO_GPIO_0+0x05)
53 53
54/* Hrm... this one is only to be used on Pismo. It seeem to also 54/* Hrm... this one is only to be used on Pismo. It seems to also
55 * control the timebase enable on other machines. Still to be 55 * control the timebase enable on other machines. Still to be
56 * experimented... --BenH. 56 * experimented... --BenH.
57 */ 57 */
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
index 0ad432bc81d6..f7727d91ac6b 100644
--- a/arch/powerpc/include/asm/kvm.h
+++ b/arch/powerpc/include/asm/kvm.h
@@ -170,8 +170,8 @@ struct kvm_sregs {
170 } ppc64; 170 } ppc64;
171 struct { 171 struct {
172 __u32 sr[16]; 172 __u32 sr[16];
173 __u64 ibat[8]; 173 __u64 ibat[8];
174 __u64 dbat[8]; 174 __u64 dbat[8];
175 } ppc32; 175 } ppc32;
176 } s; 176 } s;
177 struct { 177 struct {
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 882b6aa6c857..5d487657322e 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -226,7 +226,6 @@ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
226/* Allocate & free a PCI host bridge structure */ 226/* Allocate & free a PCI host bridge structure */
227extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); 227extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
228extern void pcibios_free_controller(struct pci_controller *phb); 228extern void pcibios_free_controller(struct pci_controller *phb);
229extern void pcibios_setup_phb_resources(struct pci_controller *hose);
230 229
231#ifdef CONFIG_PCI 230#ifdef CONFIG_PCI
232extern int pcibios_vaddr_is_ioport(void __iomem *address); 231extern int pcibios_vaddr_is_ioport(void __iomem *address);
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 1c92013466e3..f54b3d26ce9d 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -46,11 +46,6 @@ struct pci_dev;
46#define pcibios_assign_all_busses() \ 46#define pcibios_assign_all_busses() \
47 (pci_has_flag(PCI_REASSIGN_ALL_BUS)) 47 (pci_has_flag(PCI_REASSIGN_ALL_BUS))
48 48
49static inline void pcibios_set_master(struct pci_dev *dev)
50{
51 /* No special bus mastering setup handling */
52}
53
54static inline void pcibios_penalize_isa_irq(int irq, int active) 49static inline void pcibios_penalize_isa_irq(int irq, int active)
55{ 50{
56 /* We don't do dynamic PCI IRQ allocation */ 51 /* We don't do dynamic PCI IRQ allocation */
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 4e360bd4a35a..93f280e23279 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;
@@ -237,7 +237,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
237struct file; 237struct file;
238struct spufs_calls { 238struct spufs_calls {
239 long (*create_thread)(const char __user *name, 239 long (*create_thread)(const char __user *name,
240 unsigned int flags, mode_t mode, 240 unsigned int flags, umode_t mode,
241 struct file *neighbor); 241 struct file *neighbor);
242 long (*spu_run)(struct file *filp, __u32 __user *unpc, 242 long (*spu_run)(struct file *filp, __u32 __user *unpc,
243 __u32 __user *ustatus); 243 __u32 __user *ustatus);
@@ -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/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 836f231ec1f0..964714940961 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -109,7 +109,6 @@ static inline struct thread_info *current_thread_info(void)
109#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ 109#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
110#define TIF_NOERROR 12 /* Force successful syscall return */ 110#define TIF_NOERROR 12 /* Force successful syscall return */
111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
112#define TIF_FREEZE 14 /* Freezing for suspend */
113#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ 112#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
114#define TIF_RUNLATCH 16 /* Is the runlatch enabled? */ 113#define TIF_RUNLATCH 16 /* Is the runlatch enabled? */
115 114
@@ -127,7 +126,6 @@ static inline struct thread_info *current_thread_info(void)
127#define _TIF_RESTOREALL (1<<TIF_RESTOREALL) 126#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
128#define _TIF_NOERROR (1<<TIF_NOERROR) 127#define _TIF_NOERROR (1<<TIF_NOERROR)
129#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 128#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
130#define _TIF_FREEZE (1<<TIF_FREEZE)
131#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 129#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
132#define _TIF_RUNLATCH (1<<TIF_RUNLATCH) 130#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
133#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 131#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
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/include/asm/types.h b/arch/powerpc/include/asm/types.h
index d82e94e6c2b4..0abf7f2c6df9 100644
--- a/arch/powerpc/include/asm/types.h
+++ b/arch/powerpc/include/asm/types.h
@@ -30,12 +30,6 @@
30 * 2 of the License, or (at your option) any later version. 30 * 2 of the License, or (at your option) any later version.
31 */ 31 */
32 32
33#ifdef __powerpc64__
34typedef unsigned int umode_t;
35#else
36typedef unsigned short umode_t;
37#endif
38
39typedef struct { 33typedef struct {
40 __u32 u[4]; 34 __u32 u[4];
41} __attribute__((aligned(16))) __vector128; 35} __attribute__((aligned(16))) __vector128;
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/iomap.c b/arch/powerpc/kernel/iomap.c
index 262791807397..97a3715ac8bd 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -119,24 +119,6 @@ EXPORT_SYMBOL(ioport_map);
119EXPORT_SYMBOL(ioport_unmap); 119EXPORT_SYMBOL(ioport_unmap);
120 120
121#ifdef CONFIG_PCI 121#ifdef CONFIG_PCI
122void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
123{
124 resource_size_t start = pci_resource_start(dev, bar);
125 resource_size_t len = pci_resource_len(dev, bar);
126 unsigned long flags = pci_resource_flags(dev, bar);
127
128 if (!len)
129 return NULL;
130 if (max && len > max)
131 len = max;
132 if (flags & IORESOURCE_IO)
133 return ioport_map(start, len);
134 if (flags & IORESOURCE_MEM)
135 return ioremap(start, len);
136 /* What? */
137 return NULL;
138}
139
140void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 122void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
141{ 123{
142 if (isa_vaddr_is_ioport(addr)) 124 if (isa_vaddr_is_ioport(addr))
@@ -146,6 +128,5 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
146 iounmap(addr); 128 iounmap(addr);
147} 129}
148 130
149EXPORT_SYMBOL(pci_iomap);
150EXPORT_SYMBOL(pci_iounmap); 131EXPORT_SYMBOL(pci_iounmap);
151#endif /* CONFIG_PCI */ 132#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index c7b5afeecaf2..3fea3689527e 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -441,6 +441,9 @@ static void __init fixup_port_irq(int index,
441 return; 441 return;
442 442
443 port->irq = virq; 443 port->irq = virq;
444
445 if (of_device_is_compatible(np, "fsl,ns16550"))
446 port->handle_irq = fsl8250_handle_irq;
444} 447}
445 448
446static void __init fixup_port_pio(int index, 449static void __init fixup_port_pio(int index,
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 84daabe2fcba..578f35f18723 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -783,7 +783,7 @@ static const struct file_operations lparcfg_fops = {
783static int __init lparcfg_init(void) 783static int __init lparcfg_init(void)
784{ 784{
785 struct proc_dir_entry *ent; 785 struct proc_dir_entry *ent;
786 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 786 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
787 787
788 /* Allow writing if we have FW_FEATURE_SPLPAR */ 788 /* Allow writing if we have FW_FEATURE_SPLPAR */
789 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 789 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
diff --git a/arch/powerpc/kernel/machine_kexec_32.c b/arch/powerpc/kernel/machine_kexec_32.c
index e63f2e7d2efb..affe5dcce7f4 100644
--- a/arch/powerpc/kernel/machine_kexec_32.c
+++ b/arch/powerpc/kernel/machine_kexec_32.c
@@ -16,10 +16,10 @@
16#include <asm/hw_irq.h> 16#include <asm/hw_irq.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19typedef NORET_TYPE void (*relocate_new_kernel_t)( 19typedef void (*relocate_new_kernel_t)(
20 unsigned long indirection_page, 20 unsigned long indirection_page,
21 unsigned long reboot_code_buffer, 21 unsigned long reboot_code_buffer,
22 unsigned long start_address) ATTRIB_NORET; 22 unsigned long start_address) __noreturn;
23 23
24/* 24/*
25 * This is a generic machine_kexec function suitable at least for 25 * This is a generic machine_kexec function suitable at least for
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 26ccbf77dd41..d7f609086a99 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -307,9 +307,9 @@ static union thread_union kexec_stack __init_task_data =
307struct paca_struct kexec_paca; 307struct paca_struct kexec_paca;
308 308
309/* Our assembly helper, in kexec_stub.S */ 309/* Our assembly helper, in kexec_stub.S */
310extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start, 310extern void kexec_sequence(void *newstack, unsigned long start,
311 void *image, void *control, 311 void *image, void *control,
312 void (*clear_all)(void)) ATTRIB_NORET; 312 void (*clear_all)(void)) __noreturn;
313 313
314/* too late to fail here */ 314/* too late to fail here */
315void default_machine_kexec(struct kimage *image) 315void default_machine_kexec(struct kimage *image)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index fa4a573d6716..cce98d76e905 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1131,6 +1131,11 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1131 } 1131 }
1132} 1132}
1133 1133
1134void pcibios_set_master(struct pci_dev *dev)
1135{
1136 /* No special bus mastering setup handling */
1137}
1138
1134void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1139void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1135{ 1140{
1136 /* When called from the generic PCI probe, read PCI<->PCI bridge 1141 /* When called from the generic PCI probe, read PCI<->PCI bridge
@@ -1560,14 +1565,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1560 return pci_enable_resources(dev, mask); 1565 return pci_enable_resources(dev, mask);
1561} 1566}
1562 1567
1563void __devinit pcibios_setup_phb_resources(struct pci_controller *hose) 1568static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
1564{ 1569{
1565 struct pci_bus *bus = hose->bus;
1566 struct resource *res; 1570 struct resource *res;
1567 int i; 1571 int i;
1568 1572
1569 /* Hookup PHB IO resource */ 1573 /* Hookup PHB IO resource */
1570 bus->resource[0] = res = &hose->io_resource; 1574 res = &hose->io_resource;
1571 1575
1572 if (!res->flags) { 1576 if (!res->flags) {
1573 printk(KERN_WARNING "PCI: I/O resource not set for host" 1577 printk(KERN_WARNING "PCI: I/O resource not set for host"
@@ -1585,6 +1589,7 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1585 (unsigned long long)res->start, 1589 (unsigned long long)res->start,
1586 (unsigned long long)res->end, 1590 (unsigned long long)res->end,
1587 (unsigned long)res->flags); 1591 (unsigned long)res->flags);
1592 pci_add_resource(resources, res);
1588 1593
1589 /* Hookup PHB Memory resources */ 1594 /* Hookup PHB Memory resources */
1590 for (i = 0; i < 3; ++i) { 1595 for (i = 0; i < 3; ++i) {
@@ -1602,12 +1607,12 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1602 res->flags = IORESOURCE_MEM; 1607 res->flags = IORESOURCE_MEM;
1603#endif /* CONFIG_PPC32 */ 1608#endif /* CONFIG_PPC32 */
1604 } 1609 }
1605 bus->resource[i+1] = res;
1606 1610
1607 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i, 1611 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
1608 (unsigned long long)res->start, 1612 (unsigned long long)res->start,
1609 (unsigned long long)res->end, 1613 (unsigned long long)res->end,
1610 (unsigned long)res->flags); 1614 (unsigned long)res->flags);
1615 pci_add_resource(resources, res);
1611 } 1616 }
1612 1617
1613 pr_debug("PCI: PHB MEM offset = %016llx\n", 1618 pr_debug("PCI: PHB MEM offset = %016llx\n",
@@ -1701,6 +1706,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
1701 */ 1706 */
1702void __devinit pcibios_scan_phb(struct pci_controller *hose) 1707void __devinit pcibios_scan_phb(struct pci_controller *hose)
1703{ 1708{
1709 LIST_HEAD(resources);
1704 struct pci_bus *bus; 1710 struct pci_bus *bus;
1705 struct device_node *node = hose->dn; 1711 struct device_node *node = hose->dn;
1706 int mode; 1712 int mode;
@@ -1708,22 +1714,24 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
1708 pr_debug("PCI: Scanning PHB %s\n", 1714 pr_debug("PCI: Scanning PHB %s\n",
1709 node ? node->full_name : "<NO NAME>"); 1715 node ? node->full_name : "<NO NAME>");
1710 1716
1717 /* Get some IO space for the new PHB */
1718 pcibios_setup_phb_io_space(hose);
1719
1720 /* Wire up PHB bus resources */
1721 pcibios_setup_phb_resources(hose, &resources);
1722
1711 /* Create an empty bus for the toplevel */ 1723 /* Create an empty bus for the toplevel */
1712 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose); 1724 bus = pci_create_root_bus(hose->parent, hose->first_busno,
1725 hose->ops, hose, &resources);
1713 if (bus == NULL) { 1726 if (bus == NULL) {
1714 pr_err("Failed to create bus for PCI domain %04x\n", 1727 pr_err("Failed to create bus for PCI domain %04x\n",
1715 hose->global_number); 1728 hose->global_number);
1729 pci_free_resource_list(&resources);
1716 return; 1730 return;
1717 } 1731 }
1718 bus->secondary = hose->first_busno; 1732 bus->secondary = hose->first_busno;
1719 hose->bus = bus; 1733 hose->bus = bus;
1720 1734
1721 /* Get some IO space for the new PHB */
1722 pcibios_setup_phb_io_space(hose);
1723
1724 /* Wire up PHB bus resources */
1725 pcibios_setup_phb_resources(hose);
1726
1727 /* Get probe mode and perform scan */ 1735 /* Get probe mode and perform scan */
1728 mode = PCI_PROBE_NORMAL; 1736 mode = PCI_PROBE_NORMAL;
1729 if (node && ppc_md.pci_probe_mode) 1737 if (node && ppc_md.pci_probe_mode)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index bcf4bf9e72d9..3318d39b7d4c 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -131,30 +131,13 @@ EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
131 131
132#endif /* CONFIG_HOTPLUG */ 132#endif /* CONFIG_HOTPLUG */
133 133
134int __devinit pcibios_map_io_space(struct pci_bus *bus) 134static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
135{ 135{
136 struct vm_struct *area; 136 struct vm_struct *area;
137 unsigned long phys_page; 137 unsigned long phys_page;
138 unsigned long size_page; 138 unsigned long size_page;
139 unsigned long io_virt_offset; 139 unsigned long io_virt_offset;
140 struct pci_controller *hose;
141
142 WARN_ON(bus == NULL);
143
144 /* If this not a PHB, nothing to do, page tables still exist and
145 * thus HPTEs will be faulted in when needed
146 */
147 if (bus->self) {
148 pr_debug("IO mapping for PCI-PCI bridge %s\n",
149 pci_name(bus->self));
150 pr_debug(" virt=0x%016llx...0x%016llx\n",
151 bus->resource[0]->start + _IO_BASE,
152 bus->resource[0]->end + _IO_BASE);
153 return 0;
154 }
155 140
156 /* Get the host bridge */
157 hose = pci_bus_to_host(bus);
158 phys_page = _ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE); 141 phys_page = _ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE);
159 size_page = _ALIGN_UP(hose->pci_io_size, PAGE_SIZE); 142 size_page = _ALIGN_UP(hose->pci_io_size, PAGE_SIZE);
160 143
@@ -198,11 +181,30 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
198 181
199 return 0; 182 return 0;
200} 183}
184
185int __devinit pcibios_map_io_space(struct pci_bus *bus)
186{
187 WARN_ON(bus == NULL);
188
189 /* If this not a PHB, nothing to do, page tables still exist and
190 * thus HPTEs will be faulted in when needed
191 */
192 if (bus->self) {
193 pr_debug("IO mapping for PCI-PCI bridge %s\n",
194 pci_name(bus->self));
195 pr_debug(" virt=0x%016llx...0x%016llx\n",
196 bus->resource[0]->start + _IO_BASE,
197 bus->resource[0]->end + _IO_BASE);
198 return 0;
199 }
200
201 return pcibios_map_phb_io_space(pci_bus_to_host(bus));
202}
201EXPORT_SYMBOL_GPL(pcibios_map_io_space); 203EXPORT_SYMBOL_GPL(pcibios_map_io_space);
202 204
203void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose) 205void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose)
204{ 206{
205 pcibios_map_io_space(hose->bus); 207 pcibios_map_phb_io_space(hose);
206} 208}
207 209
208#define IOBASE_BRIDGE_NUMBER 0 210#define IOBASE_BRIDGE_NUMBER 0
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/kernel/vio.c b/arch/powerpc/kernel/vio.c
index f65af61996bd..8b086299ba25 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1406,7 +1406,6 @@ static struct bus_type vio_bus_type = {
1406 .match = vio_bus_match, 1406 .match = vio_bus_match,
1407 .probe = vio_bus_probe, 1407 .probe = vio_bus_probe,
1408 .remove = vio_bus_remove, 1408 .remove = vio_bus_remove,
1409 .pm = GENERIC_SUBSYS_PM_OPS,
1410}; 1409};
1411 1410
1412/** 1411/**
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index a459479995c6..e41ac6f7dcf1 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -498,7 +498,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
498 498
499 /* If nothing is dirty, don't bother messing with page tables. */ 499 /* If nothing is dirty, don't bother messing with page tables. */
500 if (is_dirty) { 500 if (is_dirty) {
501 memslot = &kvm->memslots->memslots[log->slot]; 501 memslot = id_to_memslot(kvm->memslots, log->slot);
502 502
503 ga = memslot->base_gfn << PAGE_SHIFT; 503 ga = memslot->base_gfn << PAGE_SHIFT;
504 ga_end = ga + (memslot->npages << PAGE_SHIFT); 504 ga_end = ga + (memslot->npages << PAGE_SHIFT);
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index 286f13d601cf..a795a13f4a70 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -86,7 +86,7 @@ static inline int lpcr_rmls(unsigned long rma_size)
86 * to allocate contiguous physical memory for the real memory 86 * to allocate contiguous physical memory for the real memory
87 * areas for guests. 87 * areas for guests.
88 */ 88 */
89void kvm_rma_init(void) 89void __init kvm_rma_init(void)
90{ 90{
91 unsigned long i; 91 unsigned long i;
92 unsigned long j, npages; 92 unsigned long j, npages;
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c0189c169bbb..3feefc3842a8 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -58,7 +58,7 @@ static int distance_lookup_table[MAX_NUMNODES][MAX_DISTANCE_REF_POINTS];
58 * Allocate node_to_cpumask_map based on number of available nodes 58 * Allocate node_to_cpumask_map based on number of available nodes
59 * Requires node_possible_map to be valid. 59 * Requires node_possible_map to be valid.
60 * 60 *
61 * Note: node_to_cpumask() is not valid until after this is done. 61 * Note: cpumask_of_node() is not valid until after this is done.
62 */ 62 */
63static void __init setup_node_to_cpumask_map(void) 63static void __init setup_node_to_cpumask_map(void)
64{ 64{
@@ -501,7 +501,7 @@ static int of_get_assoc_arrays(struct device_node *memory,
501 aa->n_arrays = *prop++; 501 aa->n_arrays = *prop++;
502 aa->array_sz = *prop++; 502 aa->array_sz = *prop++;
503 503
504 /* Now that we know the number of arrrays and size of each array, 504 /* Now that we know the number of arrays and size of each array,
505 * revalidate the size of the property read in. 505 * revalidate the size of the property read in.
506 */ 506 */
507 if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int)) 507 if (len < (aa->n_arrays * aa->array_sz + 2) * sizeof(unsigned int))
@@ -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/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index baae85584b1c..a392d12dd21f 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -1,19 +1,3 @@
1#config BUBINGA
2# bool "Bubinga"
3# depends on 40x
4# default n
5# select 405EP
6# help
7# This option enables support for the IBM 405EP evaluation board.
8
9#config CPCI405
10# bool "CPCI405"
11# depends on 40x
12# default n
13# select 405GP
14# help
15# This option enables support for the CPCI405 board.
16
17config ACADIA 1config ACADIA
18 bool "Acadia" 2 bool "Acadia"
19 depends on 40x 3 depends on 40x
@@ -65,14 +49,6 @@ config MAKALU
65 help 49 help
66 This option enables support for the AMCC PPC405EX board. 50 This option enables support for the AMCC PPC405EX board.
67 51
68#config SYCAMORE
69# bool "Sycamore"
70# depends on 40x
71# default n
72# select 405GPR
73# help
74# This option enables support for the IBM PPC405GPr evaluation board.
75
76config WALNUT 52config WALNUT
77 bool "Walnut" 53 bool "Walnut"
78 depends on 40x 54 depends on 40x
@@ -183,21 +159,6 @@ config IBM405_ERR77
183config IBM405_ERR51 159config IBM405_ERR51
184 bool 160 bool
185 161
186#config BIOS_FIXUP
187# bool
188# depends on BUBINGA || EP405 || SYCAMORE || WALNUT
189# default y
190
191#config PPC4xx_DMA
192# bool "PPC4xx DMA controller support"
193# depends on 4xx
194
195#config PPC4xx_EDMA
196# bool
197# depends on !STB03xxx && PPC4xx_DMA
198# default y
199#
200
201config APM8018X 162config APM8018X
202 bool "APM8018X" 163 bool "APM8018X"
203 depends on 40x 164 depends on 40x
@@ -206,4 +167,3 @@ config APM8018X
206 help 167 help
207 This option enables support for the AppliedMicro APM8018X evaluation 168 This option enables support for the AppliedMicro APM8018X evaluation
208 board. 169 board.
209
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 5d5aaf6c91aa..fcf6bf2ceee9 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -75,7 +75,7 @@ config KATMAI
75 select PCI 75 select PCI
76 select PPC4xx_PCI_EXPRESS 76 select PPC4xx_PCI_EXPRESS
77 select PCI_MSI 77 select PCI_MSI
78 select PCC4xx_MSI 78 select PPC4xx_MSI
79 help 79 help
80 This option enables support for the AMCC PPC440SPe evaluation board. 80 This option enables support for the AMCC PPC440SPe evaluation board.
81 81
@@ -207,22 +207,6 @@ config ICON
207 help 207 help
208 This option enables support for the AMCC PPC440SPe evaluation board. 208 This option enables support for the AMCC PPC440SPe evaluation board.
209 209
210#config LUAN
211# bool "Luan"
212# depends on 44x
213# default n
214# select 440SP
215# help
216# This option enables support for the IBM PPC440SP evaluation board.
217
218#config OCOTEA
219# bool "Ocotea"
220# depends on 44x
221# default n
222# select 440GX
223# help
224# This option enables support for the IBM PPC440GX evaluation board.
225
226config XILINX_VIRTEX440_GENERIC_BOARD 210config XILINX_VIRTEX440_GENERIC_BOARD
227 bool "Generic Xilinx Virtex 5 FXT board support" 211 bool "Generic Xilinx Virtex 5 FXT board support"
228 depends on 44x 212 depends on 44x
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index b3ebce1aec07..c16999802ecf 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -12,7 +12,6 @@ config MPC5121_ADS
12 bool "Freescale MPC5121E ADS" 12 bool "Freescale MPC5121E ADS"
13 depends on PPC_MPC512x 13 depends on PPC_MPC512x
14 select DEFAULT_UIMAGE 14 select DEFAULT_UIMAGE
15 select MPC5121_ADS_CPLD
16 help 15 help
17 This option enables support for the MPC5121E ADS board. 16 This option enables support for the MPC5121E ADS board.
18 17
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 31e1adeaa92a..0cfb46d54b8c 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -175,9 +175,6 @@ config PPC_INDIRECT_MMIO
175config PPC_IO_WORKAROUNDS 175config PPC_IO_WORKAROUNDS
176 bool 176 bool
177 177
178config GENERIC_IOMAP
179 bool
180
181source "drivers/cpufreq/Kconfig" 178source "drivers/cpufreq/Kconfig"
182 179
183menu "CPU Frequency drivers" 180menu "CPU Frequency drivers"
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/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 75530d99eda6..714bbfc3162c 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -65,8 +65,8 @@ static inline void spufs_calls_put(struct spufs_calls *calls) { }
65 65
66#endif /* CONFIG_SPU_FS_MODULE */ 66#endif /* CONFIG_SPU_FS_MODULE */
67 67
68asmlinkage long sys_spu_create(const char __user *name, 68SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
69 unsigned int flags, mode_t mode, int neighbor_fd) 69 umode_t, mode, int, neighbor_fd)
70{ 70{
71 long ret; 71 long ret;
72 struct file *neighbor; 72 struct file *neighbor;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index e481f6b9a789..d4a094ca96f3 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -74,7 +74,6 @@ spufs_alloc_inode(struct super_block *sb)
74static void spufs_i_callback(struct rcu_head *head) 74static void spufs_i_callback(struct rcu_head *head)
75{ 75{
76 struct inode *inode = container_of(head, struct inode, i_rcu); 76 struct inode *inode = container_of(head, struct inode, i_rcu);
77 INIT_LIST_HEAD(&inode->i_dentry);
78 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode)); 77 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode));
79} 78}
80 79
@@ -92,7 +91,7 @@ spufs_init_once(void *p)
92} 91}
93 92
94static struct inode * 93static struct inode *
95spufs_new_inode(struct super_block *sb, int mode) 94spufs_new_inode(struct super_block *sb, umode_t mode)
96{ 95{
97 struct inode *inode; 96 struct inode *inode;
98 97
@@ -124,7 +123,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
124 123
125static int 124static int
126spufs_new_file(struct super_block *sb, struct dentry *dentry, 125spufs_new_file(struct super_block *sb, struct dentry *dentry,
127 const struct file_operations *fops, int mode, 126 const struct file_operations *fops, umode_t mode,
128 size_t size, struct spu_context *ctx) 127 size_t size, struct spu_context *ctx)
129{ 128{
130 static const struct inode_operations spufs_file_iops = { 129 static const struct inode_operations spufs_file_iops = {
@@ -194,7 +193,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
194} 193}
195 194
196static int spufs_fill_dir(struct dentry *dir, 195static int spufs_fill_dir(struct dentry *dir,
197 const struct spufs_tree_descr *files, int mode, 196 const struct spufs_tree_descr *files, umode_t mode,
198 struct spu_context *ctx) 197 struct spu_context *ctx)
199{ 198{
200 struct dentry *dentry, *tmp; 199 struct dentry *dentry, *tmp;
@@ -264,7 +263,7 @@ EXPORT_SYMBOL_GPL(spufs_context_fops);
264 263
265static int 264static int
266spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, 265spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
267 int mode) 266 umode_t mode)
268{ 267{
269 int ret; 268 int ret;
270 struct inode *inode; 269 struct inode *inode;
@@ -447,7 +446,7 @@ spufs_set_affinity(unsigned int flags, struct spu_context *ctx,
447 446
448static int 447static int
449spufs_create_context(struct inode *inode, struct dentry *dentry, 448spufs_create_context(struct inode *inode, struct dentry *dentry,
450 struct vfsmount *mnt, int flags, int mode, 449 struct vfsmount *mnt, int flags, umode_t mode,
451 struct file *aff_filp) 450 struct file *aff_filp)
452{ 451{
453 int ret; 452 int ret;
@@ -521,7 +520,7 @@ out:
521} 520}
522 521
523static int 522static int
524spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode) 523spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
525{ 524{
526 int ret; 525 int ret;
527 struct inode *inode; 526 struct inode *inode;
@@ -584,7 +583,7 @@ out:
584 583
585static int spufs_create_gang(struct inode *inode, 584static int spufs_create_gang(struct inode *inode,
586 struct dentry *dentry, 585 struct dentry *dentry,
587 struct vfsmount *mnt, int mode) 586 struct vfsmount *mnt, umode_t mode)
588{ 587{
589 int ret; 588 int ret;
590 589
@@ -612,7 +611,7 @@ out:
612static struct file_system_type spufs_type; 611static struct file_system_type spufs_type;
613 612
614long spufs_create(struct path *path, struct dentry *dentry, 613long spufs_create(struct path *path, struct dentry *dentry,
615 unsigned int flags, mode_t mode, struct file *filp) 614 unsigned int flags, umode_t mode, struct file *filp)
616{ 615{
617 int ret; 616 int ret;
618 617
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 099245f230b2..67852ade4c01 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -237,7 +237,7 @@ struct spufs_inode_info {
237struct spufs_tree_descr { 237struct spufs_tree_descr {
238 const char *name; 238 const char *name;
239 const struct file_operations *ops; 239 const struct file_operations *ops;
240 int mode; 240 umode_t mode;
241 size_t size; 241 size_t size;
242}; 242};
243 243
@@ -249,7 +249,7 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
249extern struct spufs_calls spufs_calls; 249extern struct spufs_calls spufs_calls;
250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags, 251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags,
252 mode_t mode, struct file *filp); 252 umode_t mode, struct file *filp);
253/* ELF coredump callbacks for writing SPU ELF notes */ 253/* ELF coredump callbacks for writing SPU ELF notes */
254extern int spufs_coredump_extra_notes_size(void); 254extern int spufs_coredump_extra_notes_size(void);
255extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset); 255extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset);
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 71a5b5207266..8591bb62d7fc 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -60,7 +60,7 @@ out:
60} 60}
61 61
62static long do_spu_create(const char __user *pathname, unsigned int flags, 62static long do_spu_create(const char __user *pathname, unsigned int flags,
63 mode_t mode, struct file *neighbor) 63 umode_t mode, struct file *neighbor)
64{ 64{
65 struct path path; 65 struct path path;
66 struct dentry *dentry; 66 struct dentry *dentry;
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/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 330a57b7c17c..36f957f31842 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -638,7 +638,6 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
638 /* These are almost always orderly shutdowns. */ 638 /* These are almost always orderly shutdowns. */
639 return; 639 return;
640 case KMSG_DUMP_OOPS: 640 case KMSG_DUMP_OOPS:
641 case KMSG_DUMP_KEXEC:
642 break; 641 break;
643 case KMSG_DUMP_PANIC: 642 case KMSG_DUMP_PANIC:
644 panicking = true; 643 panicking = true;
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/axonram.c b/arch/powerpc/sysdev/axonram.c
index ba4271919062..1c16141c031c 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/bio.h> 26#include <linux/bio.h>
27#include <linux/blkdev.h> 27#include <linux/blkdev.h>
28#include <linux/buffer_head.h>
29#include <linux/device.h> 28#include <linux/device.h>
30#include <linux/errno.h> 29#include <linux/errno.h>
31#include <linux/fs.h> 30#include <linux/fs.h>
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/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c
index e23f23cf9f5c..521e67a49dc4 100644
--- a/arch/powerpc/sysdev/qe_lib/gpio.c
+++ b/arch/powerpc/sysdev/qe_lib/gpio.c
@@ -139,14 +139,10 @@ struct qe_pin {
139struct qe_pin *qe_pin_request(struct device_node *np, int index) 139struct qe_pin *qe_pin_request(struct device_node *np, int index)
140{ 140{
141 struct qe_pin *qe_pin; 141 struct qe_pin *qe_pin;
142 struct device_node *gpio_np;
143 struct gpio_chip *gc; 142 struct gpio_chip *gc;
144 struct of_mm_gpio_chip *mm_gc; 143 struct of_mm_gpio_chip *mm_gc;
145 struct qe_gpio_chip *qe_gc; 144 struct qe_gpio_chip *qe_gc;
146 int err; 145 int err;
147 int size;
148 const void *gpio_spec;
149 const u32 *gpio_cells;
150 unsigned long flags; 146 unsigned long flags;
151 147
152 qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL); 148 qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL);
@@ -155,45 +151,25 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
155 return ERR_PTR(-ENOMEM); 151 return ERR_PTR(-ENOMEM);
156 } 152 }
157 153
158 err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index, 154 err = of_get_gpio(np, index);
159 &gpio_np, &gpio_spec); 155 if (err < 0)
160 if (err) { 156 goto err0;
161 pr_debug("%s: can't parse gpios property\n", __func__); 157 gc = gpio_to_chip(err);
158 if (WARN_ON(!gc))
162 goto err0; 159 goto err0;
163 }
164 160
165 if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) { 161 if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
166 pr_debug("%s: tried to get a non-qe pin\n", __func__); 162 pr_debug("%s: tried to get a non-qe pin\n", __func__);
167 err = -EINVAL; 163 err = -EINVAL;
168 goto err1; 164 goto err0;
169 }
170
171 gc = of_node_to_gpiochip(gpio_np);
172 if (!gc) {
173 pr_debug("%s: gpio controller %s isn't registered\n",
174 np->full_name, gpio_np->full_name);
175 err = -ENODEV;
176 goto err1;
177 }
178
179 gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size);
180 if (!gpio_cells || size != sizeof(*gpio_cells) ||
181 *gpio_cells != gc->of_gpio_n_cells) {
182 pr_debug("%s: wrong #gpio-cells for %s\n",
183 np->full_name, gpio_np->full_name);
184 err = -EINVAL;
185 goto err1;
186 } 165 }
187 166
188 err = gc->of_xlate(gc, np, gpio_spec, NULL);
189 if (err < 0)
190 goto err1;
191
192 mm_gc = to_of_mm_gpio_chip(gc); 167 mm_gc = to_of_mm_gpio_chip(gc);
193 qe_gc = to_qe_gpio_chip(mm_gc); 168 qe_gc = to_qe_gpio_chip(mm_gc);
194 169
195 spin_lock_irqsave(&qe_gc->lock, flags); 170 spin_lock_irqsave(&qe_gc->lock, flags);
196 171
172 err -= gc->base;
197 if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) { 173 if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) {
198 qe_pin->controller = qe_gc; 174 qe_pin->controller = qe_gc;
199 qe_pin->num = err; 175 qe_pin->num = err;
@@ -206,8 +182,6 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
206 182
207 if (!err) 183 if (!err)
208 return qe_pin; 184 return qe_pin;
209err1:
210 of_node_put(gpio_np);
211err0: 185err0:
212 kfree(qe_pin); 186 kfree(qe_pin);
213 pr_debug("%s failed with status %d\n", __func__, err); 187 pr_debug("%s failed with status %d\n", __func__, err);
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>