Commit 8a25a2fd authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem

This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem
and converts the devices to regular devices. The sysdev drivers are
implemented as subsystem interfaces now.

After all sysdev classes are ported to regular driver core entities, the
sysdev implementation will be entirely removed from the kernel.

Userspace relies on events and generic sysfs subsystem infrastructure
from sysdev devices, which are made available with this conversion.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Borislav Petkov <bp@amd64.org>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Len Brown <lenb@kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cb0c05c5
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -26,16 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); ...@@ -26,16 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
* XXX: If/when a SMP-capable implementation of AVR32 will ever be * XXX: If/when a SMP-capable implementation of AVR32 will ever be
* made, we must make sure that the code executes on the correct CPU. * made, we must make sure that the code executes on the correct CPU.
*/ */
static ssize_t show_pc0event(struct sys_device *dev, static ssize_t show_pc0event(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pccr; unsigned long pccr;
pccr = sysreg_read(PCCR); pccr = sysreg_read(PCCR);
return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f);
} }
static ssize_t store_pc0event(struct sys_device *dev, static ssize_t store_pc0event(struct device *dev,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -48,16 +48,16 @@ static ssize_t store_pc0event(struct sys_device *dev, ...@@ -48,16 +48,16 @@ static ssize_t store_pc0event(struct sys_device *dev,
sysreg_write(PCCR, val); sysreg_write(PCCR, val);
return count; return count;
} }
static ssize_t show_pc0count(struct sys_device *dev, static ssize_t show_pc0count(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pcnt0; unsigned long pcnt0;
pcnt0 = sysreg_read(PCNT0); pcnt0 = sysreg_read(PCNT0);
return sprintf(buf, "%lu\n", pcnt0); return sprintf(buf, "%lu\n", pcnt0);
} }
static ssize_t store_pc0count(struct sys_device *dev, static ssize_t store_pc0count(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -71,16 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev, ...@@ -71,16 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev,
return count; return count;
} }
static ssize_t show_pc1event(struct sys_device *dev, static ssize_t show_pc1event(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pccr; unsigned long pccr;
pccr = sysreg_read(PCCR); pccr = sysreg_read(PCCR);
return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f);
} }
static ssize_t store_pc1event(struct sys_device *dev, static ssize_t store_pc1event(struct device *dev,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -93,16 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev, ...@@ -93,16 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev,
sysreg_write(PCCR, val); sysreg_write(PCCR, val);
return count; return count;
} }
static ssize_t show_pc1count(struct sys_device *dev, static ssize_t show_pc1count(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pcnt1; unsigned long pcnt1;
pcnt1 = sysreg_read(PCNT1); pcnt1 = sysreg_read(PCNT1);
return sprintf(buf, "%lu\n", pcnt1); return sprintf(buf, "%lu\n", pcnt1);
} }
static ssize_t store_pc1count(struct sys_device *dev, static ssize_t store_pc1count(struct device *dev,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -116,16 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev, ...@@ -116,16 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev,
return count; return count;
} }
static ssize_t show_pccycles(struct sys_device *dev, static ssize_t show_pccycles(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pccnt; unsigned long pccnt;
pccnt = sysreg_read(PCCNT); pccnt = sysreg_read(PCCNT);
return sprintf(buf, "%lu\n", pccnt); return sprintf(buf, "%lu\n", pccnt);
} }
static ssize_t store_pccycles(struct sys_device *dev, static ssize_t store_pccycles(struct device *dev,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -139,16 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev, ...@@ -139,16 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev,
return count; return count;
} }
static ssize_t show_pcenable(struct sys_device *dev, static ssize_t show_pcenable(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long pccr; unsigned long pccr;
pccr = sysreg_read(PCCR); pccr = sysreg_read(PCCR);
return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); return sprintf(buf, "%c\n", (pccr & 1)?'1':'0');
} }
static ssize_t store_pcenable(struct sys_device *dev, static ssize_t store_pcenable(struct device *dev,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long pccr, val; unsigned long pccr, val;
...@@ -167,12 +167,12 @@ static ssize_t store_pcenable(struct sys_device *dev, ...@@ -167,12 +167,12 @@ static ssize_t store_pcenable(struct sys_device *dev,
return count; return count;
} }
static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event); static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event);
static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count); static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count);
static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event); static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event);
static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count); static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count);
static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles); static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles);
static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable); static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable);
#endif /* CONFIG_PERFORMANCE_COUNTERS */ #endif /* CONFIG_PERFORMANCE_COUNTERS */
...@@ -186,12 +186,12 @@ static int __init topology_init(void) ...@@ -186,12 +186,12 @@ static int __init topology_init(void)
register_cpu(c, cpu); register_cpu(c, cpu);
#ifdef CONFIG_PERFORMANCE_COUNTERS #ifdef CONFIG_PERFORMANCE_COUNTERS
sysdev_create_file(&c->sysdev, &attr_pc0event); device_create_file(&c->dev, &dev_attr_pc0event);
sysdev_create_file(&c->sysdev, &attr_pc0count); device_create_file(&c->dev, &dev_attr_pc0count);
sysdev_create_file(&c->sysdev, &attr_pc1event); device_create_file(&c->dev, &dev_attr_pc1event);
sysdev_create_file(&c->sysdev, &attr_pc1count); device_create_file(&c->dev, &dev_attr_pc1count);
sysdev_create_file(&c->sysdev, &attr_pccycles); device_create_file(&c->dev, &dev_attr_pccycles);
sysdev_create_file(&c->sysdev, &attr_pcenable); device_create_file(&c->dev, &dev_attr_pcenable);
#endif #endif
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Copyright (C) 2006, Intel Corp. All rights reserved. * Copyright (C) 2006, Intel Corp. All rights reserved.
* *
*/ */
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/cpu.h> #include <linux/cpu.h>
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte;
#define define_one_ro(name) \ #define define_one_ro(name) \
static SYSDEV_ATTR(name, 0444, show_##name, NULL) static DEVICE_ATTR(name, 0444, show_##name, NULL)
#define define_one_rw(name) \ #define define_one_rw(name) \
static SYSDEV_ATTR(name, 0644, show_##name, store_##name) static DEVICE_ATTR(name, 0644, show_##name, store_##name)
static u64 call_start[NR_CPUS]; static u64 call_start[NR_CPUS];
static u64 phys_addr[NR_CPUS]; static u64 phys_addr[NR_CPUS];
...@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS]; ...@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS];
#define show(name) \ #define show(name) \
static ssize_t \ static ssize_t \
show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ show_##name(struct device *dev, struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
u32 cpu=dev->id; \ u32 cpu=dev->id; \
...@@ -64,7 +64,7 @@ show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ ...@@ -64,7 +64,7 @@ show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \
#define store(name) \ #define store(name) \
static ssize_t \ static ssize_t \
store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ store_##name(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t size) \ const char *buf, size_t size) \
{ \ { \
unsigned int cpu=dev->id; \ unsigned int cpu=dev->id; \
...@@ -78,7 +78,7 @@ show(call_start) ...@@ -78,7 +78,7 @@ show(call_start)
* processor. The cpu number in driver is only used for storing data. * processor. The cpu number in driver is only used for storing data.
*/ */
static ssize_t static ssize_t
store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, store_call_start(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned int cpu=dev->id; unsigned int cpu=dev->id;
...@@ -127,7 +127,7 @@ show(err_type_info) ...@@ -127,7 +127,7 @@ show(err_type_info)
store(err_type_info) store(err_type_info)
static ssize_t static ssize_t
show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
unsigned int cpu=dev->id; unsigned int cpu=dev->id;
...@@ -135,7 +135,7 @@ show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, ...@@ -135,7 +135,7 @@ show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr,
} }
static ssize_t static ssize_t
store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned int cpu=dev->id; unsigned int cpu=dev->id;
...@@ -159,8 +159,8 @@ show(err_struct_info) ...@@ -159,8 +159,8 @@ show(err_struct_info)
store(err_struct_info) store(err_struct_info)
static ssize_t static ssize_t
show_err_data_buffer(struct sys_device *dev, show_err_data_buffer(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned int cpu=dev->id; unsigned int cpu=dev->id;
...@@ -171,8 +171,8 @@ show_err_data_buffer(struct sys_device *dev, ...@@ -171,8 +171,8 @@ show_err_data_buffer(struct sys_device *dev,
} }
static ssize_t static ssize_t
store_err_data_buffer(struct sys_device *dev, store_err_data_buffer(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned int cpu=dev->id; unsigned int cpu=dev->id;
...@@ -209,14 +209,14 @@ define_one_ro(capabilities); ...@@ -209,14 +209,14 @@ define_one_ro(capabilities);
define_one_ro(resources); define_one_ro(resources);
static struct attribute *default_attrs[] = { static struct attribute *default_attrs[] = {
&attr_call_start.attr, &dev_attr_call_start.attr,
&attr_virtual_to_phys.attr, &dev_attr_virtual_to_phys.attr,
&attr_err_type_info.attr, &dev_attr_err_type_info.attr,
&attr_err_struct_info.attr, &dev_attr_err_struct_info.attr,
&attr_err_data_buffer.attr, &dev_attr_err_data_buffer.attr,
&attr_status.attr, &dev_attr_status.attr,
&attr_capabilities.attr, &dev_attr_capabilities.attr,
&attr_resources.attr, &dev_attr_resources.attr,
NULL NULL
}; };
...@@ -225,12 +225,12 @@ static struct attribute_group err_inject_attr_group = { ...@@ -225,12 +225,12 @@ static struct attribute_group err_inject_attr_group = {
.name = "err_inject" .name = "err_inject"
}; };
/* Add/Remove err_inject interface for CPU device */ /* Add/Remove err_inject interface for CPU device */
static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) static int __cpuinit err_inject_add_dev(struct device * sys_dev)
{ {
return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
} }
static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) static int __cpuinit err_inject_remove_dev(struct device * sys_dev)
{ {
sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
return 0; return 0;
...@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb, ...@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *sys_dev;
sys_dev = get_cpu_sysdev(cpu); sys_dev = get_cpu_device(cpu);
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
...@@ -283,13 +283,13 @@ static void __exit ...@@ -283,13 +283,13 @@ static void __exit
err_inject_exit(void) err_inject_exit(void)
{ {
int i; int i;
struct sys_device *sys_dev; struct device *sys_dev;
#ifdef ERR_INJ_DEBUG #ifdef ERR_INJ_DEBUG
printk(KERN_INFO "Exit error injection driver.\n"); printk(KERN_INFO "Exit error injection driver.\n");
#endif #endif
for_each_online_cpu(i) { for_each_online_cpu(i) {
sys_dev = get_cpu_sysdev(i); sys_dev = get_cpu_device(i);
sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
} }
unregister_hotcpu_notifier(&err_inject_cpu_notifier); unregister_hotcpu_notifier(&err_inject_cpu_notifier);
......
...@@ -350,7 +350,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu) ...@@ -350,7 +350,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)
} }
/* Add cache interface for CPU device */ /* Add cache interface for CPU device */
static int __cpuinit cache_add_dev(struct sys_device * sys_dev) static int __cpuinit cache_add_dev(struct device * sys_dev)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = sys_dev->id;
unsigned long i, j; unsigned long i, j;
...@@ -400,7 +400,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -400,7 +400,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
} }
/* Remove cache interface for CPU device */ /* Remove cache interface for CPU device */
static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) static int __cpuinit cache_remove_dev(struct device * sys_dev)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = sys_dev->id;
unsigned long i; unsigned long i;
...@@ -428,9 +428,9 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb, ...@@ -428,9 +428,9 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *sys_dev;
sys_dev = get_cpu_sysdev(cpu); sys_dev = get_cpu_device(cpu);
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
...@@ -454,7 +454,7 @@ static int __init cache_sysfs_init(void) ...@@ -454,7 +454,7 @@ static int __init cache_sysfs_init(void)
int i; int i;
for_each_online_cpu(i) { for_each_online_cpu(i) {
struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); struct device *sys_dev = get_cpu_device((unsigned int)i);
cache_add_dev(sys_dev); cache_add_dev(sys_dev);
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#define LS_SIZE (256 * 1024) #define LS_SIZE (256 * 1024)
...@@ -166,7 +166,7 @@ struct spu { ...@@ -166,7 +166,7 @@ struct spu {
/* beat only */ /* beat only */
u64 shadow_int_mask_RW[3]; u64 shadow_int_mask_RW[3];
struct sys_device sysdev; struct device dev;
int has_mem_affinity; int has_mem_affinity;
struct list_head aff_list; struct list_head aff_list;
...@@ -270,11 +270,11 @@ struct spufs_calls { ...@@ -270,11 +270,11 @@ struct spufs_calls {
int register_spu_syscalls(struct spufs_calls *calls); int register_spu_syscalls(struct spufs_calls *calls);
void unregister_spu_syscalls(struct spufs_calls *calls); void unregister_spu_syscalls(struct spufs_calls *calls);
int spu_add_sysdev_attr(struct sysdev_attribute *attr); int spu_add_dev_attr(struct device_attribute *attr);
void spu_remove_sysdev_attr(struct sysdev_attribute *attr); void spu_remove_dev_attr(struct device_attribute *attr);
int spu_add_sysdev_attr_group(struct attribute_group *attrs); int spu_add_dev_attr_group(struct attribute_group *attrs);
void spu_remove_sysdev_attr_group(struct attribute_group *attrs); void spu_remove_dev_attr_group(struct attribute_group *attrs);
int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
unsigned long dsisr, unsigned *flt); unsigned long dsisr, unsigned *flt);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
struct sys_device; struct device;
struct device_node; struct device_node;
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
...@@ -86,19 +86,19 @@ extern int __node_distance(int, int); ...@@ -86,19 +86,19 @@ extern int __node_distance(int, int);
extern void __init dump_numa_cpu_topology(void); extern void __init dump_numa_cpu_topology(void);
extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); extern int sysfs_add_device_to_node(struct device *dev, int nid);
extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); extern void sysfs_remove_device_from_node(struct device *dev, int nid);
#else #else
static inline void dump_numa_cpu_topology(void) {} static inline void dump_numa_cpu_topology(void) {}
static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) static inline int sysfs_add_device_to_node(struct device *dev, int nid)
{ {
return 0; return 0;
} }
static inline void sysfs_remove_device_from_node(struct sys_device *dev, static inline void sysfs_remove_device_from_node(struct device *dev,
int nid) int nid)
{ {
} }
......
...@@ -451,15 +451,15 @@ static struct cache *__cpuinit cache_chain_instantiate(unsigned int cpu_id) ...@@ -451,15 +451,15 @@ static struct cache *__cpuinit cache_chain_instantiate(unsigned int cpu_id)
static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id)
{ {
struct cache_dir *cache_dir; struct cache_dir *cache_dir;
struct sys_device *sysdev; struct device *dev;
struct kobject *kobj = NULL; struct kobject *kobj = NULL;
sysdev = get_cpu_sysdev(cpu_id); dev = get_cpu_device(cpu_id);
WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id);
if (!sysdev) if (!dev)
goto err; goto err;
kobj = kobject_create_and_add("cache", &sysdev->kobj); kobj = kobject_create_and_add("cache", &dev->kobj);
if (!kobj) if (!kobj)
goto err; goto err;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/topology.h> #include <linux/topology.h>
......
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/percpu.h> #include <linux/percpu.h>
...@@ -37,12 +37,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); ...@@ -37,12 +37,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
/* Time in microseconds we delay before sleeping in the idle loop */ /* Time in microseconds we delay before sleeping in the idle loop */
DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
static ssize_t store_smt_snooze_delay(struct sys_device *dev, static ssize_t store_smt_snooze_delay(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
ssize_t ret; ssize_t ret;
long snooze; long snooze;
...@@ -50,21 +50,21 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev, ...@@ -50,21 +50,21 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev,
if (ret != 1) if (ret != 1)
return -EINVAL; return -EINVAL;
per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
return count; return count;
} }
static ssize_t show_smt_snooze_delay(struct sys_device *dev, static ssize_t show_smt_snooze_delay(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
} }
static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
store_smt_snooze_delay); store_smt_snooze_delay);
static int __init setup_smt_snooze_delay(char *str) static int __init setup_smt_snooze_delay(char *str)
...@@ -117,25 +117,25 @@ static void write_##NAME(void *val) \ ...@@ -117,25 +117,25 @@ static void write_##NAME(void *val) \
ppc_enable_pmcs(); \ ppc_enable_pmcs(); \
mtspr(ADDRESS, *(unsigned long *)val); \ mtspr(ADDRESS, *(unsigned long *)val); \
} \ } \
static ssize_t show_##NAME(struct sys_device *dev, \ static ssize_t show_##NAME(struct device *dev, \
struct sysdev_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ struct cpu *cpu = container_of(dev, struct cpu, dev); \
unsigned long val; \ unsigned long val; \
smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \
return sprintf(buf, "%lx\n", val); \ return sprintf(buf, "%lx\n", val); \
} \ } \
static ssize_t __used \ static ssize_t __used \
store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ store_##NAME(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \ const char *buf, size_t count) \
{ \ { \
struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ struct cpu *cpu = container_of(dev, struct cpu, dev); \
unsigned long val; \ unsigned long val; \
int ret = sscanf(buf, "%lx", &val); \ int ret = sscanf(buf, "%lx", &val); \
if (ret != 1) \ if (ret != 1) \
return -EINVAL; \ return -EINVAL; \
smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
return count; \ return count; \
} }
...@@ -178,22 +178,22 @@ SYSFS_PMCSETUP(purr, SPRN_PURR); ...@@ -178,22 +178,22 @@ SYSFS_PMCSETUP(purr, SPRN_PURR);
SYSFS_PMCSETUP(spurr, SPRN_SPURR); SYSFS_PMCSETUP(spurr, SPRN_SPURR);
SYSFS_PMCSETUP(dscr, SPRN_DSCR); SYSFS_PMCSETUP(dscr, SPRN_DSCR);
static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); static DEVICE_ATTR(spurr, 0600, show_spurr, NULL);
static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); static DEVICE_ATTR(purr, 0600, show_purr, store_purr);
unsigned long dscr_default = 0; unsigned long dscr_default = 0;
EXPORT_SYMBOL(dscr_default); EXPORT_SYMBOL(dscr_default);
static ssize_t show_dscr_default(struct sysdev_class *class, static ssize_t show_dscr_default(struct device *dev,
struct sysdev_class_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "%lx\n", dscr_default); return sprintf(buf, "%lx\n", dscr_default);
} }
static ssize_t __used store_dscr_default(struct sysdev_class *class, static ssize_t __used store_dscr_default(struct device *dev,
struct sysdev_class_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -207,15 +207,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class, ...@@ -207,15 +207,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class,
return count; return count;
} }
static SYSDEV_CLASS_ATTR(dscr_default, 0600, static DEVICE_ATTR(dscr_default, 0600,
show_dscr_default, store_dscr_default); show_dscr_default, store_dscr_default);
static void sysfs_create_dscr_default(void) static void sysfs_create_dscr_default(void)
{ {
int err = 0; int err = 0;
if (cpu_has_feature(CPU_FTR_DSCR)) if (cpu_has_feature(CPU_FTR_DSCR))
err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
&attr_dscr_default.attr);
} }
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
...@@ -259,72 +258,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); ...@@ -259,72 +258,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
#endif /* HAS_PPC_PMC_PA6T */ #endif /* HAS_PPC_PMC_PA6T */
#ifdef HAS_PPC_PMC_IBM #ifdef HAS_PPC_PMC_IBM
static struct sysdev_attribute ibm_common_attrs[] = { static struct device_attribute ibm_common_attrs[] = {
_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
}; };
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
#ifdef HAS_PPC_PMC_G4 #ifdef HAS_PPC_PMC_G4
static struct sysdev_attribute g4_common_attrs[] = { static struct device_attribute g4_common_attrs[] = {
_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
_SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
}; };
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
static struct sysdev_attribute classic_pmc_attrs[] = { static struct device_attribute classic_pmc_attrs[] = {
_SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), __ATTR(pmc1, 0600, show_pmc1, store_pmc1),
_SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), __ATTR(pmc2, 0600, show_pmc2, store_pmc2),
_SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), __ATTR(pmc3, 0600, show_pmc3, store_pmc3),
_SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), __ATTR(pmc4, 0600, show_pmc4, store_pmc4),
_SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), __ATTR(pmc5, 0600, show_pmc5, store_pmc5),
_SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), __ATTR(pmc6, 0600, show_pmc6, store_pmc6),
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
_SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), __ATTR(pmc7, 0600, show_pmc7, store_pmc7),
_SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), __ATTR(pmc8, 0600, show_pmc8, store_pmc8),
#endif #endif
}; };
#ifdef HAS_PPC_PMC_PA6T #ifdef HAS_PPC_PMC_PA6T
static struct sysdev_attribute pa6t_attrs[] = { static struct device_attribute pa6t_attrs[] = {
_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
_SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0),
_SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1),
_SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2),
_SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
_SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
_SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
#ifdef CONFIG_DEBUG_KERNEL #ifdef CONFIG_DEBUG_KERNEL
_SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), __ATTR(hid0, 0600, show_hid0, store_hid0),
_SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), __ATTR(hid1, 0600, show_hid1, store_hid1),
_SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), __ATTR(hid4, 0600, show_hid4, store_hid4),
_SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), __ATTR(hid5, 0600, show_hid5, store_hid5),
_SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), __ATTR(ima0, 0600, show_ima0, store_ima0),
_SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), __ATTR(ima1, 0600, show_ima1, store_ima1),
_SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), __ATTR(ima2, 0600, show_ima2, store_ima2),
_SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), __ATTR(ima3, 0600, show_ima3, store_ima3),
_SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), __ATTR(ima4, 0600, show_ima4, store_ima4),
_SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), __ATTR(ima5, 0600, show_ima5, store_ima5),
_SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), __ATTR(ima6, 0600, show_ima6, store_ima6),
_SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), __ATTR(ima7, 0600, show_ima7, store_ima7),
_SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), __ATTR(ima8, 0600, show_ima8, store_ima8),
_SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), __ATTR(ima9, 0600, show_ima9, store_ima9),
_SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), __ATTR(imaat, 0600, show_imaat, store_imaat),
_SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), __ATTR(btcr, 0600, show_btcr, store_btcr),
_SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), __ATTR(pccr, 0600, show_pccr, store_pccr),
_SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), __ATTR(rpccr, 0600, show_rpccr, store_rpccr),
_SYSDEV_ATTR(der, 0600, show_der, store_der), __ATTR(der, 0600, show_der, store_der),
_SYSDEV_ATTR(mer, 0600, show_mer, store_mer), __ATTR(mer, 0600, show_mer, store_mer),
_SYSDEV_ATTR(ber, 0600, show_ber, store_ber), __ATTR(ber, 0600, show_ber, store_ber),
_SYSDEV_ATTR(ier, 0600, show_ier, store_ier), __ATTR(ier, 0600, show_ier, store_ier),
_SYSDEV_ATTR(sier, 0600, show_sier, store_sier), __ATTR(sier, 0600, show_sier, store_sier),
_SYSDEV_ATTR(siar, 0600, show_siar, store_siar), __ATTR(siar, 0600, show_siar, store_siar),
_SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), __ATTR(tsr0, 0600, show_tsr0, store_tsr0),
_SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), __ATTR(tsr1, 0600, show_tsr1, store_tsr1),
_SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), __ATTR(tsr2, 0600, show_tsr2, store_tsr2),
_SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), __ATTR(tsr3, 0600, show_tsr3, store_tsr3),
#endif /* CONFIG_DEBUG_KERNEL */ #endif /* CONFIG_DEBUG_KERNEL */
}; };
#endif /* HAS_PPC_PMC_PA6T */ #endif /* HAS_PPC_PMC_PA6T */
...@@ -333,14 +332,14 @@ static struct sysdev_attribute pa6t_attrs[] = { ...@@ -333,14 +332,14 @@ static struct sysdev_attribute pa6t_attrs[] = {
static void __cpuinit register_cpu_online(unsigned int cpu) static void __cpuinit register_cpu_online(unsigned int cpu)
{ {
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
struct sysdev_attribute *attrs, *pmc_attrs; struct device_attribute *attrs, *pmc_attrs;
int i, nattrs; int i, nattrs;
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (!firmware_has_feature(FW_FEATURE_ISERIES) && if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
cpu_has_feature(CPU_FTR_SMT)) cpu_has_feature(CPU_FTR_SMT))
sysdev_create_file(s, &attr_smt_snooze_delay); device_create_file(s, &dev_attr_smt_snooze_delay);
#endif #endif
/* PMC stuff */ /* PMC stuff */
...@@ -348,14 +347,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu) ...@@ -348,14 +347,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
#ifdef HAS_PPC_PMC_IBM #ifdef HAS_PPC_PMC_IBM
case PPC_PMC_IBM: case PPC_PMC_IBM:
attrs = ibm_common_attrs; attrs = ibm_common_attrs;
nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_IBM */ #endif /* HAS_PPC_PMC_IBM */
#ifdef HAS_PPC_PMC_G4 #ifdef HAS_PPC_PMC_G4
case PPC_PMC_G4: case PPC_PMC_G4:
attrs = g4_common_attrs; attrs = g4_common_attrs;
nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
...@@ -363,7 +362,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu) ...@@ -363,7 +362,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
case PPC_PMC_PA6T: case PPC_PMC_PA6T:
/* PA Semi starts counting at PMC0 */ /* PA Semi starts counting at PMC0 */
attrs = pa6t_attrs; attrs = pa6t_attrs;
nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
pmc_attrs = NULL; pmc_attrs = NULL;
break; break;
#endif /* HAS_PPC_PMC_PA6T */ #endif /* HAS_PPC_PMC_PA6T */
...@@ -374,24 +373,24 @@ static void __cpuinit register_cpu_online(unsigned int cpu) ...@@ -374,24 +373,24 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
} }
for (i = 0; i < nattrs; i++) for (i = 0; i < nattrs; i++)
sysdev_create_file(s, &attrs[i]); device_create_file(s, &attrs[i]);
if (pmc_attrs) if (pmc_attrs)
for (i = 0; i < cur_cpu_spec->num_pmcs; i++) for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
sysdev_create_file(s, &pmc_attrs[i]); device_create_file(s, &pmc_attrs[i]);
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (cpu_has_feature(CPU_FTR_MMCRA)) if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_create_file(s, &attr_mmcra); device_create_file(s, &dev_attr_mmcra);
if (cpu_has_feature(CPU_FTR_PURR)) if (cpu_has_feature(CPU_FTR_PURR))
sysdev_create_file(s, &attr_purr); device_create_file(s, &dev_attr_purr);
if (cpu_has_feature(CPU_FTR_SPURR)) if (cpu_has_feature(CPU_FTR_SPURR))
sysdev_create_file(s, &attr_spurr); device_create_file(s, &dev_attr_spurr);
if (cpu_has_feature(CPU_FTR_DSCR)) if (cpu_has_feature(CPU_FTR_DSCR))
sysdev_create_file(s, &attr_dscr); device_create_file(s, &dev_attr_dscr);
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
cacheinfo_cpu_online(cpu); cacheinfo_cpu_online(cpu);
...@@ -401,8 +400,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu) ...@@ -401,8 +400,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
static void unregister_cpu_online(unsigned int cpu) static void unregister_cpu_online(unsigned int cpu)
{ {
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
struct sysdev_attribute *attrs, *pmc_attrs; struct device_attribute *attrs, *pmc_attrs;
int i, nattrs; int i, nattrs;
BUG_ON(!c->hotpluggable); BUG_ON(!c->hotpluggable);
...@@ -410,7 +409,7 @@ static void unregister_cpu_online(unsigned int cpu) ...@@ -410,7 +409,7 @@ static void unregister_cpu_online(unsigned int cpu)
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (!firmware_has_feature(FW_FEATURE_ISERIES) && if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
cpu_has_feature(CPU_FTR_SMT)) cpu_has_feature(CPU_FTR_SMT))
sysdev_remove_file(s, &attr_smt_snooze_delay); device_remove_file(s, &dev_attr_smt_snooze_delay);
#endif #endif
/* PMC stuff */ /* PMC stuff */
...@@ -418,14 +417,14 @@ static void unregister_cpu_online(unsigned int cpu) ...@@ -418,14 +417,14 @@ static void unregister_cpu_online(unsigned int cpu)
#ifdef HAS_PPC_PMC_IBM #ifdef HAS_PPC_PMC_IBM
case PPC_PMC_IBM: case PPC_PMC_IBM:
attrs = ibm_common_attrs; attrs = ibm_common_attrs;
nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_IBM */ #endif /* HAS_PPC_PMC_IBM */
#ifdef HAS_PPC_PMC_G4 #ifdef HAS_PPC_PMC_G4
case PPC_PMC_G4: case PPC_PMC_G4:
attrs = g4_common_attrs; attrs = g4_common_attrs;
nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
...@@ -433,7 +432,7 @@ static void unregister_cpu_online(unsigned int cpu) ...@@ -433,7 +432,7 @@ static void unregister_cpu_online(unsigned int cpu)
case PPC_PMC_PA6T: case PPC_PMC_PA6T:
/* PA Semi starts counting at PMC0 */ /* PA Semi starts counting at PMC0 */
attrs = pa6t_attrs; attrs = pa6t_attrs;
nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
pmc_attrs = NULL; pmc_attrs = NULL;
break; break;
#endif /* HAS_PPC_PMC_PA6T */ #endif /* HAS_PPC_PMC_PA6T */
...@@ -444,24 +443,24 @@ static void unregister_cpu_online(unsigned int cpu) ...@@ -444,24 +443,24 @@ static void unregister_cpu_online(unsigned int cpu)
} }
for (i = 0; i < nattrs; i++) for (i = 0; i < nattrs; i++)
sysdev_remove_file(s, &attrs[i]); device_remove_file(s, &attrs[i]);
if (pmc_attrs) if (pmc_attrs)
for (i = 0; i < cur_cpu_spec->num_pmcs; i++) for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
sysdev_remove_file(s, &pmc_attrs[i]); device_remove_file(s, &pmc_attrs[i]);
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (cpu_has_feature(CPU_FTR_MMCRA)) if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_remove_file(s, &attr_mmcra); device_remove_file(s, &dev_attr_mmcra);
if (cpu_has_feature(CPU_FTR_PURR)) if (cpu_has_feature(CPU_FTR_PURR))
sysdev_remove_file(s, &attr_purr); device_remove_file(s, &dev_attr_purr);
if (cpu_has_feature(CPU_FTR_SPURR)) if (cpu_has_feature(CPU_FTR_SPURR))
sysdev_remove_file(s, &attr_spurr); device_remove_file(s, &dev_attr_spurr);
if (cpu_has_feature(CPU_FTR_DSCR)) if (cpu_has_feature(CPU_FTR_DSCR))
sysdev_remove_file(s, &attr_dscr); device_remove_file(s, &dev_attr_dscr);
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
cacheinfo_cpu_offline(cpu); cacheinfo_cpu_offline(cpu);
...@@ -513,70 +512,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = { ...@@ -513,70 +512,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
static DEFINE_MUTEX(cpu_mutex); static DEFINE_MUTEX(cpu_mutex);
int cpu_add_sysdev_attr(struct sysdev_attribute *attr) int cpu_add_dev_attr(struct device_attribute *attr)
{ {
int cpu; int cpu;
mutex_lock(&cpu_mutex); mutex_lock(&cpu_mutex);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
sysdev_create_file(get_cpu_sysdev(cpu), attr); device_create_file(get_cpu_device(cpu), attr);
} }
mutex_unlock(&cpu_mutex); mutex_unlock(&cpu_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); EXPORT_SYMBOL_GPL(cpu_add_dev_attr);
int cpu_add_sysdev_attr_group(struct attribute_group *attrs) int cpu_add_dev_attr_group(struct attribute_group *attrs)
{ {
int cpu; int cpu;
struct sys_device *sysdev; struct device *dev;
int ret; int ret;
mutex_lock(&cpu_mutex); mutex_lock(&cpu_mutex);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
ret = sysfs_create_group(&sysdev->kobj, attrs); ret = sysfs_create_group(&dev->kobj, attrs);
WARN_ON(ret != 0); WARN_ON(ret != 0);
} }
mutex_unlock(&cpu_mutex); mutex_unlock(&cpu_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group);
void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) void cpu_remove_dev_attr(struct device_attribute *attr)
{ {
int cpu; int cpu;
mutex_lock(&cpu_mutex); mutex_lock(&cpu_mutex);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
sysdev_remove_file(get_cpu_sysdev(cpu), attr); device_remove_file(get_cpu_device(cpu), attr);
} }
mutex_unlock(&cpu_mutex); mutex_unlock(&cpu_mutex);
} }
EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); EXPORT_SYMBOL_GPL(cpu_remove_dev_attr);
void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) void cpu_remove_dev_attr_group(struct attribute_group *attrs)
{ {
int cpu; int cpu;
struct sys_device *sysdev; struct device *dev;
mutex_lock(&cpu_mutex); mutex_lock(&cpu_mutex);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
sysfs_remove_group(&sysdev->kobj, attrs); sysfs_remove_group(&dev->kobj, attrs);
} }
mutex_unlock(&cpu_mutex); mutex_unlock(&cpu_mutex);
} }
EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group);
/* NUMA stuff */ /* NUMA stuff */
...@@ -590,7 +589,7 @@ static void register_nodes(void) ...@@ -590,7 +589,7 @@ static void register_nodes(void)
register_one_node(i); register_one_node(i);
} }
int sysfs_add_device_to_node(struct sys_device *dev, int nid) int sysfs_add_device_to_node(struct device *dev, int nid)
{ {
struct node *node = &node_devices[nid]; struct node *node = &node_devices[nid];
return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, return sysfs_create_link(&node->sysdev.kobj, &dev->kobj,
...@@ -598,7 +597,7 @@ int sysfs_add_device_to_node(struct sys_device *dev, int nid) ...@@ -598,7 +597,7 @@ int sysfs_add_device_to_node(struct sys_device *dev, int nid)
} }
EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
void sysfs_remove_device_from_node(struct sys_device *dev, int nid) void sysfs_remove_device_from_node(struct device *dev, int nid)
{ {
struct node *node = &node_devices[nid]; struct node *node = &node_devices[nid];
sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj));
...@@ -614,14 +613,14 @@ static void register_nodes(void) ...@@ -614,14 +613,14 @@ static void register_nodes(void)
#endif #endif
/* Only valid if CPU is present. */ /* Only valid if CPU is present. */
static ssize_t show_physical_id(struct sys_device *dev, static ssize_t show_physical_id(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id));
} }
static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL);
static int __init topology_init(void) static int __init topology_init(void)
{ {
...@@ -646,7 +645,7 @@ static int __init topology_init(void) ...@@ -646,7 +645,7 @@ static int __init topology_init(void)
if (cpu_online(cpu) || c->hotpluggable) { if (cpu_online(cpu) || c->hotpluggable) {
register_cpu(c, cpu); register_cpu(c, cpu);
sysdev_create_file(&c->sysdev, &attr_physical_id); device_create_file(&c->dev, &dev_attr_physical_id);
} }
if (cpu_online(cpu)) if (cpu_online(cpu))
......
...@@ -1452,7 +1452,7 @@ int arch_update_cpu_topology(void) ...@@ -1452,7 +1452,7 @@ int arch_update_cpu_topology(void)
{ {
int cpu, nid, old_nid; int cpu, nid, old_nid;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
struct sys_device *sysdev; struct device *dev;
for_each_cpu(cpu,&cpu_associativity_changes_mask) { for_each_cpu(cpu,&cpu_associativity_changes_mask) {
vphn_get_associativity(cpu, associativity); vphn_get_associativity(cpu, associativity);
...@@ -1473,9 +1473,9 @@ int arch_update_cpu_topology(void) ...@@ -1473,9 +1473,9 @@ int arch_update_cpu_topology(void)
register_cpu_under_node(cpu, nid); register_cpu_under_node(cpu, nid);
put_online_cpus(); put_online_cpus();
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
if (sysdev) if (dev)
kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); kobject_uevent(&dev->kobj, KOBJ_CHANGE);
} }
return 1; return 1;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <asm/spu.h> #include <asm/spu.h>
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
#define TEMP_MIN 65 #define TEMP_MIN 65
#define TEMP_MAX 125 #define TEMP_MAX 125
#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ #define DEVICE_PREFIX_ATTR(_prefix,_name,_mode) \
struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ struct device_attribute attr_ ## _prefix ## _ ## _name = { \
.attr = { .name = __stringify(_name), .mode = _mode }, \ .attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _prefix ## _show_ ## _name, \ .show = _prefix ## _show_ ## _name, \
.store = _prefix ## _store_ ## _name, \ .store = _prefix ## _store_ ## _name, \
...@@ -76,36 +76,36 @@ static inline u8 temp_to_reg(u8 temp) ...@@ -76,36 +76,36 @@ static inline u8 temp_to_reg(u8 temp)
return ((temp - TEMP_MIN) >> 1) & 0x3f; return ((temp - TEMP_MIN) >> 1) & 0x3f;
} }
static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) static struct cbe_pmd_regs __iomem *get_pmd_regs(struct device *dev)
{ {
struct spu *spu; struct spu *spu;
spu = container_of(sysdev, struct spu, sysdev); spu = container_of(dev, struct spu, dev);
return cbe_get_pmd_regs(spu_devnode(spu)); return cbe_get_pmd_regs(spu_devnode(spu));
} }
/* returns the value for a given spu in a given register */ /* returns the value for a given spu in a given register */
static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) static u8 spu_read_register_value(struct device *dev, union spe_reg __iomem *reg)
{ {
union spe_reg value; union spe_reg value;
struct spu *spu; struct spu *spu;
spu = container_of(sysdev, struct spu, sysdev); spu = container_of(dev, struct spu, dev);
value.val = in_be64(&reg->val); value.val = in_be64(&reg->val);
return value.spe[spu->spe_id]; return value.spe[spu->spe_id];
} }
static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, static ssize_t spu_show_temp(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
u8 value; u8 value;
struct cbe_pmd_regs __iomem *pmd_regs; struct cbe_pmd_regs __iomem *pmd_regs;
pmd_regs = get_pmd_regs(sysdev); pmd_regs = get_pmd_regs(dev);
value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); value = spu_read_register_value(dev, &pmd_regs->ts_ctsr1);
return sprintf(buf, "%d\n", reg_to_temp(value)); return sprintf(buf, "%d\n", reg_to_temp(value));
} }
...@@ -147,48 +147,48 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char ...@@ -147,48 +147,48 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char
return size; return size;
} }
static ssize_t spu_show_throttle_end(struct sys_device *sysdev, static ssize_t spu_show_throttle_end(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(get_pmd_regs(sysdev), buf, 0); return show_throttle(get_pmd_regs(dev), buf, 0);
} }
static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, static ssize_t spu_show_throttle_begin(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(get_pmd_regs(sysdev), buf, 8); return show_throttle(get_pmd_regs(dev), buf, 8);
} }
static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, static ssize_t spu_show_throttle_full_stop(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(get_pmd_regs(sysdev), buf, 16); return show_throttle(get_pmd_regs(dev), buf, 16);
} }
static ssize_t spu_store_throttle_end(struct sys_device *sysdev, static ssize_t spu_store_throttle_end(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(get_pmd_regs(sysdev), buf, size, 0); return store_throttle(get_pmd_regs(dev), buf, size, 0);
} }
static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, static ssize_t spu_store_throttle_begin(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(get_pmd_regs(sysdev), buf, size, 8); return store_throttle(get_pmd_regs(dev), buf, size, 8);
} }
static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, static ssize_t spu_store_throttle_full_stop(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(get_pmd_regs(sysdev), buf, size, 16); return store_throttle(get_pmd_regs(dev), buf, size, 16);
} }
static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) static ssize_t ppe_show_temp(struct device *dev, char *buf, int pos)
{ {
struct cbe_pmd_regs __iomem *pmd_regs; struct cbe_pmd_regs __iomem *pmd_regs;
u64 value; u64 value;
pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
value = in_be64(&pmd_regs->ts_ctsr2); value = in_be64(&pmd_regs->ts_ctsr2);
value = (value >> pos) & 0x3f; value = (value >> pos) & 0x3f;
...@@ -199,64 +199,64 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) ...@@ -199,64 +199,64 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
/* shows the temperature of the DTS on the PPE, /* shows the temperature of the DTS on the PPE,
* located near the linear thermal sensor */ * located near the linear thermal sensor */
static ssize_t ppe_show_temp0(struct sys_device *sysdev, static ssize_t ppe_show_temp0(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return ppe_show_temp(sysdev, buf, 32); return ppe_show_temp(dev, buf, 32);
} }
/* shows the temperature of the second DTS on the PPE */ /* shows the temperature of the second DTS on the PPE */
static ssize_t ppe_show_temp1(struct sys_device *sysdev, static ssize_t ppe_show_temp1(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return ppe_show_temp(sysdev, buf, 0); return ppe_show_temp(dev, buf, 0);
} }
static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, static ssize_t ppe_show_throttle_end(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 32);
} }
static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, static ssize_t ppe_show_throttle_begin(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 40);
} }
static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, static ssize_t ppe_show_throttle_full_stop(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 48);
} }
static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, static ssize_t ppe_store_throttle_end(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 32);
} }
static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, static ssize_t ppe_store_throttle_begin(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 40);
} }
static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, static ssize_t ppe_store_throttle_full_stop(struct device *dev,
struct sysdev_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 48);
} }
static struct sysdev_attribute attr_spu_temperature = { static struct device_attribute attr_spu_temperature = {
.attr = {.name = "temperature", .mode = 0400 }, .attr = {.name = "temperature", .mode = 0400 },
.show = spu_show_temp, .show = spu_show_temp,
}; };
static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); static DEVICE_PREFIX_ATTR(spu, throttle_end, 0600);
static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); static DEVICE_PREFIX_ATTR(spu, throttle_begin, 0600);
static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); static DEVICE_PREFIX_ATTR(spu, throttle_full_stop, 0600);
static struct attribute *spu_attributes[] = { static struct attribute *spu_attributes[] = {
...@@ -272,19 +272,19 @@ static struct attribute_group spu_attribute_group = { ...@@ -272,19 +272,19 @@ static struct attribute_group spu_attribute_group = {
.attrs = spu_attributes, .attrs = spu_attributes,
}; };
static struct sysdev_attribute attr_ppe_temperature0 = { static struct device_attribute attr_ppe_temperature0 = {
.attr = {.name = "temperature0", .mode = 0400 }, .attr = {.name = "temperature0", .mode = 0400 },
.show = ppe_show_temp0, .show = ppe_show_temp0,
}; };
static struct sysdev_attribute attr_ppe_temperature1 = { static struct device_attribute attr_ppe_temperature1 = {
.attr = {.name = "temperature1", .mode = 0400 }, .attr = {.name = "temperature1", .mode = 0400 },
.show = ppe_show_temp1, .show = ppe_show_temp1,
}; };
static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); static DEVICE_PREFIX_ATTR(ppe, throttle_end, 0600);
static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); static DEVICE_PREFIX_ATTR(ppe, throttle_begin, 0600);
static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); static DEVICE_PREFIX_ATTR(ppe, throttle_full_stop, 0600);
static struct attribute *ppe_attributes[] = { static struct attribute *ppe_attributes[] = {
&attr_ppe_temperature0.attr, &attr_ppe_temperature0.attr,
...@@ -307,7 +307,7 @@ static int __init init_default_values(void) ...@@ -307,7 +307,7 @@ static int __init init_default_values(void)
{ {
int cpu; int cpu;
struct cbe_pmd_regs __iomem *pmd_regs; struct cbe_pmd_regs __iomem *pmd_regs;
struct sys_device *sysdev; struct device *dev;
union ppe_spe_reg tpr; union ppe_spe_reg tpr;
union spe_reg str1; union spe_reg str1;
u64 str2; u64 str2;
...@@ -349,14 +349,14 @@ static int __init init_default_values(void) ...@@ -349,14 +349,14 @@ static int __init init_default_values(void)
for_each_possible_cpu (cpu) { for_each_possible_cpu (cpu) {
pr_debug("processing cpu %d\n", cpu); pr_debug("processing cpu %d\n", cpu);
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
if (!sysdev) { if (!dev) {
pr_info("invalid sysdev pointer for cbe_thermal\n"); pr_info("invalid dev pointer for cbe_thermal\n");
return -EINVAL; return -EINVAL;
} }
pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
if (!pmd_regs) { if (!pmd_regs) {
pr_info("invalid CBE regs pointer for cbe_thermal\n"); pr_info("invalid CBE regs pointer for cbe_thermal\n");
...@@ -379,8 +379,8 @@ static int __init thermal_init(void) ...@@ -379,8 +379,8 @@ static int __init thermal_init(void)
int rc = init_default_values(); int rc = init_default_values();
if (rc == 0) { if (rc == 0) {
spu_add_sysdev_attr_group(&spu_attribute_group); spu_add_dev_attr_group(&spu_attribute_group);
cpu_add_sysdev_attr_group(&ppe_attribute_group); cpu_add_dev_attr_group(&ppe_attribute_group);
} }
return rc; return rc;
...@@ -389,8 +389,8 @@ module_init(thermal_init); ...@@ -389,8 +389,8 @@ module_init(thermal_init);
static void __exit thermal_exit(void) static void __exit thermal_exit(void)
{ {
spu_remove_sysdev_attr_group(&spu_attribute_group); spu_remove_dev_attr_group(&spu_attribute_group);
cpu_remove_sysdev_attr_group(&ppe_attribute_group); cpu_remove_dev_attr_group(&ppe_attribute_group);
} }
module_exit(thermal_exit); module_exit(thermal_exit);
......
...@@ -522,31 +522,32 @@ void spu_init_channels(struct spu *spu) ...@@ -522,31 +522,32 @@ void spu_init_channels(struct spu *spu)
} }
EXPORT_SYMBOL_GPL(spu_init_channels); EXPORT_SYMBOL_GPL(spu_init_channels);
static struct sysdev_class spu_sysdev_class = { static struct bus_type spu_subsys = {
.name = "spu", .name = "spu",
.dev_name = "spu",
}; };
int spu_add_sysdev_attr(struct sysdev_attribute *attr) int spu_add_dev_attr(struct device_attribute *attr)
{ {
struct spu *spu; struct spu *spu;
mutex_lock(&spu_full_list_mutex); mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list) list_for_each_entry(spu, &spu_full_list, full_list)
sysdev_create_file(&spu->sysdev, attr); device_create_file(&spu->dev, attr);
mutex_unlock(&spu_full_list_mutex); mutex_unlock(&spu_full_list_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(spu_add_sysdev_attr); EXPORT_SYMBOL_GPL(spu_add_dev_attr);
int spu_add_sysdev_attr_group(struct attribute_group *attrs) int spu_add_dev_attr_group(struct attribute_group *attrs)
{ {
struct spu *spu; struct spu *spu;
int rc = 0; int rc = 0;
mutex_lock(&spu_full_list_mutex); mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list) { list_for_each_entry(spu, &spu_full_list, full_list) {
rc = sysfs_create_group(&spu->sysdev.kobj, attrs); rc = sysfs_create_group(&spu->dev.kobj, attrs);
/* we're in trouble here, but try unwinding anyway */ /* we're in trouble here, but try unwinding anyway */
if (rc) { if (rc) {
...@@ -555,7 +556,7 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs) ...@@ -555,7 +556,7 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
list_for_each_entry_continue_reverse(spu, list_for_each_entry_continue_reverse(spu,
&spu_full_list, full_list) &spu_full_list, full_list)
sysfs_remove_group(&spu->sysdev.kobj, attrs); sysfs_remove_group(&spu->dev.kobj, attrs);
break; break;
} }
} }
...@@ -564,45 +565,45 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs) ...@@ -564,45 +565,45 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); EXPORT_SYMBOL_GPL(spu_add_dev_attr_group);
void spu_remove_sysdev_attr(struct sysdev_attribute *attr) void spu_remove_dev_attr(struct device_attribute *attr)
{ {
struct spu *spu; struct spu *spu;
mutex_lock(&spu_full_list_mutex); mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list) list_for_each_entry(spu, &spu_full_list, full_list)
sysdev_remove_file(&spu->sysdev, attr); device_remove_file(&spu->dev, attr);
mutex_unlock(&spu_full_list_mutex); mutex_unlock(&spu_full_list_mutex);
} }
EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr); EXPORT_SYMBOL_GPL(spu_remove_dev_attr);
void spu_remove_sysdev_attr_group(struct attribute_group *attrs) void spu_remove_dev_attr_group(struct attribute_group *attrs)
{ {
struct spu *spu; struct spu *spu;
mutex_lock(&spu_full_list_mutex); mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list) list_for_each_entry(spu, &spu_full_list, full_list)
sysfs_remove_group(&spu->sysdev.kobj, attrs); sysfs_remove_group(&spu->dev.kobj, attrs);
mutex_unlock(&spu_full_list_mutex); mutex_unlock(&spu_full_list_mutex);
} }
EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group); EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group);
static int spu_create_sysdev(struct spu *spu) static int spu_create_dev(struct spu *spu)
{ {
int ret; int ret;
spu->sysdev.id = spu->number; spu->dev.id = spu->number;
spu->sysdev.cls = &spu_sysdev_class; spu->dev.bus = &spu_subsys;
ret = sysdev_register(&spu->sysdev); ret = device_register(&spu->dev);
if (ret) { if (ret) {
printk(KERN_ERR "Can't register SPU %d with sysfs\n", printk(KERN_ERR "Can't register SPU %d with sysfs\n",
spu->number); spu->number);
return ret; return ret;
} }
sysfs_add_device_to_node(&spu->sysdev, spu->node); sysfs_add_device_to_node(&spu->dev, spu->node);
return 0; return 0;
} }
...@@ -638,7 +639,7 @@ static int __init create_spu(void *data) ...@@ -638,7 +639,7 @@ static int __init create_spu(void *data)
if (ret) if (ret)
goto out_destroy; goto out_destroy;
ret = spu_create_sysdev(spu); ret = spu_create_dev(spu);
if (ret) if (ret)
goto out_free_irqs; goto out_free_irqs;
...@@ -695,10 +696,10 @@ static unsigned long long spu_acct_time(struct spu *spu, ...@@ -695,10 +696,10 @@ static unsigned long long spu_acct_time(struct spu *spu,
} }
static ssize_t spu_stat_show(struct sys_device *sysdev, static ssize_t spu_stat_show(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct spu *spu = container_of(sysdev, struct spu, sysdev); struct spu *spu = container_of(dev, struct spu, dev);
return sprintf(buf, "%s %llu %llu %llu %llu " return sprintf(buf, "%s %llu %llu %llu %llu "
"%llu %llu %llu %llu %llu %llu %llu %llu\n", "%llu %llu %llu %llu %llu %llu %llu %llu\n",
...@@ -717,7 +718,7 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, ...@@ -717,7 +718,7 @@ static ssize_t spu_stat_show(struct sys_device *sysdev,
spu->stats.libassist); spu->stats.libassist);
} }
static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL);
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
...@@ -816,8 +817,8 @@ static int __init init_spu_base(void) ...@@ -816,8 +817,8 @@ static int __init init_spu_base(void)
if (!spu_management_ops) if (!spu_management_ops)
goto out; goto out;
/* create sysdev class for spus */ /* create system subsystem for spus */
ret = sysdev_class_register(&spu_sysdev_class); ret = subsys_system_register(&spu_subsys, NULL);
if (ret) if (ret)
goto out; goto out;
...@@ -826,7 +827,7 @@ static int __init init_spu_base(void) ...@@ -826,7 +827,7 @@ static int __init init_spu_base(void)
if (ret < 0) { if (ret < 0) {
printk(KERN_WARNING "%s: Error initializing spus\n", printk(KERN_WARNING "%s: Error initializing spus\n",
__func__); __func__);
goto out_unregister_sysdev_class; goto out_unregister_subsys;
} }
if (ret > 0) if (ret > 0)
...@@ -836,15 +837,15 @@ static int __init init_spu_base(void) ...@@ -836,15 +837,15 @@ static int __init init_spu_base(void)
xmon_register_spus(&spu_full_list); xmon_register_spus(&spu_full_list);
crash_register_spus(&spu_full_list); crash_register_spus(&spu_full_list);
mutex_unlock(&spu_full_list_mutex); mutex_unlock(&spu_full_list_mutex);
spu_add_sysdev_attr(&attr_stat); spu_add_dev_attr(&dev_attr_stat);
register_syscore_ops(&spu_syscore_ops); register_syscore_ops(&spu_syscore_ops);
spu_init_affinity(); spu_init_affinity();
return 0; return 0;
out_unregister_sysdev_class: out_unregister_subsys:
sysdev_class_unregister(&spu_sysdev_class); bus_unregister(&spu_subsys);
out: out:
return ret; return ret;
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/of.h> #include <linux/of.h>
#include <asm/cputhreads.h> #include <asm/cputhreads.h>
...@@ -184,7 +184,7 @@ static ssize_t get_best_energy_list(char *page, int activate) ...@@ -184,7 +184,7 @@ static ssize_t get_best_energy_list(char *page, int activate)
return s-page; return s-page;
} }
static ssize_t get_best_energy_data(struct sys_device *dev, static ssize_t get_best_energy_data(struct device *dev,
char *page, int activate) char *page, int activate)
{ {
int rc; int rc;
...@@ -207,26 +207,26 @@ static ssize_t get_best_energy_data(struct sys_device *dev, ...@@ -207,26 +207,26 @@ static ssize_t get_best_energy_data(struct sys_device *dev,
/* Wrapper functions */ /* Wrapper functions */
static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class, static ssize_t cpu_activate_hint_list_show(struct device *dev,
struct sysdev_class_attribute *attr, char *page) struct device_attribute *attr, char *page)
{ {
return get_best_energy_list(page, 1); return get_best_energy_list(page, 1);
} }
static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class, static ssize_t cpu_deactivate_hint_list_show(struct device *dev,
struct sysdev_class_attribute *attr, char *page) struct device_attribute *attr, char *page)
{ {
return get_best_energy_list(page, 0); return get_best_energy_list(page, 0);
} }
static ssize_t percpu_activate_hint_show(struct sys_device *dev, static ssize_t percpu_activate_hint_show(struct device *dev,
struct sysdev_attribute *attr, char *page) struct device_attribute *attr, char *page)
{ {
return get_best_energy_data(dev, page, 1); return get_best_energy_data(dev, page, 1);
} }
static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, static ssize_t percpu_deactivate_hint_show(struct device *dev,
struct sysdev_attribute *attr, char *page) struct device_attribute *attr, char *page)
{ {
return get_best_energy_data(dev, page, 0); return get_best_energy_data(dev, page, 0);
} }
...@@ -241,48 +241,48 @@ static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, ...@@ -241,48 +241,48 @@ static ssize_t percpu_deactivate_hint_show(struct sys_device *dev,
* Per-cpu value of the hint * Per-cpu value of the hint
*/ */
struct sysdev_class_attribute attr_cpu_activate_hint_list = struct device_attribute attr_cpu_activate_hint_list =
_SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444, __ATTR(pseries_activate_hint_list, 0444,
cpu_activate_hint_list_show, NULL); cpu_activate_hint_list_show, NULL);
struct sysdev_class_attribute attr_cpu_deactivate_hint_list = struct device_attribute attr_cpu_deactivate_hint_list =
_SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444, __ATTR(pseries_deactivate_hint_list, 0444,
cpu_deactivate_hint_list_show, NULL); cpu_deactivate_hint_list_show, NULL);
struct sysdev_attribute attr_percpu_activate_hint = struct device_attribute attr_percpu_activate_hint =
_SYSDEV_ATTR(pseries_activate_hint, 0444, __ATTR(pseries_activate_hint, 0444,
percpu_activate_hint_show, NULL); percpu_activate_hint_show, NULL);
struct sysdev_attribute attr_percpu_deactivate_hint = struct device_attribute attr_percpu_deactivate_hint =
_SYSDEV_ATTR(pseries_deactivate_hint, 0444, __ATTR(pseries_deactivate_hint, 0444,
percpu_deactivate_hint_show, NULL); percpu_deactivate_hint_show, NULL);
static int __init pseries_energy_init(void) static int __init pseries_energy_init(void)
{ {
int cpu, err; int cpu, err;
struct sys_device *cpu_sys_dev; struct device *cpu_dev;
if (!check_for_h_best_energy()) { if (!check_for_h_best_energy()) {
printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n"); printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n");
return 0; return 0;
} }
/* Create the sysfs files */ /* Create the sysfs files */
err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, err = device_create_file(cpu_subsys.dev_root,
&attr_cpu_activate_hint_list.attr); &attr_cpu_activate_hint_list);
if (!err) if (!err)
err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, err = device_create_file(cpu_subsys.dev_root,
&attr_cpu_deactivate_hint_list.attr); &attr_cpu_deactivate_hint_list);
if (err) if (err)
return err; return err;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
cpu_sys_dev = get_cpu_sysdev(cpu); cpu_dev = get_cpu_device(cpu);
err = sysfs_create_file(&cpu_sys_dev->kobj, err = device_create_file(cpu_dev,
&attr_percpu_activate_hint.attr); &attr_percpu_activate_hint);
if (err) if (err)
break; break;
err = sysfs_create_file(&cpu_sys_dev->kobj, err = device_create_file(cpu_dev,
&attr_percpu_deactivate_hint.attr); &attr_percpu_deactivate_hint);
if (err) if (err)
break; break;
} }
...@@ -298,23 +298,20 @@ static int __init pseries_energy_init(void) ...@@ -298,23 +298,20 @@ static int __init pseries_energy_init(void)
static void __exit pseries_energy_cleanup(void) static void __exit pseries_energy_cleanup(void)
{ {
int cpu; int cpu;
struct sys_device *cpu_sys_dev; struct device *cpu_dev;
if (!sysfs_entries) if (!sysfs_entries)
return; return;
/* Remove the sysfs files */ /* Remove the sysfs files */
sysfs_remove_file(&cpu_sysdev_class.kset.kobj, device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list);
&attr_cpu_activate_hint_list.attr); device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list);
sysfs_remove_file(&cpu_sysdev_class.kset.kobj,
&attr_cpu_deactivate_hint_list.attr);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
cpu_sys_dev = get_cpu_sysdev(cpu); cpu_dev = get_cpu_device(cpu);
sysfs_remove_file(&cpu_sys_dev->kobj, sysfs_remove_file(&cpu_dev->kobj,
&attr_percpu_activate_hint.attr); &attr_percpu_activate_hint.attr);
sysfs_remove_file(&cpu_sys_dev->kobj, sysfs_remove_file(&cpu_dev->kobj,
&attr_percpu_deactivate_hint.attr); &attr_percpu_deactivate_hint.attr);
} }
} }
......
...@@ -179,12 +179,12 @@ static struct kobj_attribute cpm_idle_attr = ...@@ -179,12 +179,12 @@ static struct kobj_attribute cpm_idle_attr =
static void cpm_idle_config_sysfs(void) static void cpm_idle_config_sysfs(void)
{ {
struct sys_device *sys_dev; struct device *dev;
unsigned long ret; unsigned long ret;
sys_dev = get_cpu_sysdev(0); dev = get_cpu_device(0);
ret = sysfs_create_file(&sys_dev->kobj, ret = sysfs_create_file(&dev->kobj,
&cpm_idle_attr.attr); &cpm_idle_attr.attr);
if (ret) if (ret)
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -831,8 +831,8 @@ int setup_profiling_timer(unsigned int multiplier) ...@@ -831,8 +831,8 @@ int setup_profiling_timer(unsigned int multiplier)
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static ssize_t cpu_configure_show(struct sys_device *dev, static ssize_t cpu_configure_show(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
ssize_t count; ssize_t count;
...@@ -842,8 +842,8 @@ static ssize_t cpu_configure_show(struct sys_device *dev, ...@@ -842,8 +842,8 @@ static ssize_t cpu_configure_show(struct sys_device *dev,
return count; return count;
} }
static ssize_t cpu_configure_store(struct sys_device *dev, static ssize_t cpu_configure_store(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int cpu = dev->id; int cpu = dev->id;
...@@ -889,11 +889,11 @@ static ssize_t cpu_configure_store(struct sys_device *dev, ...@@ -889,11 +889,11 @@ static ssize_t cpu_configure_store(struct sys_device *dev,
put_online_cpus(); put_online_cpus();
return rc ? rc : count; return rc ? rc : count;
} }
static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
#endif /* CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU */
static ssize_t cpu_polarization_show(struct sys_device *dev, static ssize_t cpu_polarization_show(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int cpu = dev->id; int cpu = dev->id;
ssize_t count; ssize_t count;
...@@ -919,22 +919,22 @@ static ssize_t cpu_polarization_show(struct sys_device *dev, ...@@ -919,22 +919,22 @@ static ssize_t cpu_polarization_show(struct sys_device *dev,
mutex_unlock(&smp_cpu_state_mutex); mutex_unlock(&smp_cpu_state_mutex);
return count; return count;
} }
static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); static DEVICE_ATTR(polarization, 0444, cpu_polarization_show, NULL);
static ssize_t show_cpu_address(struct sys_device *dev, static ssize_t show_cpu_address(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]);
} }
static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL); static DEVICE_ATTR(address, 0444, show_cpu_address, NULL);
static struct attribute *cpu_common_attrs[] = { static struct attribute *cpu_common_attrs[] = {
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
&attr_configure.attr, &dev_attr_configure.attr,
#endif #endif
&attr_address.attr, &dev_attr_address.attr,
&attr_polarization.attr, &dev_attr_polarization.attr,
NULL, NULL,
}; };
...@@ -942,8 +942,8 @@ static struct attribute_group cpu_common_attr_group = { ...@@ -942,8 +942,8 @@ static struct attribute_group cpu_common_attr_group = {
.attrs = cpu_common_attrs, .attrs = cpu_common_attrs,
}; };
static ssize_t show_capability(struct sys_device *dev, static ssize_t show_capability(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned int capability; unsigned int capability;
int rc; int rc;
...@@ -953,10 +953,10 @@ static ssize_t show_capability(struct sys_device *dev, ...@@ -953,10 +953,10 @@ static ssize_t show_capability(struct sys_device *dev,
return rc; return rc;
return sprintf(buf, "%u\n", capability); return sprintf(buf, "%u\n", capability);
} }
static SYSDEV_ATTR(capability, 0444, show_capability, NULL); static DEVICE_ATTR(capability, 0444, show_capability, NULL);
static ssize_t show_idle_count(struct sys_device *dev, static ssize_t show_idle_count(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct s390_idle_data *idle; struct s390_idle_data *idle;
unsigned long long idle_count; unsigned long long idle_count;
...@@ -976,10 +976,10 @@ static ssize_t show_idle_count(struct sys_device *dev, ...@@ -976,10 +976,10 @@ static ssize_t show_idle_count(struct sys_device *dev,
goto repeat; goto repeat;
return sprintf(buf, "%llu\n", idle_count); return sprintf(buf, "%llu\n", idle_count);
} }
static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
static ssize_t show_idle_time(struct sys_device *dev, static ssize_t show_idle_time(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct s390_idle_data *idle; struct s390_idle_data *idle;
unsigned long long now, idle_time, idle_enter; unsigned long long now, idle_time, idle_enter;
...@@ -1001,12 +1001,12 @@ static ssize_t show_idle_time(struct sys_device *dev, ...@@ -1001,12 +1001,12 @@ static ssize_t show_idle_time(struct sys_device *dev,
goto repeat; goto repeat;
return sprintf(buf, "%llu\n", idle_time >> 12); return sprintf(buf, "%llu\n", idle_time >> 12);
} }
static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
static struct attribute *cpu_online_attrs[] = { static struct attribute *cpu_online_attrs[] = {
&attr_capability.attr, &dev_attr_capability.attr,
&attr_idle_count.attr, &dev_attr_idle_count.attr,
&attr_idle_time_us.attr, &dev_attr_idle_time_us.attr,
NULL, NULL,
}; };
...@@ -1019,7 +1019,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self, ...@@ -1019,7 +1019,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
{ {
unsigned int cpu = (unsigned int)(long)hcpu; unsigned int cpu = (unsigned int)(long)hcpu;
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
struct s390_idle_data *idle; struct s390_idle_data *idle;
int err = 0; int err = 0;
...@@ -1045,7 +1045,7 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = { ...@@ -1045,7 +1045,7 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = {
static int __devinit smp_add_present_cpu(int cpu) static int __devinit smp_add_present_cpu(int cpu)
{ {
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
int rc; int rc;
c->hotpluggable = 1; c->hotpluggable = 1;
...@@ -1098,8 +1098,8 @@ int __ref smp_rescan_cpus(void) ...@@ -1098,8 +1098,8 @@ int __ref smp_rescan_cpus(void)
return rc; return rc;
} }
static ssize_t __ref rescan_store(struct sysdev_class *class, static ssize_t __ref rescan_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
...@@ -1108,11 +1108,11 @@ static ssize_t __ref rescan_store(struct sysdev_class *class, ...@@ -1108,11 +1108,11 @@ static ssize_t __ref rescan_store(struct sysdev_class *class,
rc = smp_rescan_cpus(); rc = smp_rescan_cpus();
return rc ? rc : count; return rc ? rc : count;
} }
static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
#endif /* CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU */
static ssize_t dispatching_show(struct sysdev_class *class, static ssize_t dispatching_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
ssize_t count; ssize_t count;
...@@ -1123,8 +1123,8 @@ static ssize_t dispatching_show(struct sysdev_class *class, ...@@ -1123,8 +1123,8 @@ static ssize_t dispatching_show(struct sysdev_class *class,
return count; return count;
} }
static ssize_t dispatching_store(struct sysdev_class *dev, static ssize_t dispatching_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
...@@ -1148,7 +1148,7 @@ static ssize_t dispatching_store(struct sysdev_class *dev, ...@@ -1148,7 +1148,7 @@ static ssize_t dispatching_store(struct sysdev_class *dev,
put_online_cpus(); put_online_cpus();
return rc ? rc : count; return rc ? rc : count;
} }
static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, static DEVICE_ATTR(dispatching, 0644, dispatching_show,
dispatching_store); dispatching_store);
static int __init topology_init(void) static int __init topology_init(void)
...@@ -1159,11 +1159,11 @@ static int __init topology_init(void) ...@@ -1159,11 +1159,11 @@ static int __init topology_init(void)
register_cpu_notifier(&smp_cpu_nb); register_cpu_notifier(&smp_cpu_nb);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan); rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan);
if (rc) if (rc)
return rc; return rc;
#endif #endif
rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching); rc = device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching);
if (rc) if (rc)
return rc; return rc;
for_each_present_cpu(cpu) { for_each_present_cpu(cpu) {
......
...@@ -230,7 +230,7 @@ void store_topology(struct sysinfo_15_1_x *info) ...@@ -230,7 +230,7 @@ void store_topology(struct sysinfo_15_1_x *info)
int arch_update_cpu_topology(void) int arch_update_cpu_topology(void)
{ {
struct sysinfo_15_1_x *info = tl_info; struct sysinfo_15_1_x *info = tl_info;
struct sys_device *sysdev; struct device *dev;
int cpu; int cpu;
if (!MACHINE_HAS_TOPOLOGY) { if (!MACHINE_HAS_TOPOLOGY) {
...@@ -242,8 +242,8 @@ int arch_update_cpu_topology(void) ...@@ -242,8 +242,8 @@ int arch_update_cpu_topology(void)
tl_to_cores(info); tl_to_cores(info);
update_cpu_core_map(); update_cpu_core_map();
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); kobject_uevent(&dev->kobj, KOBJ_CHANGE);
} }
return 1; return 1;
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -337,9 +337,9 @@ static struct kobj_type ktype_percpu_entry = { ...@@ -337,9 +337,9 @@ static struct kobj_type ktype_percpu_entry = {
.default_attrs = sq_sysfs_attrs, .default_attrs = sq_sysfs_attrs,
}; };
static int __devinit sq_sysdev_add(struct sys_device *sysdev) static int __devinit sq_dev_add(struct device *dev)
{ {
unsigned int cpu = sysdev->id; unsigned int cpu = dev->id;
struct kobject *kobj; struct kobject *kobj;
int error; int error;
...@@ -348,25 +348,27 @@ static int __devinit sq_sysdev_add(struct sys_device *sysdev) ...@@ -348,25 +348,27 @@ static int __devinit sq_sysdev_add(struct sys_device *sysdev)
return -ENOMEM; return -ENOMEM;
kobj = sq_kobject[cpu]; kobj = sq_kobject[cpu];
error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj, error = kobject_init_and_add(kobj, &ktype_percpu_entry, &dev->kobj,
"%s", "sq"); "%s", "sq");
if (!error) if (!error)
kobject_uevent(kobj, KOBJ_ADD); kobject_uevent(kobj, KOBJ_ADD);
return error; return error;
} }
static int __devexit sq_sysdev_remove(struct sys_device *sysdev) static int __devexit sq_dev_remove(struct device *dev)
{ {
unsigned int cpu = sysdev->id; unsigned int cpu = dev->id;
struct kobject *kobj = sq_kobject[cpu]; struct kobject *kobj = sq_kobject[cpu];
kobject_put(kobj); kobject_put(kobj);
return 0; return 0;
} }
static struct sysdev_driver sq_sysdev_driver = { static struct subsys_interface sq_interface = {
.add = sq_sysdev_add, .name = "sq"
.remove = __devexit_p(sq_sysdev_remove), .subsys = &cpu_subsys,
.add_dev = sq_dev_add,
.remove_dev = __devexit_p(sq_dev_remove),
}; };
static int __init sq_api_init(void) static int __init sq_api_init(void)
...@@ -386,7 +388,7 @@ static int __init sq_api_init(void) ...@@ -386,7 +388,7 @@ static int __init sq_api_init(void)
if (unlikely(!sq_bitmap)) if (unlikely(!sq_bitmap))
goto out; goto out;
ret = sysdev_driver_register(&cpu_sysdev_class, &sq_sysdev_driver); ret = subsys_interface_register(&sq_interface);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out;
...@@ -401,7 +403,7 @@ static int __init sq_api_init(void) ...@@ -401,7 +403,7 @@ static int __init sq_api_init(void)
static void __exit sq_api_exit(void) static void __exit sq_api_exit(void)
{ {
sysdev_driver_unregister(&cpu_sysdev_class, &sq_sysdev_driver); subsys_interface_unregister(&sq_interface);
kfree(sq_bitmap); kfree(sq_bitmap);
kmem_cache_destroy(sq_cache); kmem_cache_destroy(sq_cache);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Copyright (C) 2007 David S. Miller <davem@davemloft.net> * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
*/ */
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/percpu.h> #include <linux/percpu.h>
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
#define SHOW_MMUSTAT_ULONG(NAME) \ #define SHOW_MMUSTAT_ULONG(NAME) \
static ssize_t show_##NAME(struct sys_device *dev, \ static ssize_t show_##NAME(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
return sprintf(buf, "%lu\n", p->NAME); \ return sprintf(buf, "%lu\n", p->NAME); \
} \ } \
static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL) static DEVICE_ATTR(NAME, 0444, show_##NAME, NULL)
SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte); SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte); SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
...@@ -58,38 +58,38 @@ SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte); ...@@ -58,38 +58,38 @@ SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte); SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
static struct attribute *mmu_stat_attrs[] = { static struct attribute *mmu_stat_attrs[] = {
&attr_immu_tsb_hits_ctx0_8k_tte.attr, &dev_attr_immu_tsb_hits_ctx0_8k_tte.attr,
&attr_immu_tsb_ticks_ctx0_8k_tte.attr, &dev_attr_immu_tsb_ticks_ctx0_8k_tte.attr,
&attr_immu_tsb_hits_ctx0_64k_tte.attr, &dev_attr_immu_tsb_hits_ctx0_64k_tte.attr,
&attr_immu_tsb_ticks_ctx0_64k_tte.attr, &dev_attr_immu_tsb_ticks_ctx0_64k_tte.attr,
&attr_immu_tsb_hits_ctx0_4mb_tte.attr, &dev_attr_immu_tsb_hits_ctx0_4mb_tte.attr,
&attr_immu_tsb_ticks_ctx0_4mb_tte.attr, &dev_attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
&attr_immu_tsb_hits_ctx0_256mb_tte.attr, &dev_attr_immu_tsb_hits_ctx0_256mb_tte.attr,
&attr_immu_tsb_ticks_ctx0_256mb_tte.attr, &dev_attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
&attr_immu_tsb_hits_ctxnon0_8k_tte.attr, &dev_attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
&attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, &dev_attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
&attr_immu_tsb_hits_ctxnon0_64k_tte.attr, &dev_attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
&attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, &dev_attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
&attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, &dev_attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
&attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, &dev_attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
&attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, &dev_attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
&attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, &dev_attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
&attr_dmmu_tsb_hits_ctx0_8k_tte.attr, &dev_attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
&attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, &dev_attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
&attr_dmmu_tsb_hits_ctx0_64k_tte.attr, &dev_attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
&attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, &dev_attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
&attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, &dev_attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
&attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, &dev_attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
&attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, &dev_attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
&attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, &dev_attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
&attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, &dev_attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
&attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, &dev_attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
&attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, &dev_attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
&attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, &dev_attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
&attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, &dev_attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
&attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, &dev_attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
&attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, &dev_attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
&attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, &dev_attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
NULL, NULL,
}; };
...@@ -139,15 +139,15 @@ static unsigned long write_mmustat_enable(unsigned long val) ...@@ -139,15 +139,15 @@ static unsigned long write_mmustat_enable(unsigned long val)
return sun4v_mmustat_conf(ra, &orig_ra); return sun4v_mmustat_conf(ra, &orig_ra);
} }
static ssize_t show_mmustat_enable(struct sys_device *s, static ssize_t show_mmustat_enable(struct device *s,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
return sprintf(buf, "%lx\n", val); return sprintf(buf, "%lx\n", val);
} }
static ssize_t store_mmustat_enable(struct sys_device *s, static ssize_t store_mmustat_enable(struct device *s,
struct sysdev_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
{ {
unsigned long val, err; unsigned long val, err;
...@@ -163,39 +163,39 @@ static ssize_t store_mmustat_enable(struct sys_device *s, ...@@ -163,39 +163,39 @@ static ssize_t store_mmustat_enable(struct sys_device *s,
return count; return count;
} }
static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); static DEVICE_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
static int mmu_stats_supported; static int mmu_stats_supported;
static int register_mmu_stats(struct sys_device *s) static int register_mmu_stats(struct device *s)
{ {
if (!mmu_stats_supported) if (!mmu_stats_supported)
return 0; return 0;
sysdev_create_file(s, &attr_mmustat_enable); device_create_file(s, &dev_attr_mmustat_enable);
return sysfs_create_group(&s->kobj, &mmu_stat_group); return sysfs_create_group(&s->kobj, &mmu_stat_group);
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static void unregister_mmu_stats(struct sys_device *s) static void unregister_mmu_stats(struct device *s)
{ {
if (!mmu_stats_supported) if (!mmu_stats_supported)
return; return;
sysfs_remove_group(&s->kobj, &mmu_stat_group); sysfs_remove_group(&s->kobj, &mmu_stat_group);
sysdev_remove_file(s, &attr_mmustat_enable); device_remove_file(s, &dev_attr_mmustat_enable);
} }
#endif #endif
#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
static ssize_t show_##NAME(struct sys_device *dev, \ static ssize_t show_##NAME(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
cpuinfo_sparc *c = &cpu_data(dev->id); \ cpuinfo_sparc *c = &cpu_data(dev->id); \
return sprintf(buf, "%lu\n", c->MEMBER); \ return sprintf(buf, "%lu\n", c->MEMBER); \
} }
#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
static ssize_t show_##NAME(struct sys_device *dev, \ static ssize_t show_##NAME(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
cpuinfo_sparc *c = &cpu_data(dev->id); \ cpuinfo_sparc *c = &cpu_data(dev->id); \
return sprintf(buf, "%u\n", c->MEMBER); \ return sprintf(buf, "%u\n", c->MEMBER); \
...@@ -209,14 +209,14 @@ SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size); ...@@ -209,14 +209,14 @@ SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size); SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size); SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
static struct sysdev_attribute cpu_core_attrs[] = { static struct device_attribute cpu_core_attrs[] = {
_SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL), __ATTR(clock_tick, 0444, show_clock_tick, NULL),
_SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), __ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL),
_SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), __ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
_SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), __ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL),
_SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), __ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
_SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), __ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL),
_SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), __ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL),
}; };
static DEFINE_PER_CPU(struct cpu, cpu_devices); static DEFINE_PER_CPU(struct cpu, cpu_devices);
...@@ -224,11 +224,11 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); ...@@ -224,11 +224,11 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
static void register_cpu_online(unsigned int cpu) static void register_cpu_online(unsigned int cpu)
{ {
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
int i; int i;
for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
sysdev_create_file(s, &cpu_core_attrs[i]); device_create_file(s, &cpu_core_attrs[i]);
register_mmu_stats(s); register_mmu_stats(s);
} }
...@@ -237,12 +237,12 @@ static void register_cpu_online(unsigned int cpu) ...@@ -237,12 +237,12 @@ static void register_cpu_online(unsigned int cpu)
static void unregister_cpu_online(unsigned int cpu) static void unregister_cpu_online(unsigned int cpu)
{ {
struct cpu *c = &per_cpu(cpu_devices, cpu); struct cpu *c = &per_cpu(cpu_devices, cpu);
struct sys_device *s = &c->sysdev; struct device *s = &c->dev;
int i; int i;
unregister_mmu_stats(s); unregister_mmu_stats(s);
for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
sysdev_remove_file(s, &cpu_core_attrs[i]); device_remove_file(s, &cpu_core_attrs[i]);
} }
#endif #endif
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* /sys entry support. * /sys entry support.
*/ */
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp.h> #include <linux/smp.h>
...@@ -31,55 +31,55 @@ static ssize_t get_hv_confstr(char *page, int query) ...@@ -31,55 +31,55 @@ static ssize_t get_hv_confstr(char *page, int query)
return n; return n;
} }
static ssize_t chip_width_show(struct sysdev_class *dev, static ssize_t chip_width_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
return sprintf(page, "%u\n", smp_width); return sprintf(page, "%u\n", smp_width);
} }
static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL); static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
static ssize_t chip_height_show(struct sysdev_class *dev, static ssize_t chip_height_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
return sprintf(page, "%u\n", smp_height); return sprintf(page, "%u\n", smp_height);
} }
static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL); static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
static ssize_t chip_serial_show(struct sysdev_class *dev, static ssize_t chip_serial_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM); return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
} }
static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL); static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
static ssize_t chip_revision_show(struct sysdev_class *dev, static ssize_t chip_revision_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
return get_hv_confstr(page, HV_CONFSTR_CHIP_REV); return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
} }
static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL); static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
static ssize_t type_show(struct sysdev_class *dev, static ssize_t type_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
return sprintf(page, "tilera\n"); return sprintf(page, "tilera\n");
} }
static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL); static DEVICE_ATTR(type, 0444, type_show, NULL);
#define HV_CONF_ATTR(name, conf) \ #define HV_CONF_ATTR(name, conf) \
static ssize_t name ## _show(struct sysdev_class *dev, \ static ssize_t name ## _show(struct device *dev, \
struct sysdev_class_attribute *attr, \ struct device_attribute *attr, \
char *page) \ char *page) \
{ \ { \
return get_hv_confstr(page, conf); \ return get_hv_confstr(page, conf); \
} \ } \
static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL); static DEVICE_ATTR(name, 0444, name ## _show, NULL);
HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER) HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER)
HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER) HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER)
...@@ -95,15 +95,15 @@ HV_CONF_ATTR(mezz_description, HV_CONFSTR_MEZZ_DESC) ...@@ -95,15 +95,15 @@ HV_CONF_ATTR(mezz_description, HV_CONFSTR_MEZZ_DESC)
HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL) HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL)
static struct attribute *board_attrs[] = { static struct attribute *board_attrs[] = {
&attr_board_part.attr, &dev_attr_board_part.attr,
&attr_board_serial.attr, &dev_attr_board_serial.attr,
&attr_board_revision.attr, &dev_attr_board_revision.attr,
&attr_board_description.attr, &dev_attr_board_description.attr,
&attr_mezz_part.attr, &dev_attr_mezz_part.attr,
&attr_mezz_serial.attr, &dev_attr_mezz_serial.attr,
&attr_mezz_revision.attr, &dev_attr_mezz_revision.attr,
&attr_mezz_description.attr, &dev_attr_mezz_description.attr,
&attr_switch_control.attr, &dev_attr_switch_control.attr,
NULL NULL
}; };
...@@ -150,12 +150,11 @@ hvconfig_bin_read(struct file *filp, struct kobject *kobj, ...@@ -150,12 +150,11 @@ hvconfig_bin_read(struct file *filp, struct kobject *kobj,
static int __init create_sysfs_entries(void) static int __init create_sysfs_entries(void)
{ {
struct sysdev_class *cls = &cpu_sysdev_class;
int err = 0; int err = 0;
#define create_cpu_attr(name) \ #define create_cpu_attr(name) \
if (!err) \ if (!err) \
err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr); err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name);
create_cpu_attr(chip_width); create_cpu_attr(chip_width);
create_cpu_attr(chip_height); create_cpu_attr(chip_height);
create_cpu_attr(chip_serial); create_cpu_attr(chip_serial);
...@@ -163,7 +162,7 @@ static int __init create_sysfs_entries(void) ...@@ -163,7 +162,7 @@ static int __init create_sysfs_entries(void)
#define create_hv_attr(name) \ #define create_hv_attr(name) \
if (!err) \ if (!err) \
err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr); err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name);
create_hv_attr(type); create_hv_attr(type);
create_hv_attr(version); create_hv_attr(version);
create_hv_attr(config_version); create_hv_attr(config_version);
......
...@@ -149,7 +149,7 @@ static inline void enable_p5_mce(void) {} ...@@ -149,7 +149,7 @@ static inline void enable_p5_mce(void) {}
void mce_setup(struct mce *m); void mce_setup(struct mce *m);
void mce_log(struct mce *m); void mce_log(struct mce *m);
DECLARE_PER_CPU(struct sys_device, mce_sysdev); DECLARE_PER_CPU(struct device, mce_device);
/* /*
* Maximum banks number. * Maximum banks number.
......
...@@ -844,8 +844,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu) ...@@ -844,8 +844,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/cpu.h>
extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */
/* pointer to kobject for cpuX/cache */ /* pointer to kobject for cpuX/cache */
static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject);
...@@ -1073,9 +1072,9 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu) ...@@ -1073,9 +1072,9 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
static DECLARE_BITMAP(cache_dev_map, NR_CPUS); static DECLARE_BITMAP(cache_dev_map, NR_CPUS);
/* Add/Remove cache interface for CPU device */ /* Add/Remove cache interface for CPU device */
static int __cpuinit cache_add_dev(struct sys_device * sys_dev) static int __cpuinit cache_add_dev(struct device *dev)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = dev->id;
unsigned long i, j; unsigned long i, j;
struct _index_kobject *this_object; struct _index_kobject *this_object;
struct _cpuid4_info *this_leaf; struct _cpuid4_info *this_leaf;
...@@ -1087,7 +1086,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -1087,7 +1086,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu),
&ktype_percpu_entry, &ktype_percpu_entry,
&sys_dev->kobj, "%s", "cache"); &dev->kobj, "%s", "cache");
if (retval < 0) { if (retval < 0) {
cpuid4_cache_sysfs_exit(cpu); cpuid4_cache_sysfs_exit(cpu);
return retval; return retval;
...@@ -1124,9 +1123,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -1124,9 +1123,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
return 0; return 0;
} }
static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) static void __cpuinit cache_remove_dev(struct device *dev)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = dev->id;
unsigned long i; unsigned long i;
if (per_cpu(ici_cpuid4_info, cpu) == NULL) if (per_cpu(ici_cpuid4_info, cpu) == NULL)
...@@ -1145,17 +1144,17 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, ...@@ -1145,17 +1144,17 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *dev;
sys_dev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
cache_add_dev(sys_dev); cache_add_dev(dev);
break; break;
case CPU_DEAD: case CPU_DEAD:
case CPU_DEAD_FROZEN: case CPU_DEAD_FROZEN:
cache_remove_dev(sys_dev); cache_remove_dev(dev);
break; break;
} }
return NOTIFY_OK; return NOTIFY_OK;
...@@ -1174,9 +1173,9 @@ static int __cpuinit cache_sysfs_init(void) ...@@ -1174,9 +1173,9 @@ static int __cpuinit cache_sysfs_init(void)
for_each_online_cpu(i) { for_each_online_cpu(i) {
int err; int err;
struct sys_device *sys_dev = get_cpu_sysdev(i); struct device *dev = get_cpu_device(i);
err = cache_add_dev(sys_dev); err = cache_add_dev(dev);
if (err) if (err)
return err; return err;
} }
......
#include <linux/sysdev.h> #include <linux/device.h>
#include <asm/mce.h> #include <asm/mce.h>
enum severity_level { enum severity_level {
...@@ -17,7 +17,7 @@ enum severity_level { ...@@ -17,7 +17,7 @@ enum severity_level {
struct mce_bank { struct mce_bank {
u64 ctl; /* subevents to enable */ u64 ctl; /* subevents to enable */
unsigned char init; /* initialise bank? */ unsigned char init; /* initialise bank? */
struct sysdev_attribute attr; /* sysdev attribute */ struct device_attribute attr; /* device attribute */
char attrname[ATTR_LEN]; /* attribute name */ char attrname[ATTR_LEN]; /* attribute name */
}; };
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ctype.h> #include <linux/ctype.h>
...@@ -1751,7 +1751,7 @@ static struct syscore_ops mce_syscore_ops = { ...@@ -1751,7 +1751,7 @@ static struct syscore_ops mce_syscore_ops = {
}; };
/* /*
* mce_sysdev: Sysfs support * mce_device: Sysfs support
*/ */
static void mce_cpu_restart(void *data) static void mce_cpu_restart(void *data)
...@@ -1787,27 +1787,28 @@ static void mce_enable_ce(void *all) ...@@ -1787,27 +1787,28 @@ static void mce_enable_ce(void *all)
__mcheck_cpu_init_timer(); __mcheck_cpu_init_timer();
} }
static struct sysdev_class mce_sysdev_class = { static struct bus_type mce_subsys = {
.name = "machinecheck", .name = "machinecheck",
.dev_name = "machinecheck",
}; };
DEFINE_PER_CPU(struct sys_device, mce_sysdev); DEFINE_PER_CPU(struct device, mce_device);
__cpuinitdata __cpuinitdata
void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr) static inline struct mce_bank *attr_to_bank(struct device_attribute *attr)
{ {
return container_of(attr, struct mce_bank, attr); return container_of(attr, struct mce_bank, attr);
} }
static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, static ssize_t show_bank(struct device *s, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl); return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl);
} }
static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, static ssize_t set_bank(struct device *s, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
u64 new; u64 new;
...@@ -1822,14 +1823,14 @@ static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, ...@@ -1822,14 +1823,14 @@ static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,
} }
static ssize_t static ssize_t
show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf) show_trigger(struct device *s, struct device_attribute *attr, char *buf)
{ {
strcpy(buf, mce_helper); strcpy(buf, mce_helper);
strcat(buf, "\n"); strcat(buf, "\n");
return strlen(mce_helper) + 1; return strlen(mce_helper) + 1;
} }
static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
const char *buf, size_t siz) const char *buf, size_t siz)
{ {
char *p; char *p;
...@@ -1844,8 +1845,8 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, ...@@ -1844,8 +1845,8 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
return strlen(mce_helper) + !!p; return strlen(mce_helper) + !!p;
} }
static ssize_t set_ignore_ce(struct sys_device *s, static ssize_t set_ignore_ce(struct device *s,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
u64 new; u64 new;
...@@ -1868,8 +1869,8 @@ static ssize_t set_ignore_ce(struct sys_device *s, ...@@ -1868,8 +1869,8 @@ static ssize_t set_ignore_ce(struct sys_device *s,
return size; return size;
} }
static ssize_t set_cmci_disabled(struct sys_device *s, static ssize_t set_cmci_disabled(struct device *s,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
u64 new; u64 new;
...@@ -1891,108 +1892,107 @@ static ssize_t set_cmci_disabled(struct sys_device *s, ...@@ -1891,108 +1892,107 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
return size; return size;
} }
static ssize_t store_int_with_restart(struct sys_device *s, static ssize_t store_int_with_restart(struct device *s,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
ssize_t ret = sysdev_store_int(s, attr, buf, size); ssize_t ret = device_store_int(s, attr, buf, size);
mce_restart(); mce_restart();
return ret; return ret;
} }
static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger);
static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); static DEVICE_INT_ATTR(tolerant, 0644, tolerant);
static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout);
static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);
static struct sysdev_ext_attribute attr_check_interval = { static struct dev_ext_attribute dev_attr_check_interval = {
_SYSDEV_ATTR(check_interval, 0644, sysdev_show_int, __ATTR(check_interval, 0644, device_show_int, store_int_with_restart),
store_int_with_restart),
&check_interval &check_interval
}; };
static struct sysdev_ext_attribute attr_ignore_ce = { static struct dev_ext_attribute dev_attr_ignore_ce = {
_SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce), __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce),
&mce_ignore_ce &mce_ignore_ce
}; };
static struct sysdev_ext_attribute attr_cmci_disabled = { static struct dev_ext_attribute dev_attr_cmci_disabled = {
_SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled), __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
&mce_cmci_disabled &mce_cmci_disabled
}; };
static struct sysdev_attribute *mce_sysdev_attrs[] = { static struct device_attribute *mce_device_attrs[] = {
&attr_tolerant.attr, &dev_attr_tolerant.attr,
&attr_check_interval.attr, &dev_attr_check_interval.attr,
&attr_trigger, &dev_attr_trigger,
&attr_monarch_timeout.attr, &dev_attr_monarch_timeout.attr,
&attr_dont_log_ce.attr, &dev_attr_dont_log_ce.attr,
&attr_ignore_ce.attr, &dev_attr_ignore_ce.attr,
&attr_cmci_disabled.attr, &dev_attr_cmci_disabled.attr,
NULL NULL
}; };
static cpumask_var_t mce_sysdev_initialized; static cpumask_var_t mce_device_initialized;
/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ /* Per cpu device init. All of the cpus still share the same ctrl bank: */
static __cpuinit int mce_sysdev_create(unsigned int cpu) static __cpuinit int mce_device_create(unsigned int cpu)
{ {
struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); struct device *dev = &per_cpu(mce_device, cpu);
int err; int err;
int i, j; int i, j;
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
return -EIO; return -EIO;
memset(&sysdev->kobj, 0, sizeof(struct kobject)); memset(&dev->kobj, 0, sizeof(struct kobject));
sysdev->id = cpu; dev->id = cpu;
sysdev->cls = &mce_sysdev_class; dev->bus = &mce_subsys;
err = sysdev_register(sysdev); err = device_register(dev);
if (err) if (err)
return err; return err;
for (i = 0; mce_sysdev_attrs[i]; i++) { for (i = 0; mce_device_attrs[i]; i++) {
err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]); err = device_create_file(dev, mce_device_attrs[i]);
if (err) if (err)
goto error; goto error;
} }
for (j = 0; j < banks; j++) { for (j = 0; j < banks; j++) {
err = sysdev_create_file(sysdev, &mce_banks[j].attr); err = device_create_file(dev, &mce_banks[j].attr);
if (err) if (err)
goto error2; goto error2;
} }
cpumask_set_cpu(cpu, mce_sysdev_initialized); cpumask_set_cpu(cpu, mce_device_initialized);
return 0; return 0;
error2: error2:
while (--j >= 0) while (--j >= 0)
sysdev_remove_file(sysdev, &mce_banks[j].attr); device_remove_file(dev, &mce_banks[j].attr);
error: error:
while (--i >= 0) while (--i >= 0)
sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); device_remove_file(dev, mce_device_attrs[i]);
sysdev_unregister(sysdev); device_unregister(dev);
return err; return err;
} }
static __cpuinit void mce_sysdev_remove(unsigned int cpu) static __cpuinit void mce_device_remove(unsigned int cpu)
{ {
struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); struct device *dev = &per_cpu(mce_device, cpu);
int i; int i;
if (!cpumask_test_cpu(cpu, mce_sysdev_initialized)) if (!cpumask_test_cpu(cpu, mce_device_initialized))
return; return;
for (i = 0; mce_sysdev_attrs[i]; i++) for (i = 0; mce_device_attrs[i]; i++)
sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); device_remove_file(dev, mce_device_attrs[i]);
for (i = 0; i < banks; i++) for (i = 0; i < banks; i++)
sysdev_remove_file(sysdev, &mce_banks[i].attr); device_remove_file(dev, &mce_banks[i].attr);
sysdev_unregister(sysdev); device_unregister(dev);
cpumask_clear_cpu(cpu, mce_sysdev_initialized); cpumask_clear_cpu(cpu, mce_device_initialized);
} }
/* Make sure there are no machine checks on offlined CPUs. */ /* Make sure there are no machine checks on offlined CPUs. */
...@@ -2042,7 +2042,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) ...@@ -2042,7 +2042,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
mce_sysdev_create(cpu); mce_device_create(cpu);
if (threshold_cpu_callback) if (threshold_cpu_callback)
threshold_cpu_callback(action, cpu); threshold_cpu_callback(action, cpu);
break; break;
...@@ -2050,7 +2050,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) ...@@ -2050,7 +2050,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
case CPU_DEAD_FROZEN: case CPU_DEAD_FROZEN:
if (threshold_cpu_callback) if (threshold_cpu_callback)
threshold_cpu_callback(action, cpu); threshold_cpu_callback(action, cpu);
mce_sysdev_remove(cpu); mce_device_remove(cpu);
break; break;
case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE:
case CPU_DOWN_PREPARE_FROZEN: case CPU_DOWN_PREPARE_FROZEN:
...@@ -2084,7 +2084,7 @@ static __init void mce_init_banks(void) ...@@ -2084,7 +2084,7 @@ static __init void mce_init_banks(void)
for (i = 0; i < banks; i++) { for (i = 0; i < banks; i++) {
struct mce_bank *b = &mce_banks[i]; struct mce_bank *b = &mce_banks[i];
struct sysdev_attribute *a = &b->attr; struct device_attribute *a = &b->attr;
sysfs_attr_init(&a->attr); sysfs_attr_init(&a->attr);
a->attr.name = b->attrname; a->attr.name = b->attrname;
...@@ -2104,16 +2104,16 @@ static __init int mcheck_init_device(void) ...@@ -2104,16 +2104,16 @@ static __init int mcheck_init_device(void)
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
return -EIO; return -EIO;
zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL); zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
mce_init_banks(); mce_init_banks();
err = sysdev_class_register(&mce_sysdev_class); err = subsys_system_register(&mce_subsys, NULL);
if (err) if (err)
return err; return err;
for_each_online_cpu(i) { for_each_online_cpu(i) {
err = mce_sysdev_create(i); err = mce_device_create(i);
if (err) if (err)
return err; return err;
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/sysdev.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
...@@ -548,7 +547,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -548,7 +547,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
if (!b) if (!b)
goto out; goto out;
err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj, err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj,
b->kobj, name); b->kobj, name);
if (err) if (err)
goto out; goto out;
...@@ -571,7 +570,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -571,7 +570,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
goto out; goto out;
} }
b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj); b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj);
if (!b->kobj) if (!b->kobj)
goto out_free; goto out_free;
...@@ -591,7 +590,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -591,7 +590,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
if (i == cpu) if (i == cpu)
continue; continue;
err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj, err = sysfs_create_link(&per_cpu(mce_device, i).kobj,
b->kobj, name); b->kobj, name);
if (err) if (err)
goto out; goto out;
...@@ -669,7 +668,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -669,7 +668,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* sibling symlink */ /* sibling symlink */
if (shared_bank[bank] && b->blocks->cpu != cpu) { if (shared_bank[bank] && b->blocks->cpu != cpu) {
sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name); sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name);
per_cpu(threshold_banks, cpu)[bank] = NULL; per_cpu(threshold_banks, cpu)[bank] = NULL;
return; return;
...@@ -681,7 +680,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -681,7 +680,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
if (i == cpu) if (i == cpu)
continue; continue;
sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name); sysfs_remove_link(&per_cpu(mce_device, i).kobj, name);
per_cpu(threshold_banks, i)[bank] = NULL; per_cpu(threshold_banks, i)[bank] = NULL;
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/sysdev.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h> #include <linux/smp.h>
...@@ -69,16 +68,16 @@ static atomic_t therm_throt_en = ATOMIC_INIT(0); ...@@ -69,16 +68,16 @@ static atomic_t therm_throt_en = ATOMIC_INIT(0);
static u32 lvtthmr_init __read_mostly; static u32 lvtthmr_init __read_mostly;
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
#define define_therm_throt_sysdev_one_ro(_name) \ #define define_therm_throt_device_one_ro(_name) \
static SYSDEV_ATTR(_name, 0444, \ static DEVICE_ATTR(_name, 0444, \
therm_throt_sysdev_show_##_name, \ therm_throt_device_show_##_name, \
NULL) \ NULL) \
#define define_therm_throt_sysdev_show_func(event, name) \ #define define_therm_throt_device_show_func(event, name) \
\ \
static ssize_t therm_throt_sysdev_show_##event##_##name( \ static ssize_t therm_throt_device_show_##event##_##name( \
struct sys_device *dev, \ struct device *dev, \
struct sysdev_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
unsigned int cpu = dev->id; \ unsigned int cpu = dev->id; \
...@@ -95,20 +94,20 @@ static ssize_t therm_throt_sysdev_show_##event##_##name( \ ...@@ -95,20 +94,20 @@ static ssize_t therm_throt_sysdev_show_##event##_##name( \
return ret; \ return ret; \
} }
define_therm_throt_sysdev_show_func(core_throttle, count); define_therm_throt_device_show_func(core_throttle, count);
define_therm_throt_sysdev_one_ro(core_throttle_count); define_therm_throt_device_one_ro(core_throttle_count);
define_therm_throt_sysdev_show_func(core_power_limit, count); define_therm_throt_device_show_func(core_power_limit, count);
define_therm_throt_sysdev_one_ro(core_power_limit_count); define_therm_throt_device_one_ro(core_power_limit_count);
define_therm_throt_sysdev_show_func(package_throttle, count); define_therm_throt_device_show_func(package_throttle, count);
define_therm_throt_sysdev_one_ro(package_throttle_count); define_therm_throt_device_one_ro(package_throttle_count);
define_therm_throt_sysdev_show_func(package_power_limit, count); define_therm_throt_device_show_func(package_power_limit, count);
define_therm_throt_sysdev_one_ro(package_power_limit_count); define_therm_throt_device_one_ro(package_power_limit_count);
static struct attribute *thermal_throttle_attrs[] = { static struct attribute *thermal_throttle_attrs[] = {
&attr_core_throttle_count.attr, &dev_attr_core_throttle_count.attr,
NULL NULL
}; };
...@@ -223,36 +222,36 @@ static int thresh_event_valid(int event) ...@@ -223,36 +222,36 @@ static int thresh_event_valid(int event)
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
/* Add/Remove thermal_throttle interface for CPU device: */ /* Add/Remove thermal_throttle interface for CPU device: */
static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, static __cpuinit int thermal_throttle_add_dev(struct device *dev,
unsigned int cpu) unsigned int cpu)
{ {
int err; int err;
struct cpuinfo_x86 *c = &cpu_data(cpu); struct cpuinfo_x86 *c = &cpu_data(cpu);
err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); err = sysfs_create_group(&dev->kobj, &thermal_attr_group);
if (err) if (err)
return err; return err;
if (cpu_has(c, X86_FEATURE_PLN)) if (cpu_has(c, X86_FEATURE_PLN))
err = sysfs_add_file_to_group(&sys_dev->kobj, err = sysfs_add_file_to_group(&dev->kobj,
&attr_core_power_limit_count.attr, &dev_attr_core_power_limit_count.attr,
thermal_attr_group.name); thermal_attr_group.name);
if (cpu_has(c, X86_FEATURE_PTS)) { if (cpu_has(c, X86_FEATURE_PTS)) {
err = sysfs_add_file_to_group(&sys_dev->kobj, err = sysfs_add_file_to_group(&dev->kobj,
&attr_package_throttle_count.attr, &dev_attr_package_throttle_count.attr,
thermal_attr_group.name); thermal_attr_group.name);
if (cpu_has(c, X86_FEATURE_PLN)) if (cpu_has(c, X86_FEATURE_PLN))
err = sysfs_add_file_to_group(&sys_dev->kobj, err = sysfs_add_file_to_group(&dev->kobj,
&attr_package_power_limit_count.attr, &dev_attr_package_power_limit_count.attr,
thermal_attr_group.name); thermal_attr_group.name);
} }
return err; return err;
} }
static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) static __cpuinit void thermal_throttle_remove_dev(struct device *dev)
{ {
sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group); sysfs_remove_group(&dev->kobj, &thermal_attr_group);
} }
/* Mutex protecting device creation against CPU hotplug: */ /* Mutex protecting device creation against CPU hotplug: */
...@@ -265,16 +264,16 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb, ...@@ -265,16 +264,16 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
void *hcpu) void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *dev;
int err = 0; int err = 0;
sys_dev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
switch (action) { switch (action) {
case CPU_UP_PREPARE: case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN: case CPU_UP_PREPARE_FROZEN:
mutex_lock(&therm_cpu_lock); mutex_lock(&therm_cpu_lock);
err = thermal_throttle_add_dev(sys_dev, cpu); err = thermal_throttle_add_dev(dev, cpu);
mutex_unlock(&therm_cpu_lock); mutex_unlock(&therm_cpu_lock);
WARN_ON(err); WARN_ON(err);
break; break;
...@@ -283,7 +282,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb, ...@@ -283,7 +282,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
case CPU_DEAD: case CPU_DEAD:
case CPU_DEAD_FROZEN: case CPU_DEAD_FROZEN:
mutex_lock(&therm_cpu_lock); mutex_lock(&therm_cpu_lock);
thermal_throttle_remove_dev(sys_dev); thermal_throttle_remove_dev(dev);
mutex_unlock(&therm_cpu_lock); mutex_unlock(&therm_cpu_lock);
break; break;
} }
...@@ -310,7 +309,7 @@ static __init int thermal_throttle_init_device(void) ...@@ -310,7 +309,7 @@ static __init int thermal_throttle_init_device(void)
#endif #endif
/* connect live CPUs to sysfs */ /* connect live CPUs to sysfs */
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu);
WARN_ON(err); WARN_ON(err);
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
......
...@@ -292,8 +292,8 @@ static int reload_for_cpu(int cpu) ...@@ -292,8 +292,8 @@ static int reload_for_cpu(int cpu)
return err; return err;
} }
static ssize_t reload_store(struct sys_device *dev, static ssize_t reload_store(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned long val; unsigned long val;
...@@ -318,30 +318,30 @@ static ssize_t reload_store(struct sys_device *dev, ...@@ -318,30 +318,30 @@ static ssize_t reload_store(struct sys_device *dev,
return ret; return ret;
} }
static ssize_t version_show(struct sys_device *dev, static ssize_t version_show(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
return sprintf(buf, "0x%x\n", uci->cpu_sig.rev); return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
} }
static ssize_t pf_show(struct sys_device *dev, static ssize_t pf_show(struct device *dev,
struct sysdev_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
} }
static SYSDEV_ATTR(reload, 0200, NULL, reload_store); static DEVICE_ATTR(reload, 0200, NULL, reload_store);
static SYSDEV_ATTR(version, 0400, version_show, NULL); static DEVICE_ATTR(version, 0400, version_show, NULL);
static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL); static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
static struct attribute *mc_default_attrs[] = { static struct attribute *mc_default_attrs[] = {
&attr_reload.attr, &dev_attr_reload.attr,
&attr_version.attr, &dev_attr_version.attr,
&attr_processor_flags.attr, &dev_attr_processor_flags.attr,
NULL NULL
}; };
...@@ -405,43 +405,45 @@ static enum ucode_state microcode_update_cpu(int cpu) ...@@ -405,43 +405,45 @@ static enum ucode_state microcode_update_cpu(int cpu)
return ustate; return ustate;
} }
static int mc_sysdev_add(struct sys_device *sys_dev) static int mc_device_add(struct device *dev, struct subsys_interface *sif)
{ {
int err, cpu = sys_dev->id; int err, cpu = dev->id;
if (!cpu_online(cpu)) if (!cpu_online(cpu))
return 0; return 0;
pr_debug("CPU%d added\n", cpu); pr_debug("CPU%d added\n", cpu);
err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); err = sysfs_create_group(&dev->kobj, &mc_attr_group);
if (err) if (err)
return err; return err;
if (microcode_init_cpu(cpu) == UCODE_ERROR) { if (microcode_init_cpu(cpu) == UCODE_ERROR) {
sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); sysfs_remove_group(&dev->kobj, &mc_attr_group);
return -EINVAL; return -EINVAL;
} }
return err; return err;
} }
static int mc_sysdev_remove(struct sys_device *sys_dev) static int mc_device_remove(struct device *dev, struct subsys_interface *sif)
{ {
int cpu = sys_dev->id; int cpu = dev->id;
if (!cpu_online(cpu)) if (!cpu_online(cpu))
return 0; return 0;
pr_debug("CPU%d removed\n", cpu); pr_debug("CPU%d removed\n", cpu);
microcode_fini_cpu(cpu); microcode_fini_cpu(cpu);
sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); sysfs_remove_group(&dev->kobj, &mc_attr_group);
return 0; return 0;
} }
static struct sysdev_driver mc_sysdev_driver = { static struct subsys_interface mc_cpu_interface = {
.add = mc_sysdev_add, .name = "microcode",
.remove = mc_sysdev_remove, .subsys = &cpu_subsys,
.add_dev = mc_device_add,
.remove_dev = mc_device_remove,
}; };
/** /**
...@@ -464,9 +466,9 @@ static __cpuinit int ...@@ -464,9 +466,9 @@ static __cpuinit int
mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *dev;
sys_dev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
...@@ -474,13 +476,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) ...@@ -474,13 +476,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
case CPU_DOWN_FAILED: case CPU_DOWN_FAILED:
case CPU_DOWN_FAILED_FROZEN: case CPU_DOWN_FAILED_FROZEN:
pr_debug("CPU%d added\n", cpu); pr_debug("CPU%d added\n", cpu);
if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) if (sysfs_create_group(&dev->kobj, &mc_attr_group))
pr_err("Failed to create group for CPU%d\n", cpu); pr_err("Failed to create group for CPU%d\n", cpu);
break; break;
case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE:
case CPU_DOWN_PREPARE_FROZEN: case CPU_DOWN_PREPARE_FROZEN:
/* Suspend is in progress, only remove the interface */ /* Suspend is in progress, only remove the interface */
sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); sysfs_remove_group(&dev->kobj, &mc_attr_group);
pr_debug("CPU%d removed\n", cpu); pr_debug("CPU%d removed\n", cpu);
break; break;
...@@ -527,7 +529,7 @@ static int __init microcode_init(void) ...@@ -527,7 +529,7 @@ static int __init microcode_init(void)
get_online_cpus(); get_online_cpus();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver); error = subsys_interface_register(&mc_cpu_interface);
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); put_online_cpus();
...@@ -561,7 +563,7 @@ static void __exit microcode_exit(void) ...@@ -561,7 +563,7 @@ static void __exit microcode_exit(void)
get_online_cpus(); get_online_cpus();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); subsys_interface_unregister(&mc_cpu_interface);
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); put_online_cpus();
......
...@@ -446,7 +446,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) ...@@ -446,7 +446,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
{ {
struct acpi_processor *pr = NULL; struct acpi_processor *pr = NULL;
int result = 0; int result = 0;
struct sys_device *sysdev; struct device *dev;
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
if (!pr) if (!pr)
...@@ -491,8 +491,8 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) ...@@ -491,8 +491,8 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
per_cpu(processors, pr->id) = pr; per_cpu(processors, pr->id) = pr;
sysdev = get_cpu_sysdev(pr->id); dev = get_cpu_device(pr->id);
if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) {
result = -EFAULT; result = -EFAULT;
goto err_free_cpumask; goto err_free_cpumask;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/sysdev.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
/* /*
* drivers/base/cpu.c - basic CPU class support * CPU subsystem support
*/ */
#include <linux/sysdev.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -14,40 +13,40 @@ ...@@ -14,40 +13,40 @@
#include "base.h" #include "base.h"
static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; struct bus_type cpu_subsys = {
struct sysdev_class cpu_sysdev_class = {
.name = "cpu", .name = "cpu",
.attrs = cpu_sysdev_class_attrs, .dev_name = "cpu",
}; };
EXPORT_SYMBOL(cpu_sysdev_class); EXPORT_SYMBOL_GPL(cpu_subsys);
static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, static ssize_t show_online(struct device *dev,
struct device_attribute *attr,
char *buf) char *buf)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id));
} }
static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, static ssize_t __ref store_online(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
ssize_t ret; ssize_t ret;
cpu_hotplug_driver_lock(); cpu_hotplug_driver_lock();
switch (buf[0]) { switch (buf[0]) {
case '0': case '0':
ret = cpu_down(cpu->sysdev.id); ret = cpu_down(cpu->dev.id);
if (!ret) if (!ret)
kobject_uevent(&dev->kobj, KOBJ_OFFLINE); kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
break; break;
case '1': case '1':
ret = cpu_up(cpu->sysdev.id); ret = cpu_up(cpu->dev.id);
if (!ret) if (!ret)
kobject_uevent(&dev->kobj, KOBJ_ONLINE); kobject_uevent(&dev->kobj, KOBJ_ONLINE);
break; break;
...@@ -60,44 +59,44 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut ...@@ -60,44 +59,44 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut
ret = count; ret = count;
return ret; return ret;
} }
static SYSDEV_ATTR(online, 0644, show_online, store_online); static DEVICE_ATTR(online, 0644, show_online, store_online);
static void __cpuinit register_cpu_control(struct cpu *cpu) static void __cpuinit register_cpu_control(struct cpu *cpu)
{ {
sysdev_create_file(&cpu->sysdev, &attr_online); device_create_file(&cpu->dev, &dev_attr_online);
} }
void unregister_cpu(struct cpu *cpu) void unregister_cpu(struct cpu *cpu)
{ {
int logical_cpu = cpu->sysdev.id; int logical_cpu = cpu->dev.id;
unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
sysdev_remove_file(&cpu->sysdev, &attr_online); device_remove_file(&cpu->dev, &dev_attr_online);
sysdev_unregister(&cpu->sysdev); device_unregister(&cpu->dev);
per_cpu(cpu_sys_devices, logical_cpu) = NULL; per_cpu(cpu_sys_devices, logical_cpu) = NULL;
return; return;
} }
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
static ssize_t cpu_probe_store(struct sysdev_class *class, static ssize_t cpu_probe_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
return arch_cpu_probe(buf, count); return arch_cpu_probe(buf, count);
} }
static ssize_t cpu_release_store(struct sysdev_class *class, static ssize_t cpu_release_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
return arch_cpu_release(buf, count); return arch_cpu_release(buf, count);
} }
static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
#else /* ... !CONFIG_HOTPLUG_CPU */ #else /* ... !CONFIG_HOTPLUG_CPU */
...@@ -109,15 +108,15 @@ static inline void register_cpu_control(struct cpu *cpu) ...@@ -109,15 +108,15 @@ static inline void register_cpu_control(struct cpu *cpu)
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
#include <linux/kexec.h> #include <linux/kexec.h>
static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct cpu *cpu = container_of(dev, struct cpu, sysdev); struct cpu *cpu = container_of(dev, struct cpu, dev);
ssize_t rc; ssize_t rc;
unsigned long long addr; unsigned long long addr;
int cpunum; int cpunum;
cpunum = cpu->sysdev.id; cpunum = cpu->dev.id;
/* /*
* Might be reading other cpu's data based on which cpu read thread * Might be reading other cpu's data based on which cpu read thread
...@@ -129,7 +128,7 @@ static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute ...@@ -129,7 +128,7 @@ static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute
rc = sprintf(buf, "%Lx\n", addr); rc = sprintf(buf, "%Lx\n", addr);
return rc; return rc;
} }
static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL);
#endif #endif
/* /*
...@@ -137,12 +136,12 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); ...@@ -137,12 +136,12 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
*/ */
struct cpu_attr { struct cpu_attr {
struct sysdev_class_attribute attr; struct device_attribute attr;
const struct cpumask *const * const map; const struct cpumask *const * const map;
}; };
static ssize_t show_cpus_attr(struct sysdev_class *class, static ssize_t show_cpus_attr(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr); struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
...@@ -154,9 +153,9 @@ static ssize_t show_cpus_attr(struct sysdev_class *class, ...@@ -154,9 +153,9 @@ static ssize_t show_cpus_attr(struct sysdev_class *class,
} }
#define _CPU_ATTR(name, map) \ #define _CPU_ATTR(name, map) \
{ _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map } { __ATTR(name, 0444, show_cpus_attr, NULL), map }
/* Keep in sync with cpu_sysdev_class_attrs */ /* Keep in sync with cpu_subsys_attrs */
static struct cpu_attr cpu_attrs[] = { static struct cpu_attr cpu_attrs[] = {
_CPU_ATTR(online, &cpu_online_mask), _CPU_ATTR(online, &cpu_online_mask),
_CPU_ATTR(possible, &cpu_possible_mask), _CPU_ATTR(possible, &cpu_possible_mask),
...@@ -166,19 +165,19 @@ static struct cpu_attr cpu_attrs[] = { ...@@ -166,19 +165,19 @@ static struct cpu_attr cpu_attrs[] = {
/* /*
* Print values for NR_CPUS and offlined cpus * Print values for NR_CPUS and offlined cpus
*/ */
static ssize_t print_cpus_kernel_max(struct sysdev_class *class, static ssize_t print_cpus_kernel_max(struct device *dev,
struct sysdev_class_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
return n; return n;
} }
static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
unsigned int total_cpus; unsigned int total_cpus;
static ssize_t print_cpus_offline(struct sysdev_class *class, static ssize_t print_cpus_offline(struct device *dev,
struct sysdev_class_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int n = 0, len = PAGE_SIZE-2; int n = 0, len = PAGE_SIZE-2;
cpumask_var_t offline; cpumask_var_t offline;
...@@ -205,7 +204,7 @@ static ssize_t print_cpus_offline(struct sysdev_class *class, ...@@ -205,7 +204,7 @@ static ssize_t print_cpus_offline(struct sysdev_class *class,
n += snprintf(&buf[n], len - n, "\n"); n += snprintf(&buf[n], len - n, "\n");
return n; return n;
} }
static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
/* /*
* register_cpu - Setup a sysfs device for a CPU. * register_cpu - Setup a sysfs device for a CPU.
...@@ -218,57 +217,66 @@ static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); ...@@ -218,57 +217,66 @@ static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL);
int __cpuinit register_cpu(struct cpu *cpu, int num) int __cpuinit register_cpu(struct cpu *cpu, int num)
{ {
int error; int error;
cpu->node_id = cpu_to_node(num);
cpu->sysdev.id = num;
cpu->sysdev.cls = &cpu_sysdev_class;
error = sysdev_register(&cpu->sysdev);
cpu->node_id = cpu_to_node(num);
cpu->dev.id = num;
cpu->dev.bus = &cpu_subsys;
error = device_register(&cpu->dev);
if (!error && cpu->hotpluggable) if (!error && cpu->hotpluggable)
register_cpu_control(cpu); register_cpu_control(cpu);
if (!error) if (!error)
per_cpu(cpu_sys_devices, num) = &cpu->sysdev; per_cpu(cpu_sys_devices, num) = &cpu->dev;
if (!error) if (!error)
register_cpu_under_node(num, cpu_to_node(num)); register_cpu_under_node(num, cpu_to_node(num));
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
if (!error) if (!error)
error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); error = device_create_file(&cpu->dev, &dev_attr_crash_notes);
#endif #endif
return error; return error;
} }
struct sys_device *get_cpu_sysdev(unsigned cpu) struct device *get_cpu_device(unsigned cpu)
{ {
if (cpu < nr_cpu_ids && cpu_possible(cpu)) if (cpu < nr_cpu_ids && cpu_possible(cpu))
return per_cpu(cpu_sys_devices, cpu); return per_cpu(cpu_sys_devices, cpu);
else else
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(get_cpu_sysdev); EXPORT_SYMBOL_GPL(get_cpu_device);
static struct attribute *cpu_root_attrs[] = {
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
&dev_attr_probe.attr,
&dev_attr_release.attr,
#endif
&cpu_attrs[0].attr.attr,
&cpu_attrs[1].attr.attr,
&cpu_attrs[2].attr.attr,
&dev_attr_kernel_max.attr,
&dev_attr_offline.attr,
NULL
};
static struct attribute_group cpu_root_attr_group = {
.attrs = cpu_root_attrs,
};
static const struct attribute_group *cpu_root_attr_groups[] = {
&cpu_root_attr_group,
NULL,
};
int __init cpu_dev_init(void) int __init cpu_dev_init(void)
{ {
int err; int err;
err = sysdev_class_register(&cpu_sysdev_class); err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups);
if (err)
return err;
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
if (!err) err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
#endif #endif
return err; return err;
} }
static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = {
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
&attr_probe,
&attr_release,
#endif
&cpu_attrs[0].attr,
&cpu_attrs[1].attr,
&cpu_attrs[2].attr,
&attr_kernel_max,
&attr_offline,
NULL
};
...@@ -315,12 +315,12 @@ struct node node_devices[MAX_NUMNODES]; ...@@ -315,12 +315,12 @@ struct node node_devices[MAX_NUMNODES];
int register_cpu_under_node(unsigned int cpu, unsigned int nid) int register_cpu_under_node(unsigned int cpu, unsigned int nid)
{ {
int ret; int ret;
struct sys_device *obj; struct device *obj;
if (!node_online(nid)) if (!node_online(nid))
return 0; return 0;
obj = get_cpu_sysdev(cpu); obj = get_cpu_device(cpu);
if (!obj) if (!obj)
return 0; return 0;
...@@ -337,12 +337,12 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid) ...@@ -337,12 +337,12 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid)
int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
{ {
struct sys_device *obj; struct device *obj;
if (!node_online(nid)) if (!node_online(nid))
return 0; return 0;
obj = get_cpu_sysdev(cpu); obj = get_cpu_device(cpu);
if (!obj) if (!obj)
return 0; return 0;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
*/ */
#include <linux/sysdev.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/cpu.h> #include <linux/cpu.h>
...@@ -32,14 +31,14 @@ ...@@ -32,14 +31,14 @@
#include <linux/topology.h> #include <linux/topology.h>
#define define_one_ro_named(_name, _func) \ #define define_one_ro_named(_name, _func) \
static SYSDEV_ATTR(_name, 0444, _func, NULL) static DEVICE_ATTR(_name, 0444, _func, NULL)
#define define_one_ro(_name) \ #define define_one_ro(_name) \
static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) static DEVICE_ATTR(_name, 0444, show_##_name, NULL)
#define define_id_show_func(name) \ #define define_id_show_func(name) \
static ssize_t show_##name(struct sys_device *dev, \ static ssize_t show_##name(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
unsigned int cpu = dev->id; \ unsigned int cpu = dev->id; \
return sprintf(buf, "%d\n", topology_##name(cpu)); \ return sprintf(buf, "%d\n", topology_##name(cpu)); \
...@@ -65,16 +64,16 @@ static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf) ...@@ -65,16 +64,16 @@ static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf)
#ifdef arch_provides_topology_pointers #ifdef arch_provides_topology_pointers
#define define_siblings_show_map(name) \ #define define_siblings_show_map(name) \
static ssize_t show_##name(struct sys_device *dev, \ static ssize_t show_##name(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
unsigned int cpu = dev->id; \ unsigned int cpu = dev->id; \
return show_cpumap(0, topology_##name(cpu), buf); \ return show_cpumap(0, topology_##name(cpu), buf); \
} }
#define define_siblings_show_list(name) \ #define define_siblings_show_list(name) \
static ssize_t show_##name##_list(struct sys_device *dev, \ static ssize_t show_##name##_list(struct device *dev, \
struct sysdev_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
unsigned int cpu = dev->id; \ unsigned int cpu = dev->id; \
...@@ -83,15 +82,15 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ ...@@ -83,15 +82,15 @@ static ssize_t show_##name##_list(struct sys_device *dev, \
#else #else
#define define_siblings_show_map(name) \ #define define_siblings_show_map(name) \
static ssize_t show_##name(struct sys_device *dev, \ static ssize_t show_##name(struct device *dev, \
struct sysdev_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
return show_cpumap(0, topology_##name(dev->id), buf); \ return show_cpumap(0, topology_##name(dev->id), buf); \
} }
#define define_siblings_show_list(name) \ #define define_siblings_show_list(name) \
static ssize_t show_##name##_list(struct sys_device *dev, \ static ssize_t show_##name##_list(struct device *dev, \
struct sysdev_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
return show_cpumap(1, topology_##name(dev->id), buf); \ return show_cpumap(1, topology_##name(dev->id), buf); \
...@@ -124,16 +123,16 @@ define_one_ro_named(book_siblings_list, show_book_cpumask_list); ...@@ -124,16 +123,16 @@ define_one_ro_named(book_siblings_list, show_book_cpumask_list);
#endif #endif
static struct attribute *default_attrs[] = { static struct attribute *default_attrs[] = {
&attr_physical_package_id.attr, &dev_attr_physical_package_id.attr,
&attr_core_id.attr, &dev_attr_core_id.attr,
&attr_thread_siblings.attr, &dev_attr_thread_siblings.attr,
&attr_thread_siblings_list.attr, &dev_attr_thread_siblings_list.attr,
&attr_core_siblings.attr, &dev_attr_core_siblings.attr,
&attr_core_siblings_list.attr, &dev_attr_core_siblings_list.attr,
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
&attr_book_id.attr, &dev_attr_book_id.attr,
&attr_book_siblings.attr, &dev_attr_book_siblings.attr,
&attr_book_siblings_list.attr, &dev_attr_book_siblings_list.attr,
#endif #endif
NULL NULL
}; };
...@@ -146,16 +145,16 @@ static struct attribute_group topology_attr_group = { ...@@ -146,16 +145,16 @@ static struct attribute_group topology_attr_group = {
/* Add/Remove cpu_topology interface for CPU device */ /* Add/Remove cpu_topology interface for CPU device */
static int __cpuinit topology_add_dev(unsigned int cpu) static int __cpuinit topology_add_dev(unsigned int cpu)
{ {
struct sys_device *sys_dev = get_cpu_sysdev(cpu); struct device *dev = get_cpu_device(cpu);
return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); return sysfs_create_group(&dev->kobj, &topology_attr_group);
} }
static void __cpuinit topology_remove_dev(unsigned int cpu) static void __cpuinit topology_remove_dev(unsigned int cpu)
{ {
struct sys_device *sys_dev = get_cpu_sysdev(cpu); struct device *dev = get_cpu_device(cpu);
sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); sysfs_remove_group(&dev->kobj, &topology_attr_group);
} }
static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,
......
...@@ -679,7 +679,7 @@ static struct kobj_type ktype_cpufreq = { ...@@ -679,7 +679,7 @@ static struct kobj_type ktype_cpufreq = {
*/ */
static int cpufreq_add_dev_policy(unsigned int cpu, static int cpufreq_add_dev_policy(unsigned int cpu,
struct cpufreq_policy *policy, struct cpufreq_policy *policy,
struct sys_device *sys_dev) struct device *dev)
{ {
int ret = 0; int ret = 0;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -728,7 +728,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu, ...@@ -728,7 +728,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu,
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
pr_debug("CPU already managed, adding link\n"); pr_debug("CPU already managed, adding link\n");
ret = sysfs_create_link(&sys_dev->kobj, ret = sysfs_create_link(&dev->kobj,
&managed_policy->kobj, &managed_policy->kobj,
"cpufreq"); "cpufreq");
if (ret) if (ret)
...@@ -761,7 +761,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, ...@@ -761,7 +761,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
for_each_cpu(j, policy->cpus) { for_each_cpu(j, policy->cpus) {
struct cpufreq_policy *managed_policy; struct cpufreq_policy *managed_policy;
struct sys_device *cpu_sys_dev; struct device *cpu_dev;
if (j == cpu) if (j == cpu)
continue; continue;
...@@ -770,8 +770,8 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, ...@@ -770,8 +770,8 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
pr_debug("CPU %u already managed, adding link\n", j); pr_debug("CPU %u already managed, adding link\n", j);
managed_policy = cpufreq_cpu_get(cpu); managed_policy = cpufreq_cpu_get(cpu);
cpu_sys_dev = get_cpu_sysdev(j); cpu_dev = get_cpu_device(j);
ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
"cpufreq"); "cpufreq");
if (ret) { if (ret) {
cpufreq_cpu_put(managed_policy); cpufreq_cpu_put(managed_policy);
...@@ -783,7 +783,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, ...@@ -783,7 +783,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
static int cpufreq_add_dev_interface(unsigned int cpu, static int cpufreq_add_dev_interface(unsigned int cpu,
struct cpufreq_policy *policy, struct cpufreq_policy *policy,
struct sys_device *sys_dev) struct device *dev)
{ {
struct cpufreq_policy new_policy; struct cpufreq_policy new_policy;
struct freq_attr **drv_attr; struct freq_attr **drv_attr;
...@@ -793,7 +793,7 @@ static int cpufreq_add_dev_interface(unsigned int cpu, ...@@ -793,7 +793,7 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
/* prepare interface data */ /* prepare interface data */
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
&sys_dev->kobj, "cpufreq"); &dev->kobj, "cpufreq");
if (ret) if (ret)
return ret; return ret;
...@@ -866,9 +866,9 @@ static int cpufreq_add_dev_interface(unsigned int cpu, ...@@ -866,9 +866,9 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
* with with cpu hotplugging and all hell will break loose. Tried to clean this * with with cpu hotplugging and all hell will break loose. Tried to clean this
* mess up, but more thorough testing is needed. - Mathieu * mess up, but more thorough testing is needed. - Mathieu
*/ */
static int cpufreq_add_dev(struct sys_device *sys_dev) static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = dev->id;
int ret = 0, found = 0; int ret = 0, found = 0;
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
unsigned long flags; unsigned long flags;
...@@ -947,7 +947,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -947,7 +947,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
blocking_notifier_call_chain(&cpufreq_policy_notifier_list, blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy); CPUFREQ_START, policy);
ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); ret = cpufreq_add_dev_policy(cpu, policy, dev);
if (ret) { if (ret) {
if (ret > 0) if (ret > 0)
/* This is a managed cpu, symlink created, /* This is a managed cpu, symlink created,
...@@ -956,7 +956,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -956,7 +956,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
goto err_unlock_policy; goto err_unlock_policy;
} }
ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); ret = cpufreq_add_dev_interface(cpu, policy, dev);
if (ret) if (ret)
goto err_out_unregister; goto err_out_unregister;
...@@ -999,15 +999,15 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -999,15 +999,15 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
* Caller should already have policy_rwsem in write mode for this CPU. * Caller should already have policy_rwsem in write mode for this CPU.
* This routine frees the rwsem before returning. * This routine frees the rwsem before returning.
*/ */
static int __cpufreq_remove_dev(struct sys_device *sys_dev) static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = dev->id;
unsigned long flags; unsigned long flags;
struct cpufreq_policy *data; struct cpufreq_policy *data;
struct kobject *kobj; struct kobject *kobj;
struct completion *cmp; struct completion *cmp;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct sys_device *cpu_sys_dev; struct device *cpu_dev;
unsigned int j; unsigned int j;
#endif #endif
...@@ -1032,7 +1032,7 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1032,7 +1032,7 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
pr_debug("removing link\n"); pr_debug("removing link\n");
cpumask_clear_cpu(cpu, data->cpus); cpumask_clear_cpu(cpu, data->cpus);
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
kobj = &sys_dev->kobj; kobj = &dev->kobj;
cpufreq_cpu_put(data); cpufreq_cpu_put(data);
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
sysfs_remove_link(kobj, "cpufreq"); sysfs_remove_link(kobj, "cpufreq");
...@@ -1071,8 +1071,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1071,8 +1071,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
strncpy(per_cpu(cpufreq_cpu_governor, j), strncpy(per_cpu(cpufreq_cpu_governor, j),
data->governor->name, CPUFREQ_NAME_LEN); data->governor->name, CPUFREQ_NAME_LEN);
#endif #endif
cpu_sys_dev = get_cpu_sysdev(j); cpu_dev = get_cpu_device(j);
kobj = &cpu_sys_dev->kobj; kobj = &cpu_dev->kobj;
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
sysfs_remove_link(kobj, "cpufreq"); sysfs_remove_link(kobj, "cpufreq");
lock_policy_rwsem_write(cpu); lock_policy_rwsem_write(cpu);
...@@ -1112,11 +1112,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1112,11 +1112,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
if (unlikely(cpumask_weight(data->cpus) > 1)) { if (unlikely(cpumask_weight(data->cpus) > 1)) {
/* first sibling now owns the new sysfs dir */ /* first sibling now owns the new sysfs dir */
cpumask_clear_cpu(cpu, data->cpus); cpumask_clear_cpu(cpu, data->cpus);
cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); cpufreq_add_dev(get_cpu_device(cpumask_first(data->cpus)), NULL);
/* finally remove our own symlink */ /* finally remove our own symlink */
lock_policy_rwsem_write(cpu); lock_policy_rwsem_write(cpu);
__cpufreq_remove_dev(sys_dev); __cpufreq_remove_dev(dev, sif);
} }
#endif #endif
...@@ -1128,9 +1128,9 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1128,9 +1128,9 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
} }
static int cpufreq_remove_dev(struct sys_device *sys_dev) static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
{ {
unsigned int cpu = sys_dev->id; unsigned int cpu = dev->id;
int retval; int retval;
if (cpu_is_offline(cpu)) if (cpu_is_offline(cpu))
...@@ -1139,7 +1139,7 @@ static int cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1139,7 +1139,7 @@ static int cpufreq_remove_dev(struct sys_device *sys_dev)
if (unlikely(lock_policy_rwsem_write(cpu))) if (unlikely(lock_policy_rwsem_write(cpu)))
BUG(); BUG();
retval = __cpufreq_remove_dev(sys_dev); retval = __cpufreq_remove_dev(dev, sif);
return retval; return retval;
} }
...@@ -1271,9 +1271,11 @@ unsigned int cpufreq_get(unsigned int cpu) ...@@ -1271,9 +1271,11 @@ unsigned int cpufreq_get(unsigned int cpu)
} }
EXPORT_SYMBOL(cpufreq_get); EXPORT_SYMBOL(cpufreq_get);
static struct sysdev_driver cpufreq_sysdev_driver = { static struct subsys_interface cpufreq_interface = {
.add = cpufreq_add_dev, .name = "cpufreq",
.remove = cpufreq_remove_dev, .subsys = &cpu_subsys,
.add_dev = cpufreq_add_dev,
.remove_dev = cpufreq_remove_dev,
}; };
...@@ -1765,25 +1767,25 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, ...@@ -1765,25 +1767,25 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct sys_device *sys_dev; struct device *dev;
sys_dev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
if (sys_dev) { if (dev) {
switch (action) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
cpufreq_add_dev(sys_dev); cpufreq_add_dev(dev, NULL);
break; break;
case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE:
case CPU_DOWN_PREPARE_FROZEN: case CPU_DOWN_PREPARE_FROZEN:
if (unlikely(lock_policy_rwsem_write(cpu))) if (unlikely(lock_policy_rwsem_write(cpu)))
BUG(); BUG();
__cpufreq_remove_dev(sys_dev); __cpufreq_remove_dev(dev, NULL);
break; break;
case CPU_DOWN_FAILED: case CPU_DOWN_FAILED:
case CPU_DOWN_FAILED_FROZEN: case CPU_DOWN_FAILED_FROZEN:
cpufreq_add_dev(sys_dev); cpufreq_add_dev(dev, NULL);
break; break;
} }
} }
...@@ -1830,8 +1832,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ...@@ -1830,8 +1832,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
cpufreq_driver = driver_data; cpufreq_driver = driver_data;
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
ret = sysdev_driver_register(&cpu_sysdev_class, ret = subsys_interface_register(&cpufreq_interface);
&cpufreq_sysdev_driver);
if (ret) if (ret)
goto err_null_driver; goto err_null_driver;
...@@ -1850,7 +1851,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ...@@ -1850,7 +1851,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
if (ret) { if (ret) {
pr_debug("no CPU initialized for driver %s\n", pr_debug("no CPU initialized for driver %s\n",
driver_data->name); driver_data->name);
goto err_sysdev_unreg; goto err_if_unreg;
} }
} }
...@@ -1858,9 +1859,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ...@@ -1858,9 +1859,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
pr_debug("driver %s up and running\n", driver_data->name); pr_debug("driver %s up and running\n", driver_data->name);
return 0; return 0;
err_sysdev_unreg: err_if_unreg:
sysdev_driver_unregister(&cpu_sysdev_class, subsys_interface_unregister(&cpufreq_interface);
&cpufreq_sysdev_driver);
err_null_driver: err_null_driver:
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
cpufreq_driver = NULL; cpufreq_driver = NULL;
...@@ -1887,7 +1887,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) ...@@ -1887,7 +1887,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
pr_debug("unregistering driver %s\n", driver->name); pr_debug("unregistering driver %s\n", driver->name);
sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); subsys_interface_unregister(&cpufreq_interface);
unregister_hotcpu_notifier(&cpufreq_cpu_notifier); unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
...@@ -1907,8 +1907,7 @@ static int __init cpufreq_core_init(void) ...@@ -1907,8 +1907,7 @@ static int __init cpufreq_core_init(void)
init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));
} }
cpufreq_global_kobject = kobject_create_and_add("cpufreq", cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
&cpu_sysdev_class.kset.kobj);
BUG_ON(!cpufreq_global_kobject); BUG_ON(!cpufreq_global_kobject);
register_syscore_ops(&cpufreq_syscore_ops); register_syscore_ops(&cpufreq_syscore_ops);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sysdev.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
......
...@@ -291,10 +291,10 @@ EXPORT_SYMBOL_GPL(cpuidle_disable_device); ...@@ -291,10 +291,10 @@ EXPORT_SYMBOL_GPL(cpuidle_disable_device);
static int __cpuidle_register_device(struct cpuidle_device *dev) static int __cpuidle_register_device(struct cpuidle_device *dev)
{ {
int ret; int ret;
struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
if (!sys_dev) if (!dev)
return -EINVAL; return -EINVAL;
if (!try_module_get(cpuidle_driver->owner)) if (!try_module_get(cpuidle_driver->owner))
return -EINVAL; return -EINVAL;
...@@ -303,7 +303,7 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) ...@@ -303,7 +303,7 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
per_cpu(cpuidle_devices, dev->cpu) = dev; per_cpu(cpuidle_devices, dev->cpu) = dev;
list_add(&dev->device_list, &cpuidle_detected_devices); list_add(&dev->device_list, &cpuidle_detected_devices);
if ((ret = cpuidle_add_sysfs(sys_dev))) { if ((ret = cpuidle_add_sysfs(cpu_dev))) {
module_put(cpuidle_driver->owner); module_put(cpuidle_driver->owner);
return ret; return ret;
} }
...@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device); ...@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device);
*/ */
void cpuidle_unregister_device(struct cpuidle_device *dev) void cpuidle_unregister_device(struct cpuidle_device *dev)
{ {
struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
if (dev->registered == 0) if (dev->registered == 0)
...@@ -354,7 +354,7 @@ void cpuidle_unregister_device(struct cpuidle_device *dev) ...@@ -354,7 +354,7 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
cpuidle_disable_device(dev); cpuidle_disable_device(dev);
cpuidle_remove_sysfs(sys_dev); cpuidle_remove_sysfs(cpu_dev);
list_del(&dev->device_list); list_del(&dev->device_list);
wait_for_completion(&dev->kobj_unregister); wait_for_completion(&dev->kobj_unregister);
per_cpu(cpuidle_devices, dev->cpu) = NULL; per_cpu(cpuidle_devices, dev->cpu) = NULL;
...@@ -411,7 +411,7 @@ static int __init cpuidle_init(void) ...@@ -411,7 +411,7 @@ static int __init cpuidle_init(void)
if (cpuidle_disabled()) if (cpuidle_disabled())
return -ENODEV; return -ENODEV;
ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); ret = cpuidle_add_interface(cpu_subsys.dev_root);
if (ret) if (ret)
return ret; return ret;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef __DRIVER_CPUIDLE_H #ifndef __DRIVER_CPUIDLE_H
#define __DRIVER_CPUIDLE_H #define __DRIVER_CPUIDLE_H
#include <linux/sysdev.h> #include <linux/device.h>
/* For internal use only */ /* For internal use only */
extern struct cpuidle_governor *cpuidle_curr_governor; extern struct cpuidle_governor *cpuidle_curr_governor;
...@@ -23,11 +23,11 @@ extern void cpuidle_uninstall_idle_handler(void); ...@@ -23,11 +23,11 @@ extern void cpuidle_uninstall_idle_handler(void);
extern int cpuidle_switch_governor(struct cpuidle_governor *gov); extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
/* sysfs */ /* sysfs */
extern int cpuidle_add_class_sysfs(struct sysdev_class *cls); extern int cpuidle_add_interface(struct device *dev);
extern void cpuidle_remove_class_sysfs(struct sysdev_class *cls); extern void cpuidle_remove_interface(struct device *dev);
extern int cpuidle_add_state_sysfs(struct cpuidle_device *device); extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device); extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
extern int cpuidle_add_sysfs(struct sys_device *sysdev); extern int cpuidle_add_sysfs(struct device *dev);
extern void cpuidle_remove_sysfs(struct sys_device *sysdev); extern void cpuidle_remove_sysfs(struct device *dev);
#endif /* __DRIVER_CPUIDLE_H */ #endif /* __DRIVER_CPUIDLE_H */
...@@ -22,8 +22,8 @@ static int __init cpuidle_sysfs_setup(char *unused) ...@@ -22,8 +22,8 @@ static int __init cpuidle_sysfs_setup(char *unused)
} }
__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
static ssize_t show_available_governors(struct sysdev_class *class, static ssize_t show_available_governors(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
ssize_t i = 0; ssize_t i = 0;
...@@ -42,8 +42,8 @@ static ssize_t show_available_governors(struct sysdev_class *class, ...@@ -42,8 +42,8 @@ static ssize_t show_available_governors(struct sysdev_class *class,
return i; return i;
} }
static ssize_t show_current_driver(struct sysdev_class *class, static ssize_t show_current_driver(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
ssize_t ret; ssize_t ret;
...@@ -59,8 +59,8 @@ static ssize_t show_current_driver(struct sysdev_class *class, ...@@ -59,8 +59,8 @@ static ssize_t show_current_driver(struct sysdev_class *class,
return ret; return ret;
} }
static ssize_t show_current_governor(struct sysdev_class *class, static ssize_t show_current_governor(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
ssize_t ret; ssize_t ret;
...@@ -75,8 +75,8 @@ static ssize_t show_current_governor(struct sysdev_class *class, ...@@ -75,8 +75,8 @@ static ssize_t show_current_governor(struct sysdev_class *class,
return ret; return ret;
} }
static ssize_t store_current_governor(struct sysdev_class *class, static ssize_t store_current_governor(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
char gov_name[CPUIDLE_NAME_LEN]; char gov_name[CPUIDLE_NAME_LEN];
...@@ -109,50 +109,48 @@ static ssize_t store_current_governor(struct sysdev_class *class, ...@@ -109,50 +109,48 @@ static ssize_t store_current_governor(struct sysdev_class *class,
return count; return count;
} }
static SYSDEV_CLASS_ATTR(current_driver, 0444, show_current_driver, NULL); static DEVICE_ATTR(current_driver, 0444, show_current_driver, NULL);
static SYSDEV_CLASS_ATTR(current_governor_ro, 0444, show_current_governor, static DEVICE_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
NULL);
static struct attribute *cpuclass_default_attrs[] = { static struct attribute *cpuidle_default_attrs[] = {
&attr_current_driver.attr, &dev_attr_current_driver.attr,
&attr_current_governor_ro.attr, &dev_attr_current_governor_ro.attr,
NULL NULL
}; };
static SYSDEV_CLASS_ATTR(available_governors, 0444, show_available_governors, static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL);
NULL); static DEVICE_ATTR(current_governor, 0644, show_current_governor,
static SYSDEV_CLASS_ATTR(current_governor, 0644, show_current_governor,
store_current_governor); store_current_governor);
static struct attribute *cpuclass_switch_attrs[] = { static struct attribute *cpuidle_switch_attrs[] = {
&attr_available_governors.attr, &dev_attr_available_governors.attr,
&attr_current_driver.attr, &dev_attr_current_driver.attr,
&attr_current_governor.attr, &dev_attr_current_governor.attr,
NULL NULL
}; };
static struct attribute_group cpuclass_attr_group = { static struct attribute_group cpuidle_attr_group = {
.attrs = cpuclass_default_attrs, .attrs = cpuidle_default_attrs,
.name = "cpuidle", .name = "cpuidle",
}; };
/** /**
* cpuidle_add_class_sysfs - add CPU global sysfs attributes * cpuidle_add_interface - add CPU global sysfs attributes
*/ */
int cpuidle_add_class_sysfs(struct sysdev_class *cls) int cpuidle_add_interface(struct device *dev)
{ {
if (sysfs_switch) if (sysfs_switch)
cpuclass_attr_group.attrs = cpuclass_switch_attrs; cpuidle_attr_group.attrs = cpuidle_switch_attrs;
return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group); return sysfs_create_group(&dev->kobj, &cpuidle_attr_group);
} }
/** /**
* cpuidle_remove_class_sysfs - remove CPU global sysfs attributes * cpuidle_remove_interface - remove CPU global sysfs attributes
*/ */
void cpuidle_remove_class_sysfs(struct sysdev_class *cls) void cpuidle_remove_interface(struct device *dev)
{ {
sysfs_remove_group(&cls->kset.kobj, &cpuclass_attr_group); sysfs_remove_group(&dev->kobj, &cpuidle_attr_group);
} }
struct cpuidle_attr { struct cpuidle_attr {
...@@ -365,16 +363,16 @@ void cpuidle_remove_state_sysfs(struct cpuidle_device *device) ...@@ -365,16 +363,16 @@ void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
/** /**
* cpuidle_add_sysfs - creates a sysfs instance for the target device * cpuidle_add_sysfs - creates a sysfs instance for the target device
* @sysdev: the target device * @dev: the target device
*/ */
int cpuidle_add_sysfs(struct sys_device *sysdev) int cpuidle_add_sysfs(struct device *cpu_dev)
{ {
int cpu = sysdev->id; int cpu = cpu_dev->id;
struct cpuidle_device *dev; struct cpuidle_device *dev;
int error; int error;
dev = per_cpu(cpuidle_devices, cpu); dev = per_cpu(cpuidle_devices, cpu);
error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj,
"cpuidle"); "cpuidle");
if (!error) if (!error)
kobject_uevent(&dev->kobj, KOBJ_ADD); kobject_uevent(&dev->kobj, KOBJ_ADD);
...@@ -383,11 +381,11 @@ int cpuidle_add_sysfs(struct sys_device *sysdev) ...@@ -383,11 +381,11 @@ int cpuidle_add_sysfs(struct sys_device *sysdev)
/** /**
* cpuidle_remove_sysfs - deletes a sysfs instance on the target device * cpuidle_remove_sysfs - deletes a sysfs instance on the target device
* @sysdev: the target device * @dev: the target device
*/ */
void cpuidle_remove_sysfs(struct sys_device *sysdev) void cpuidle_remove_sysfs(struct device *cpu_dev)
{ {
int cpu = sysdev->id; int cpu = cpu_dev->id;
struct cpuidle_device *dev; struct cpuidle_device *dev;
dev = per_cpu(cpuidle_devices, cpu); dev = per_cpu(cpuidle_devices, cpu);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <asm/smp.h> #include <asm/smp.h>
...@@ -31,14 +31,14 @@ static struct work_struct sclp_cpu_change_work; ...@@ -31,14 +31,14 @@ static struct work_struct sclp_cpu_change_work;
static void sclp_cpu_capability_notify(struct work_struct *work) static void sclp_cpu_capability_notify(struct work_struct *work)
{ {
int cpu; int cpu;
struct sys_device *sysdev; struct device *dev;
s390_adjust_jiffies(); s390_adjust_jiffies();
pr_warning("cpu capability changed.\n"); pr_warning("cpu capability changed.\n");
get_online_cpus(); get_online_cpus();
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
sysdev = get_cpu_sysdev(cpu); dev = get_cpu_device(cpu);
kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); kobject_uevent(&dev->kobj, KOBJ_CHANGE);
} }
put_online_cpus(); put_online_cpus();
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#ifndef _LINUX_CPU_H_ #ifndef _LINUX_CPU_H_
#define _LINUX_CPU_H_ #define _LINUX_CPU_H_
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/node.h> #include <linux/node.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
...@@ -22,19 +22,19 @@ ...@@ -22,19 +22,19 @@
struct cpu { struct cpu {
int node_id; /* The node which contains the CPU */ int node_id; /* The node which contains the CPU */
int hotpluggable; /* creates sysfs control file if hotpluggable */ int hotpluggable; /* creates sysfs control file if hotpluggable */
struct sys_device sysdev; struct device dev;
}; };
extern int register_cpu(struct cpu *cpu, int num); extern int register_cpu(struct cpu *cpu, int num);
extern struct sys_device *get_cpu_sysdev(unsigned cpu); extern struct device *get_cpu_device(unsigned cpu);
extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); extern int cpu_add_dev_attr(struct device_attribute *attr);
extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); extern void cpu_remove_dev_attr(struct device_attribute *attr);
extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); extern int sched_create_sysfs_power_savings_entries(struct device *dev);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
extern void unregister_cpu(struct cpu *cpu); extern void unregister_cpu(struct cpu *cpu);
...@@ -160,7 +160,7 @@ static inline void cpu_maps_update_done(void) ...@@ -160,7 +160,7 @@ static inline void cpu_maps_update_done(void)
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
extern struct sysdev_class cpu_sysdev_class; extern struct bus_type cpu_subsys;
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
/* Stop CPUs going up and down. */ /* Stop CPUs going up and down. */
......
...@@ -7923,54 +7923,52 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) ...@@ -7923,54 +7923,52 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
} }
#ifdef CONFIG_SCHED_MC #ifdef CONFIG_SCHED_MC
static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, static ssize_t sched_mc_power_savings_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *buf)
{ {
return sprintf(page, "%u\n", sched_mc_power_savings); return sprintf(buf, "%u\n", sched_mc_power_savings);
} }
static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, static ssize_t sched_mc_power_savings_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
return sched_power_savings_store(buf, count, 0); return sched_power_savings_store(buf, count, 0);
} }
static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, static DEVICE_ATTR(sched_mc_power_savings, 0644,
sched_mc_power_savings_show, sched_mc_power_savings_show,
sched_mc_power_savings_store); sched_mc_power_savings_store);
#endif #endif
#ifdef CONFIG_SCHED_SMT #ifdef CONFIG_SCHED_SMT
static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, static ssize_t sched_smt_power_savings_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *page) char *buf)
{ {
return sprintf(page, "%u\n", sched_smt_power_savings); return sprintf(buf, "%u\n", sched_smt_power_savings);
} }
static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, static ssize_t sched_smt_power_savings_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
return sched_power_savings_store(buf, count, 1); return sched_power_savings_store(buf, count, 1);
} }
static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, static DEVICE_ATTR(sched_smt_power_savings, 0644,
sched_smt_power_savings_show, sched_smt_power_savings_show,
sched_smt_power_savings_store); sched_smt_power_savings_store);
#endif #endif
int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) int __init sched_create_sysfs_power_savings_entries(struct device *dev)
{ {
int err = 0; int err = 0;
#ifdef CONFIG_SCHED_SMT #ifdef CONFIG_SCHED_SMT
if (smt_capable()) if (smt_capable())
err = sysfs_create_file(&cls->kset.kobj, err = device_create_file(dev, &dev_attr_sched_smt_power_savings);
&attr_sched_smt_power_savings.attr);
#endif #endif
#ifdef CONFIG_SCHED_MC #ifdef CONFIG_SCHED_MC
if (!err && mc_capable()) if (!err && mc_capable())
err = sysfs_create_file(&cls->kset.kobj, err = device_create_file(dev, &dev_attr_sched_mc_power_savings);
&attr_sched_mc_power_savings.attr);
#endif #endif
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment