Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Kay Sievers and committed by
Greg Kroah-Hartman
8a25a2fd cb0c05c5

+875 -878
+37 -37
arch/avr32/kernel/cpu.c
··· 6 6 * published by the Free Software Foundation. 7 7 */ 8 8 #include <linux/init.h> 9 - #include <linux/sysdev.h> 9 + #include <linux/device.h> 10 10 #include <linux/seq_file.h> 11 11 #include <linux/cpu.h> 12 12 #include <linux/module.h> ··· 26 26 * XXX: If/when a SMP-capable implementation of AVR32 will ever be 27 27 * made, we must make sure that the code executes on the correct CPU. 28 28 */ 29 - static ssize_t show_pc0event(struct sys_device *dev, 30 - struct sysdev_attribute *attr, char *buf) 29 + static ssize_t show_pc0event(struct device *dev, 30 + struct device_attribute *attr, char *buf) 31 31 { 32 32 unsigned long pccr; 33 33 34 34 pccr = sysreg_read(PCCR); 35 35 return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); 36 36 } 37 - static ssize_t store_pc0event(struct sys_device *dev, 38 - struct sysdev_attribute *attr, const char *buf, 37 + static ssize_t store_pc0event(struct device *dev, 38 + struct device_attribute *attr, const char *buf, 39 39 size_t count) 40 40 { 41 41 unsigned long val; ··· 48 48 sysreg_write(PCCR, val); 49 49 return count; 50 50 } 51 - static ssize_t show_pc0count(struct sys_device *dev, 52 - struct sysdev_attribute *attr, char *buf) 51 + static ssize_t show_pc0count(struct device *dev, 52 + struct device_attribute *attr, char *buf) 53 53 { 54 54 unsigned long pcnt0; 55 55 56 56 pcnt0 = sysreg_read(PCNT0); 57 57 return sprintf(buf, "%lu\n", pcnt0); 58 58 } 59 - static ssize_t store_pc0count(struct sys_device *dev, 60 - struct sysdev_attribute *attr, 59 + static ssize_t store_pc0count(struct device *dev, 60 + struct device_attribute *attr, 61 61 const char *buf, size_t count) 62 62 { 63 63 unsigned long val; ··· 71 71 return count; 72 72 } 73 73 74 - static ssize_t show_pc1event(struct sys_device *dev, 75 - struct sysdev_attribute *attr, char *buf) 74 + static ssize_t show_pc1event(struct device *dev, 75 + struct device_attribute *attr, char *buf) 76 76 { 77 77 unsigned long pccr; 78 78 79 79 pccr = sysreg_read(PCCR); 80 80 return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); 81 81 } 82 - static ssize_t store_pc1event(struct sys_device *dev, 83 - struct sysdev_attribute *attr, const char *buf, 82 + static ssize_t store_pc1event(struct device *dev, 83 + struct device_attribute *attr, const char *buf, 84 84 size_t count) 85 85 { 86 86 unsigned long val; ··· 93 93 sysreg_write(PCCR, val); 94 94 return count; 95 95 } 96 - static ssize_t show_pc1count(struct sys_device *dev, 97 - struct sysdev_attribute *attr, char *buf) 96 + static ssize_t show_pc1count(struct device *dev, 97 + struct device_attribute *attr, char *buf) 98 98 { 99 99 unsigned long pcnt1; 100 100 101 101 pcnt1 = sysreg_read(PCNT1); 102 102 return sprintf(buf, "%lu\n", pcnt1); 103 103 } 104 - static ssize_t store_pc1count(struct sys_device *dev, 105 - struct sysdev_attribute *attr, const char *buf, 104 + static ssize_t store_pc1count(struct device *dev, 105 + struct device_attribute *attr, const char *buf, 106 106 size_t count) 107 107 { 108 108 unsigned long val; ··· 116 116 return count; 117 117 } 118 118 119 - static ssize_t show_pccycles(struct sys_device *dev, 120 - struct sysdev_attribute *attr, char *buf) 119 + static ssize_t show_pccycles(struct device *dev, 120 + struct device_attribute *attr, char *buf) 121 121 { 122 122 unsigned long pccnt; 123 123 124 124 pccnt = sysreg_read(PCCNT); 125 125 return sprintf(buf, "%lu\n", pccnt); 126 126 } 127 - static ssize_t store_pccycles(struct sys_device *dev, 128 - struct sysdev_attribute *attr, const char *buf, 127 + static ssize_t store_pccycles(struct device *dev, 128 + struct device_attribute *attr, const char *buf, 129 129 size_t count) 130 130 { 131 131 unsigned long val; ··· 139 139 return count; 140 140 } 141 141 142 - static ssize_t show_pcenable(struct sys_device *dev, 143 - struct sysdev_attribute *attr, char *buf) 142 + static ssize_t show_pcenable(struct device *dev, 143 + struct device_attribute *attr, char *buf) 144 144 { 145 145 unsigned long pccr; 146 146 147 147 pccr = sysreg_read(PCCR); 148 148 return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); 149 149 } 150 - static ssize_t store_pcenable(struct sys_device *dev, 151 - struct sysdev_attribute *attr, const char *buf, 150 + static ssize_t store_pcenable(struct device *dev, 151 + struct device_attribute *attr, const char *buf, 152 152 size_t count) 153 153 { 154 154 unsigned long pccr, val; ··· 167 167 return count; 168 168 } 169 169 170 - static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event); 171 - static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count); 172 - static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event); 173 - static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count); 174 - static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles); 175 - static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable); 170 + static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event); 171 + static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count); 172 + static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event); 173 + static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count); 174 + static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles); 175 + static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable); 176 176 177 177 #endif /* CONFIG_PERFORMANCE_COUNTERS */ 178 178 ··· 186 186 register_cpu(c, cpu); 187 187 188 188 #ifdef CONFIG_PERFORMANCE_COUNTERS 189 - sysdev_create_file(&c->sysdev, &attr_pc0event); 190 - sysdev_create_file(&c->sysdev, &attr_pc0count); 191 - sysdev_create_file(&c->sysdev, &attr_pc1event); 192 - sysdev_create_file(&c->sysdev, &attr_pc1count); 193 - sysdev_create_file(&c->sysdev, &attr_pccycles); 194 - sysdev_create_file(&c->sysdev, &attr_pcenable); 189 + device_create_file(&c->dev, &dev_attr_pc0event); 190 + device_create_file(&c->dev, &dev_attr_pc0count); 191 + device_create_file(&c->dev, &dev_attr_pc1event); 192 + device_create_file(&c->dev, &dev_attr_pc1count); 193 + device_create_file(&c->dev, &dev_attr_pccycles); 194 + device_create_file(&c->dev, &dev_attr_pcenable); 195 195 #endif 196 196 } 197 197
+26 -26
arch/ia64/kernel/err_inject.c
··· 24 24 * Copyright (C) 2006, Intel Corp. All rights reserved. 25 25 * 26 26 */ 27 - #include <linux/sysdev.h> 27 + #include <linux/device.h> 28 28 #include <linux/init.h> 29 29 #include <linux/mm.h> 30 30 #include <linux/cpu.h> ··· 35 35 #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; 36 36 37 37 #define define_one_ro(name) \ 38 - static SYSDEV_ATTR(name, 0444, show_##name, NULL) 38 + static DEVICE_ATTR(name, 0444, show_##name, NULL) 39 39 40 40 #define define_one_rw(name) \ 41 - static SYSDEV_ATTR(name, 0644, show_##name, store_##name) 41 + static DEVICE_ATTR(name, 0644, show_##name, store_##name) 42 42 43 43 static u64 call_start[NR_CPUS]; 44 44 static u64 phys_addr[NR_CPUS]; ··· 55 55 56 56 #define show(name) \ 57 57 static ssize_t \ 58 - show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ 58 + show_##name(struct device *dev, struct device_attribute *attr, \ 59 59 char *buf) \ 60 60 { \ 61 61 u32 cpu=dev->id; \ ··· 64 64 65 65 #define store(name) \ 66 66 static ssize_t \ 67 - store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ 67 + store_##name(struct device *dev, struct device_attribute *attr, \ 68 68 const char *buf, size_t size) \ 69 69 { \ 70 70 unsigned int cpu=dev->id; \ ··· 78 78 * processor. The cpu number in driver is only used for storing data. 79 79 */ 80 80 static ssize_t 81 - store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, 81 + store_call_start(struct device *dev, struct device_attribute *attr, 82 82 const char *buf, size_t size) 83 83 { 84 84 unsigned int cpu=dev->id; ··· 127 127 store(err_type_info) 128 128 129 129 static ssize_t 130 - show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, 130 + show_virtual_to_phys(struct device *dev, struct device_attribute *attr, 131 131 char *buf) 132 132 { 133 133 unsigned int cpu=dev->id; ··· 135 135 } 136 136 137 137 static ssize_t 138 - store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, 138 + store_virtual_to_phys(struct device *dev, struct device_attribute *attr, 139 139 const char *buf, size_t size) 140 140 { 141 141 unsigned int cpu=dev->id; ··· 159 159 store(err_struct_info) 160 160 161 161 static ssize_t 162 - show_err_data_buffer(struct sys_device *dev, 163 - struct sysdev_attribute *attr, char *buf) 162 + show_err_data_buffer(struct device *dev, 163 + struct device_attribute *attr, char *buf) 164 164 { 165 165 unsigned int cpu=dev->id; 166 166 ··· 171 171 } 172 172 173 173 static ssize_t 174 - store_err_data_buffer(struct sys_device *dev, 175 - struct sysdev_attribute *attr, 174 + store_err_data_buffer(struct device *dev, 175 + struct device_attribute *attr, 176 176 const char *buf, size_t size) 177 177 { 178 178 unsigned int cpu=dev->id; ··· 209 209 define_one_ro(resources); 210 210 211 211 static struct attribute *default_attrs[] = { 212 - &attr_call_start.attr, 213 - &attr_virtual_to_phys.attr, 214 - &attr_err_type_info.attr, 215 - &attr_err_struct_info.attr, 216 - &attr_err_data_buffer.attr, 217 - &attr_status.attr, 218 - &attr_capabilities.attr, 219 - &attr_resources.attr, 212 + &dev_attr_call_start.attr, 213 + &dev_attr_virtual_to_phys.attr, 214 + &dev_attr_err_type_info.attr, 215 + &dev_attr_err_struct_info.attr, 216 + &dev_attr_err_data_buffer.attr, 217 + &dev_attr_status.attr, 218 + &dev_attr_capabilities.attr, 219 + &dev_attr_resources.attr, 220 220 NULL 221 221 }; 222 222 ··· 225 225 .name = "err_inject" 226 226 }; 227 227 /* Add/Remove err_inject interface for CPU device */ 228 - static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) 228 + static int __cpuinit err_inject_add_dev(struct device * sys_dev) 229 229 { 230 230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); 231 231 } 232 232 233 - static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) 233 + static int __cpuinit err_inject_remove_dev(struct device * sys_dev) 234 234 { 235 235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 236 236 return 0; ··· 239 239 unsigned long action, void *hcpu) 240 240 { 241 241 unsigned int cpu = (unsigned long)hcpu; 242 - struct sys_device *sys_dev; 242 + struct device *sys_dev; 243 243 244 - sys_dev = get_cpu_sysdev(cpu); 244 + sys_dev = get_cpu_device(cpu); 245 245 switch (action) { 246 246 case CPU_ONLINE: 247 247 case CPU_ONLINE_FROZEN: ··· 283 283 err_inject_exit(void) 284 284 { 285 285 int i; 286 - struct sys_device *sys_dev; 286 + struct device *sys_dev; 287 287 288 288 #ifdef ERR_INJ_DEBUG 289 289 printk(KERN_INFO "Exit error injection driver.\n"); 290 290 #endif 291 291 for_each_online_cpu(i) { 292 - sys_dev = get_cpu_sysdev(i); 292 + sys_dev = get_cpu_device(i); 293 293 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 294 294 } 295 295 unregister_hotcpu_notifier(&err_inject_cpu_notifier);
+5 -5
arch/ia64/kernel/topology.c
··· 350 350 } 351 351 352 352 /* Add cache interface for CPU device */ 353 - static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 353 + static int __cpuinit cache_add_dev(struct device * sys_dev) 354 354 { 355 355 unsigned int cpu = sys_dev->id; 356 356 unsigned long i, j; ··· 400 400 } 401 401 402 402 /* Remove cache interface for CPU device */ 403 - static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) 403 + static int __cpuinit cache_remove_dev(struct device * sys_dev) 404 404 { 405 405 unsigned int cpu = sys_dev->id; 406 406 unsigned long i; ··· 428 428 unsigned long action, void *hcpu) 429 429 { 430 430 unsigned int cpu = (unsigned long)hcpu; 431 - struct sys_device *sys_dev; 431 + struct device *sys_dev; 432 432 433 - sys_dev = get_cpu_sysdev(cpu); 433 + sys_dev = get_cpu_device(cpu); 434 434 switch (action) { 435 435 case CPU_ONLINE: 436 436 case CPU_ONLINE_FROZEN: ··· 454 454 int i; 455 455 456 456 for_each_online_cpu(i) { 457 - struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); 457 + struct device *sys_dev = get_cpu_device((unsigned int)i); 458 458 cache_add_dev(sys_dev); 459 459 } 460 460
+6 -6
arch/powerpc/include/asm/spu.h
··· 25 25 #ifdef __KERNEL__ 26 26 27 27 #include <linux/workqueue.h> 28 - #include <linux/sysdev.h> 28 + #include <linux/device.h> 29 29 #include <linux/mutex.h> 30 30 31 31 #define LS_SIZE (256 * 1024) ··· 166 166 /* beat only */ 167 167 u64 shadow_int_mask_RW[3]; 168 168 169 - struct sys_device sysdev; 169 + struct device dev; 170 170 171 171 int has_mem_affinity; 172 172 struct list_head aff_list; ··· 270 270 int register_spu_syscalls(struct spufs_calls *calls); 271 271 void unregister_spu_syscalls(struct spufs_calls *calls); 272 272 273 - int spu_add_sysdev_attr(struct sysdev_attribute *attr); 274 - void spu_remove_sysdev_attr(struct sysdev_attribute *attr); 273 + int spu_add_dev_attr(struct device_attribute *attr); 274 + void spu_remove_dev_attr(struct device_attribute *attr); 275 275 276 - int spu_add_sysdev_attr_group(struct attribute_group *attrs); 277 - void spu_remove_sysdev_attr_group(struct attribute_group *attrs); 276 + int spu_add_dev_attr_group(struct attribute_group *attrs); 277 + void spu_remove_dev_attr_group(struct attribute_group *attrs); 278 278 279 279 int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, 280 280 unsigned long dsisr, unsigned *flt);
+5 -5
arch/powerpc/include/asm/topology.h
··· 3 3 #ifdef __KERNEL__ 4 4 5 5 6 - struct sys_device; 6 + struct device; 7 7 struct device_node; 8 8 9 9 #ifdef CONFIG_NUMA ··· 86 86 87 87 extern void __init dump_numa_cpu_topology(void); 88 88 89 - extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); 90 - extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); 89 + extern int sysfs_add_device_to_node(struct device *dev, int nid); 90 + extern void sysfs_remove_device_from_node(struct device *dev, int nid); 91 91 92 92 #else 93 93 94 94 static inline void dump_numa_cpu_topology(void) {} 95 95 96 - static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) 96 + static inline int sysfs_add_device_to_node(struct device *dev, int nid) 97 97 { 98 98 return 0; 99 99 } 100 100 101 - static inline void sysfs_remove_device_from_node(struct sys_device *dev, 101 + static inline void sysfs_remove_device_from_node(struct device *dev, 102 102 int nid) 103 103 { 104 104 }
+5 -5
arch/powerpc/kernel/cacheinfo.c
··· 451 451 static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) 452 452 { 453 453 struct cache_dir *cache_dir; 454 - struct sys_device *sysdev; 454 + struct device *dev; 455 455 struct kobject *kobj = NULL; 456 456 457 - sysdev = get_cpu_sysdev(cpu_id); 458 - WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); 459 - if (!sysdev) 457 + dev = get_cpu_device(cpu_id); 458 + WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id); 459 + if (!dev) 460 460 goto err; 461 461 462 - kobj = kobject_create_and_add("cache", &sysdev->kobj); 462 + kobj = kobject_create_and_add("cache", &dev->kobj); 463 463 if (!kobj) 464 464 goto err; 465 465
+1 -1
arch/powerpc/kernel/smp.c
··· 27 27 #include <linux/spinlock.h> 28 28 #include <linux/cache.h> 29 29 #include <linux/err.h> 30 - #include <linux/sysdev.h> 30 + #include <linux/device.h> 31 31 #include <linux/cpu.h> 32 32 #include <linux/notifier.h> 33 33 #include <linux/topology.h>
+128 -129
arch/powerpc/kernel/sysfs.c
··· 1 - #include <linux/sysdev.h> 1 + #include <linux/device.h> 2 2 #include <linux/cpu.h> 3 3 #include <linux/smp.h> 4 4 #include <linux/percpu.h> ··· 37 37 /* Time in microseconds we delay before sleeping in the idle loop */ 38 38 DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; 39 39 40 - static ssize_t store_smt_snooze_delay(struct sys_device *dev, 41 - struct sysdev_attribute *attr, 40 + static ssize_t store_smt_snooze_delay(struct device *dev, 41 + struct device_attribute *attr, 42 42 const char *buf, 43 43 size_t count) 44 44 { 45 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 45 + struct cpu *cpu = container_of(dev, struct cpu, dev); 46 46 ssize_t ret; 47 47 long snooze; 48 48 ··· 50 50 if (ret != 1) 51 51 return -EINVAL; 52 52 53 - per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; 53 + per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; 54 54 55 55 return count; 56 56 } 57 57 58 - static ssize_t show_smt_snooze_delay(struct sys_device *dev, 59 - struct sysdev_attribute *attr, 58 + static ssize_t show_smt_snooze_delay(struct device *dev, 59 + struct device_attribute *attr, 60 60 char *buf) 61 61 { 62 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 62 + struct cpu *cpu = container_of(dev, struct cpu, dev); 63 63 64 - return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); 64 + return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id)); 65 65 } 66 66 67 - static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, 67 + static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, 68 68 store_smt_snooze_delay); 69 69 70 70 static int __init setup_smt_snooze_delay(char *str) ··· 117 117 ppc_enable_pmcs(); \ 118 118 mtspr(ADDRESS, *(unsigned long *)val); \ 119 119 } \ 120 - static ssize_t show_##NAME(struct sys_device *dev, \ 121 - struct sysdev_attribute *attr, \ 120 + static ssize_t show_##NAME(struct device *dev, \ 121 + struct device_attribute *attr, \ 122 122 char *buf) \ 123 123 { \ 124 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 124 + struct cpu *cpu = container_of(dev, struct cpu, dev); \ 125 125 unsigned long val; \ 126 - smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ 126 + smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \ 127 127 return sprintf(buf, "%lx\n", val); \ 128 128 } \ 129 129 static ssize_t __used \ 130 - store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ 130 + store_##NAME(struct device *dev, struct device_attribute *attr, \ 131 131 const char *buf, size_t count) \ 132 132 { \ 133 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 133 + struct cpu *cpu = container_of(dev, struct cpu, dev); \ 134 134 unsigned long val; \ 135 135 int ret = sscanf(buf, "%lx", &val); \ 136 136 if (ret != 1) \ 137 137 return -EINVAL; \ 138 - smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ 138 + smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \ 139 139 return count; \ 140 140 } 141 141 ··· 178 178 SYSFS_PMCSETUP(spurr, SPRN_SPURR); 179 179 SYSFS_PMCSETUP(dscr, SPRN_DSCR); 180 180 181 - static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 182 - static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); 183 - static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); 184 - static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); 181 + static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 182 + static DEVICE_ATTR(spurr, 0600, show_spurr, NULL); 183 + static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); 184 + static DEVICE_ATTR(purr, 0600, show_purr, store_purr); 185 185 186 186 unsigned long dscr_default = 0; 187 187 EXPORT_SYMBOL(dscr_default); 188 188 189 - static ssize_t show_dscr_default(struct sysdev_class *class, 190 - struct sysdev_class_attribute *attr, char *buf) 189 + static ssize_t show_dscr_default(struct device *dev, 190 + struct device_attribute *attr, char *buf) 191 191 { 192 192 return sprintf(buf, "%lx\n", dscr_default); 193 193 } 194 194 195 - static ssize_t __used store_dscr_default(struct sysdev_class *class, 196 - struct sysdev_class_attribute *attr, const char *buf, 195 + static ssize_t __used store_dscr_default(struct device *dev, 196 + struct device_attribute *attr, const char *buf, 197 197 size_t count) 198 198 { 199 199 unsigned long val; ··· 207 207 return count; 208 208 } 209 209 210 - static SYSDEV_CLASS_ATTR(dscr_default, 0600, 210 + static DEVICE_ATTR(dscr_default, 0600, 211 211 show_dscr_default, store_dscr_default); 212 212 213 213 static void sysfs_create_dscr_default(void) 214 214 { 215 215 int err = 0; 216 216 if (cpu_has_feature(CPU_FTR_DSCR)) 217 - err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 218 - &attr_dscr_default.attr); 217 + err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); 219 218 } 220 219 #endif /* CONFIG_PPC64 */ 221 220 ··· 258 259 #endif /* HAS_PPC_PMC_PA6T */ 259 260 260 261 #ifdef HAS_PPC_PMC_IBM 261 - static struct sysdev_attribute ibm_common_attrs[] = { 262 - _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 263 - _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 262 + static struct device_attribute ibm_common_attrs[] = { 263 + __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 264 + __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 264 265 }; 265 266 #endif /* HAS_PPC_PMC_G4 */ 266 267 267 268 #ifdef HAS_PPC_PMC_G4 268 - static struct sysdev_attribute g4_common_attrs[] = { 269 - _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 270 - _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 271 - _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), 269 + static struct device_attribute g4_common_attrs[] = { 270 + __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 271 + __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 272 + __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), 272 273 }; 273 274 #endif /* HAS_PPC_PMC_G4 */ 274 275 275 - static struct sysdev_attribute classic_pmc_attrs[] = { 276 - _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), 277 - _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), 278 - _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), 279 - _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), 280 - _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), 281 - _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), 276 + static struct device_attribute classic_pmc_attrs[] = { 277 + __ATTR(pmc1, 0600, show_pmc1, store_pmc1), 278 + __ATTR(pmc2, 0600, show_pmc2, store_pmc2), 279 + __ATTR(pmc3, 0600, show_pmc3, store_pmc3), 280 + __ATTR(pmc4, 0600, show_pmc4, store_pmc4), 281 + __ATTR(pmc5, 0600, show_pmc5, store_pmc5), 282 + __ATTR(pmc6, 0600, show_pmc6, store_pmc6), 282 283 #ifdef CONFIG_PPC64 283 - _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), 284 - _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), 284 + __ATTR(pmc7, 0600, show_pmc7, store_pmc7), 285 + __ATTR(pmc8, 0600, show_pmc8, store_pmc8), 285 286 #endif 286 287 }; 287 288 288 289 #ifdef HAS_PPC_PMC_PA6T 289 - static struct sysdev_attribute pa6t_attrs[] = { 290 - _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 291 - _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 292 - _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), 293 - _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), 294 - _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), 295 - _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), 296 - _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), 297 - _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), 290 + static struct device_attribute pa6t_attrs[] = { 291 + __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 292 + __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 293 + __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), 294 + __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), 295 + __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), 296 + __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), 297 + __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), 298 + __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), 298 299 #ifdef CONFIG_DEBUG_KERNEL 299 - _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), 300 - _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), 301 - _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), 302 - _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), 303 - _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), 304 - _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), 305 - _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), 306 - _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), 307 - _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), 308 - _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), 309 - _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), 310 - _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), 311 - _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), 312 - _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), 313 - _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), 314 - _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), 315 - _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), 316 - _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), 317 - _SYSDEV_ATTR(der, 0600, show_der, store_der), 318 - _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), 319 - _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), 320 - _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), 321 - _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), 322 - _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), 323 - _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), 324 - _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), 325 - _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), 326 - _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), 300 + __ATTR(hid0, 0600, show_hid0, store_hid0), 301 + __ATTR(hid1, 0600, show_hid1, store_hid1), 302 + __ATTR(hid4, 0600, show_hid4, store_hid4), 303 + __ATTR(hid5, 0600, show_hid5, store_hid5), 304 + __ATTR(ima0, 0600, show_ima0, store_ima0), 305 + __ATTR(ima1, 0600, show_ima1, store_ima1), 306 + __ATTR(ima2, 0600, show_ima2, store_ima2), 307 + __ATTR(ima3, 0600, show_ima3, store_ima3), 308 + __ATTR(ima4, 0600, show_ima4, store_ima4), 309 + __ATTR(ima5, 0600, show_ima5, store_ima5), 310 + __ATTR(ima6, 0600, show_ima6, store_ima6), 311 + __ATTR(ima7, 0600, show_ima7, store_ima7), 312 + __ATTR(ima8, 0600, show_ima8, store_ima8), 313 + __ATTR(ima9, 0600, show_ima9, store_ima9), 314 + __ATTR(imaat, 0600, show_imaat, store_imaat), 315 + __ATTR(btcr, 0600, show_btcr, store_btcr), 316 + __ATTR(pccr, 0600, show_pccr, store_pccr), 317 + __ATTR(rpccr, 0600, show_rpccr, store_rpccr), 318 + __ATTR(der, 0600, show_der, store_der), 319 + __ATTR(mer, 0600, show_mer, store_mer), 320 + __ATTR(ber, 0600, show_ber, store_ber), 321 + __ATTR(ier, 0600, show_ier, store_ier), 322 + __ATTR(sier, 0600, show_sier, store_sier), 323 + __ATTR(siar, 0600, show_siar, store_siar), 324 + __ATTR(tsr0, 0600, show_tsr0, store_tsr0), 325 + __ATTR(tsr1, 0600, show_tsr1, store_tsr1), 326 + __ATTR(tsr2, 0600, show_tsr2, store_tsr2), 327 + __ATTR(tsr3, 0600, show_tsr3, store_tsr3), 327 328 #endif /* CONFIG_DEBUG_KERNEL */ 328 329 }; 329 330 #endif /* HAS_PPC_PMC_PA6T */ ··· 332 333 static void __cpuinit register_cpu_online(unsigned int cpu) 333 334 { 334 335 struct cpu *c = &per_cpu(cpu_devices, cpu); 335 - struct sys_device *s = &c->sysdev; 336 - struct sysdev_attribute *attrs, *pmc_attrs; 336 + struct device *s = &c->dev; 337 + struct device_attribute *attrs, *pmc_attrs; 337 338 int i, nattrs; 338 339 339 340 #ifdef CONFIG_PPC64 340 341 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 341 342 cpu_has_feature(CPU_FTR_SMT)) 342 - sysdev_create_file(s, &attr_smt_snooze_delay); 343 + device_create_file(s, &dev_attr_smt_snooze_delay); 343 344 #endif 344 345 345 346 /* PMC stuff */ ··· 347 348 #ifdef HAS_PPC_PMC_IBM 348 349 case PPC_PMC_IBM: 349 350 attrs = ibm_common_attrs; 350 - nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 351 + nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); 351 352 pmc_attrs = classic_pmc_attrs; 352 353 break; 353 354 #endif /* HAS_PPC_PMC_IBM */ 354 355 #ifdef HAS_PPC_PMC_G4 355 356 case PPC_PMC_G4: 356 357 attrs = g4_common_attrs; 357 - nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 358 + nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); 358 359 pmc_attrs = classic_pmc_attrs; 359 360 break; 360 361 #endif /* HAS_PPC_PMC_G4 */ ··· 362 363 case PPC_PMC_PA6T: 363 364 /* PA Semi starts counting at PMC0 */ 364 365 attrs = pa6t_attrs; 365 - nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 366 + nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); 366 367 pmc_attrs = NULL; 367 368 break; 368 369 #endif /* HAS_PPC_PMC_PA6T */ ··· 373 374 } 374 375 375 376 for (i = 0; i < nattrs; i++) 376 - sysdev_create_file(s, &attrs[i]); 377 + device_create_file(s, &attrs[i]); 377 378 378 379 if (pmc_attrs) 379 380 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 380 - sysdev_create_file(s, &pmc_attrs[i]); 381 + device_create_file(s, &pmc_attrs[i]); 381 382 382 383 #ifdef CONFIG_PPC64 383 384 if (cpu_has_feature(CPU_FTR_MMCRA)) 384 - sysdev_create_file(s, &attr_mmcra); 385 + device_create_file(s, &dev_attr_mmcra); 385 386 386 387 if (cpu_has_feature(CPU_FTR_PURR)) 387 - sysdev_create_file(s, &attr_purr); 388 + device_create_file(s, &dev_attr_purr); 388 389 389 390 if (cpu_has_feature(CPU_FTR_SPURR)) 390 - sysdev_create_file(s, &attr_spurr); 391 + device_create_file(s, &dev_attr_spurr); 391 392 392 393 if (cpu_has_feature(CPU_FTR_DSCR)) 393 - sysdev_create_file(s, &attr_dscr); 394 + device_create_file(s, &dev_attr_dscr); 394 395 #endif /* CONFIG_PPC64 */ 395 396 396 397 cacheinfo_cpu_online(cpu); ··· 400 401 static void unregister_cpu_online(unsigned int cpu) 401 402 { 402 403 struct cpu *c = &per_cpu(cpu_devices, cpu); 403 - struct sys_device *s = &c->sysdev; 404 - struct sysdev_attribute *attrs, *pmc_attrs; 404 + struct device *s = &c->dev; 405 + struct device_attribute *attrs, *pmc_attrs; 405 406 int i, nattrs; 406 407 407 408 BUG_ON(!c->hotpluggable); ··· 409 410 #ifdef CONFIG_PPC64 410 411 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 411 412 cpu_has_feature(CPU_FTR_SMT)) 412 - sysdev_remove_file(s, &attr_smt_snooze_delay); 413 + device_remove_file(s, &dev_attr_smt_snooze_delay); 413 414 #endif 414 415 415 416 /* PMC stuff */ ··· 417 418 #ifdef HAS_PPC_PMC_IBM 418 419 case PPC_PMC_IBM: 419 420 attrs = ibm_common_attrs; 420 - nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 421 + nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); 421 422 pmc_attrs = classic_pmc_attrs; 422 423 break; 423 424 #endif /* HAS_PPC_PMC_IBM */ 424 425 #ifdef HAS_PPC_PMC_G4 425 426 case PPC_PMC_G4: 426 427 attrs = g4_common_attrs; 427 - nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 428 + nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); 428 429 pmc_attrs = classic_pmc_attrs; 429 430 break; 430 431 #endif /* HAS_PPC_PMC_G4 */ ··· 432 433 case PPC_PMC_PA6T: 433 434 /* PA Semi starts counting at PMC0 */ 434 435 attrs = pa6t_attrs; 435 - nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 436 + nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); 436 437 pmc_attrs = NULL; 437 438 break; 438 439 #endif /* HAS_PPC_PMC_PA6T */ ··· 443 444 } 444 445 445 446 for (i = 0; i < nattrs; i++) 446 - sysdev_remove_file(s, &attrs[i]); 447 + device_remove_file(s, &attrs[i]); 447 448 448 449 if (pmc_attrs) 449 450 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 450 - sysdev_remove_file(s, &pmc_attrs[i]); 451 + device_remove_file(s, &pmc_attrs[i]); 451 452 452 453 #ifdef CONFIG_PPC64 453 454 if (cpu_has_feature(CPU_FTR_MMCRA)) 454 - sysdev_remove_file(s, &attr_mmcra); 455 + device_remove_file(s, &dev_attr_mmcra); 455 456 456 457 if (cpu_has_feature(CPU_FTR_PURR)) 457 - sysdev_remove_file(s, &attr_purr); 458 + device_remove_file(s, &dev_attr_purr); 458 459 459 460 if (cpu_has_feature(CPU_FTR_SPURR)) 460 - sysdev_remove_file(s, &attr_spurr); 461 + device_remove_file(s, &dev_attr_spurr); 461 462 462 463 if (cpu_has_feature(CPU_FTR_DSCR)) 463 - sysdev_remove_file(s, &attr_dscr); 464 + device_remove_file(s, &dev_attr_dscr); 464 465 #endif /* CONFIG_PPC64 */ 465 466 466 467 cacheinfo_cpu_offline(cpu); ··· 512 513 513 514 static DEFINE_MUTEX(cpu_mutex); 514 515 515 - int cpu_add_sysdev_attr(struct sysdev_attribute *attr) 516 + int cpu_add_dev_attr(struct device_attribute *attr) 516 517 { 517 518 int cpu; 518 519 519 520 mutex_lock(&cpu_mutex); 520 521 521 522 for_each_possible_cpu(cpu) { 522 - sysdev_create_file(get_cpu_sysdev(cpu), attr); 523 + device_create_file(get_cpu_device(cpu), attr); 523 524 } 524 525 525 526 mutex_unlock(&cpu_mutex); 526 527 return 0; 527 528 } 528 - EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); 529 + EXPORT_SYMBOL_GPL(cpu_add_dev_attr); 529 530 530 - int cpu_add_sysdev_attr_group(struct attribute_group *attrs) 531 + int cpu_add_dev_attr_group(struct attribute_group *attrs) 531 532 { 532 533 int cpu; 533 - struct sys_device *sysdev; 534 + struct device *dev; 534 535 int ret; 535 536 536 537 mutex_lock(&cpu_mutex); 537 538 538 539 for_each_possible_cpu(cpu) { 539 - sysdev = get_cpu_sysdev(cpu); 540 - ret = sysfs_create_group(&sysdev->kobj, attrs); 540 + dev = get_cpu_device(cpu); 541 + ret = sysfs_create_group(&dev->kobj, attrs); 541 542 WARN_ON(ret != 0); 542 543 } 543 544 544 545 mutex_unlock(&cpu_mutex); 545 546 return 0; 546 547 } 547 - EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); 548 + EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group); 548 549 549 550 550 - void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) 551 + void cpu_remove_dev_attr(struct device_attribute *attr) 551 552 { 552 553 int cpu; 553 554 554 555 mutex_lock(&cpu_mutex); 555 556 556 557 for_each_possible_cpu(cpu) { 557 - sysdev_remove_file(get_cpu_sysdev(cpu), attr); 558 + device_remove_file(get_cpu_device(cpu), attr); 558 559 } 559 560 560 561 mutex_unlock(&cpu_mutex); 561 562 } 562 - EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); 563 + EXPORT_SYMBOL_GPL(cpu_remove_dev_attr); 563 564 564 - void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) 565 + void cpu_remove_dev_attr_group(struct attribute_group *attrs) 565 566 { 566 567 int cpu; 567 - struct sys_device *sysdev; 568 + struct device *dev; 568 569 569 570 mutex_lock(&cpu_mutex); 570 571 571 572 for_each_possible_cpu(cpu) { 572 - sysdev = get_cpu_sysdev(cpu); 573 - sysfs_remove_group(&sysdev->kobj, attrs); 573 + dev = get_cpu_device(cpu); 574 + sysfs_remove_group(&dev->kobj, attrs); 574 575 } 575 576 576 577 mutex_unlock(&cpu_mutex); 577 578 } 578 - EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); 579 + EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group); 579 580 580 581 581 582 /* NUMA stuff */ ··· 589 590 register_one_node(i); 590 591 } 591 592 592 - int sysfs_add_device_to_node(struct sys_device *dev, int nid) 593 + int sysfs_add_device_to_node(struct device *dev, int nid) 593 594 { 594 595 struct node *node = &node_devices[nid]; 595 596 return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, ··· 597 598 } 598 599 EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); 599 600 600 - void sysfs_remove_device_from_node(struct sys_device *dev, int nid) 601 + void sysfs_remove_device_from_node(struct device *dev, int nid) 601 602 { 602 603 struct node *node = &node_devices[nid]; 603 604 sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); ··· 613 614 #endif 614 615 615 616 /* Only valid if CPU is present. */ 616 - static ssize_t show_physical_id(struct sys_device *dev, 617 - struct sysdev_attribute *attr, char *buf) 617 + static ssize_t show_physical_id(struct device *dev, 618 + struct device_attribute *attr, char *buf) 618 619 { 619 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 620 + struct cpu *cpu = container_of(dev, struct cpu, dev); 620 621 621 - return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); 622 + return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id)); 622 623 } 623 - static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); 624 + static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL); 624 625 625 626 static int __init topology_init(void) 626 627 { ··· 645 646 if (cpu_online(cpu) || c->hotpluggable) { 646 647 register_cpu(c, cpu); 647 648 648 - sysdev_create_file(&c->sysdev, &attr_physical_id); 649 + device_create_file(&c->dev, &dev_attr_physical_id); 649 650 } 650 651 651 652 if (cpu_online(cpu))
+4 -4
arch/powerpc/mm/numa.c
··· 1452 1452 { 1453 1453 int cpu, nid, old_nid; 1454 1454 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; 1455 - struct sys_device *sysdev; 1455 + struct device *dev; 1456 1456 1457 1457 for_each_cpu(cpu,&cpu_associativity_changes_mask) { 1458 1458 vphn_get_associativity(cpu, associativity); ··· 1473 1473 register_cpu_under_node(cpu, nid); 1474 1474 put_online_cpus(); 1475 1475 1476 - sysdev = get_cpu_sysdev(cpu); 1477 - if (sysdev) 1478 - kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 1476 + dev = get_cpu_device(cpu); 1477 + if (dev) 1478 + kobject_uevent(&dev->kobj, KOBJ_CHANGE); 1479 1479 } 1480 1480 1481 1481 return 1;
+72 -72
arch/powerpc/platforms/cell/cbe_thermal.c
··· 46 46 */ 47 47 48 48 #include <linux/module.h> 49 - #include <linux/sysdev.h> 49 + #include <linux/device.h> 50 50 #include <linux/kernel.h> 51 51 #include <linux/cpu.h> 52 52 #include <asm/spu.h> ··· 59 59 #define TEMP_MIN 65 60 60 #define TEMP_MAX 125 61 61 62 - #define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ 63 - struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ 62 + #define DEVICE_PREFIX_ATTR(_prefix,_name,_mode) \ 63 + struct device_attribute attr_ ## _prefix ## _ ## _name = { \ 64 64 .attr = { .name = __stringify(_name), .mode = _mode }, \ 65 65 .show = _prefix ## _show_ ## _name, \ 66 66 .store = _prefix ## _store_ ## _name, \ ··· 76 76 return ((temp - TEMP_MIN) >> 1) & 0x3f; 77 77 } 78 78 79 - static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) 79 + static struct cbe_pmd_regs __iomem *get_pmd_regs(struct device *dev) 80 80 { 81 81 struct spu *spu; 82 82 83 - spu = container_of(sysdev, struct spu, sysdev); 83 + spu = container_of(dev, struct spu, dev); 84 84 85 85 return cbe_get_pmd_regs(spu_devnode(spu)); 86 86 } 87 87 88 88 /* returns the value for a given spu in a given register */ 89 - static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) 89 + static u8 spu_read_register_value(struct device *dev, union spe_reg __iomem *reg) 90 90 { 91 91 union spe_reg value; 92 92 struct spu *spu; 93 93 94 - spu = container_of(sysdev, struct spu, sysdev); 94 + spu = container_of(dev, struct spu, dev); 95 95 value.val = in_be64(&reg->val); 96 96 97 97 return value.spe[spu->spe_id]; 98 98 } 99 99 100 - static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, 100 + static ssize_t spu_show_temp(struct device *dev, struct device_attribute *attr, 101 101 char *buf) 102 102 { 103 103 u8 value; 104 104 struct cbe_pmd_regs __iomem *pmd_regs; 105 105 106 - pmd_regs = get_pmd_regs(sysdev); 106 + pmd_regs = get_pmd_regs(dev); 107 107 108 - value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); 108 + value = spu_read_register_value(dev, &pmd_regs->ts_ctsr1); 109 109 110 110 return sprintf(buf, "%d\n", reg_to_temp(value)); 111 111 } ··· 147 147 return size; 148 148 } 149 149 150 - static ssize_t spu_show_throttle_end(struct sys_device *sysdev, 151 - struct sysdev_attribute *attr, char *buf) 150 + static ssize_t spu_show_throttle_end(struct device *dev, 151 + struct device_attribute *attr, char *buf) 152 152 { 153 - return show_throttle(get_pmd_regs(sysdev), buf, 0); 153 + return show_throttle(get_pmd_regs(dev), buf, 0); 154 154 } 155 155 156 - static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, 157 - struct sysdev_attribute *attr, char *buf) 156 + static ssize_t spu_show_throttle_begin(struct device *dev, 157 + struct device_attribute *attr, char *buf) 158 158 { 159 - return show_throttle(get_pmd_regs(sysdev), buf, 8); 159 + return show_throttle(get_pmd_regs(dev), buf, 8); 160 160 } 161 161 162 - static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, 163 - struct sysdev_attribute *attr, char *buf) 162 + static ssize_t spu_show_throttle_full_stop(struct device *dev, 163 + struct device_attribute *attr, char *buf) 164 164 { 165 - return show_throttle(get_pmd_regs(sysdev), buf, 16); 165 + return show_throttle(get_pmd_regs(dev), buf, 16); 166 166 } 167 167 168 - static ssize_t spu_store_throttle_end(struct sys_device *sysdev, 169 - struct sysdev_attribute *attr, const char *buf, size_t size) 168 + static ssize_t spu_store_throttle_end(struct device *dev, 169 + struct device_attribute *attr, const char *buf, size_t size) 170 170 { 171 - return store_throttle(get_pmd_regs(sysdev), buf, size, 0); 171 + return store_throttle(get_pmd_regs(dev), buf, size, 0); 172 172 } 173 173 174 - static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, 175 - struct sysdev_attribute *attr, const char *buf, size_t size) 174 + static ssize_t spu_store_throttle_begin(struct device *dev, 175 + struct device_attribute *attr, const char *buf, size_t size) 176 176 { 177 - return store_throttle(get_pmd_regs(sysdev), buf, size, 8); 177 + return store_throttle(get_pmd_regs(dev), buf, size, 8); 178 178 } 179 179 180 - static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, 181 - struct sysdev_attribute *attr, const char *buf, size_t size) 180 + static ssize_t spu_store_throttle_full_stop(struct device *dev, 181 + struct device_attribute *attr, const char *buf, size_t size) 182 182 { 183 - return store_throttle(get_pmd_regs(sysdev), buf, size, 16); 183 + return store_throttle(get_pmd_regs(dev), buf, size, 16); 184 184 } 185 185 186 - static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) 186 + static ssize_t ppe_show_temp(struct device *dev, char *buf, int pos) 187 187 { 188 188 struct cbe_pmd_regs __iomem *pmd_regs; 189 189 u64 value; 190 190 191 - pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 191 + pmd_regs = cbe_get_cpu_pmd_regs(dev->id); 192 192 value = in_be64(&pmd_regs->ts_ctsr2); 193 193 194 194 value = (value >> pos) & 0x3f; ··· 199 199 200 200 /* shows the temperature of the DTS on the PPE, 201 201 * located near the linear thermal sensor */ 202 - static ssize_t ppe_show_temp0(struct sys_device *sysdev, 203 - struct sysdev_attribute *attr, char *buf) 202 + static ssize_t ppe_show_temp0(struct device *dev, 203 + struct device_attribute *attr, char *buf) 204 204 { 205 - return ppe_show_temp(sysdev, buf, 32); 205 + return ppe_show_temp(dev, buf, 32); 206 206 } 207 207 208 208 /* shows the temperature of the second DTS on the PPE */ 209 - static ssize_t ppe_show_temp1(struct sys_device *sysdev, 210 - struct sysdev_attribute *attr, char *buf) 209 + static ssize_t ppe_show_temp1(struct device *dev, 210 + struct device_attribute *attr, char *buf) 211 211 { 212 - return ppe_show_temp(sysdev, buf, 0); 212 + return ppe_show_temp(dev, buf, 0); 213 213 } 214 214 215 - static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, 216 - struct sysdev_attribute *attr, char *buf) 215 + static ssize_t ppe_show_throttle_end(struct device *dev, 216 + struct device_attribute *attr, char *buf) 217 217 { 218 - return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); 218 + return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 32); 219 219 } 220 220 221 - static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, 222 - struct sysdev_attribute *attr, char *buf) 221 + static ssize_t ppe_show_throttle_begin(struct device *dev, 222 + struct device_attribute *attr, char *buf) 223 223 { 224 - return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); 224 + return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 40); 225 225 } 226 226 227 - static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, 228 - struct sysdev_attribute *attr, char *buf) 227 + static ssize_t ppe_show_throttle_full_stop(struct device *dev, 228 + struct device_attribute *attr, char *buf) 229 229 { 230 - return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); 230 + return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 48); 231 231 } 232 232 233 - static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, 234 - struct sysdev_attribute *attr, const char *buf, size_t size) 233 + static ssize_t ppe_store_throttle_end(struct device *dev, 234 + struct device_attribute *attr, const char *buf, size_t size) 235 235 { 236 - return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); 236 + return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 32); 237 237 } 238 238 239 - static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, 240 - struct sysdev_attribute *attr, const char *buf, size_t size) 239 + static ssize_t ppe_store_throttle_begin(struct device *dev, 240 + struct device_attribute *attr, const char *buf, size_t size) 241 241 { 242 - return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); 242 + return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 40); 243 243 } 244 244 245 - static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, 246 - struct sysdev_attribute *attr, const char *buf, size_t size) 245 + static ssize_t ppe_store_throttle_full_stop(struct device *dev, 246 + struct device_attribute *attr, const char *buf, size_t size) 247 247 { 248 - return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); 248 + return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 48); 249 249 } 250 250 251 251 252 - static struct sysdev_attribute attr_spu_temperature = { 252 + static struct device_attribute attr_spu_temperature = { 253 253 .attr = {.name = "temperature", .mode = 0400 }, 254 254 .show = spu_show_temp, 255 255 }; 256 256 257 - static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); 258 - static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); 259 - static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); 257 + static DEVICE_PREFIX_ATTR(spu, throttle_end, 0600); 258 + static DEVICE_PREFIX_ATTR(spu, throttle_begin, 0600); 259 + static DEVICE_PREFIX_ATTR(spu, throttle_full_stop, 0600); 260 260 261 261 262 262 static struct attribute *spu_attributes[] = { ··· 272 272 .attrs = spu_attributes, 273 273 }; 274 274 275 - static struct sysdev_attribute attr_ppe_temperature0 = { 275 + static struct device_attribute attr_ppe_temperature0 = { 276 276 .attr = {.name = "temperature0", .mode = 0400 }, 277 277 .show = ppe_show_temp0, 278 278 }; 279 279 280 - static struct sysdev_attribute attr_ppe_temperature1 = { 280 + static struct device_attribute attr_ppe_temperature1 = { 281 281 .attr = {.name = "temperature1", .mode = 0400 }, 282 282 .show = ppe_show_temp1, 283 283 }; 284 284 285 - static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); 286 - static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); 287 - static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); 285 + static DEVICE_PREFIX_ATTR(ppe, throttle_end, 0600); 286 + static DEVICE_PREFIX_ATTR(ppe, throttle_begin, 0600); 287 + static DEVICE_PREFIX_ATTR(ppe, throttle_full_stop, 0600); 288 288 289 289 static struct attribute *ppe_attributes[] = { 290 290 &attr_ppe_temperature0.attr, ··· 307 307 { 308 308 int cpu; 309 309 struct cbe_pmd_regs __iomem *pmd_regs; 310 - struct sys_device *sysdev; 310 + struct device *dev; 311 311 union ppe_spe_reg tpr; 312 312 union spe_reg str1; 313 313 u64 str2; ··· 349 349 350 350 for_each_possible_cpu (cpu) { 351 351 pr_debug("processing cpu %d\n", cpu); 352 - sysdev = get_cpu_sysdev(cpu); 352 + dev = get_cpu_device(cpu); 353 353 354 - if (!sysdev) { 355 - pr_info("invalid sysdev pointer for cbe_thermal\n"); 354 + if (!dev) { 355 + pr_info("invalid dev pointer for cbe_thermal\n"); 356 356 return -EINVAL; 357 357 } 358 358 359 - pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 359 + pmd_regs = cbe_get_cpu_pmd_regs(dev->id); 360 360 361 361 if (!pmd_regs) { 362 362 pr_info("invalid CBE regs pointer for cbe_thermal\n"); ··· 379 379 int rc = init_default_values(); 380 380 381 381 if (rc == 0) { 382 - spu_add_sysdev_attr_group(&spu_attribute_group); 383 - cpu_add_sysdev_attr_group(&ppe_attribute_group); 382 + spu_add_dev_attr_group(&spu_attribute_group); 383 + cpu_add_dev_attr_group(&ppe_attribute_group); 384 384 } 385 385 386 386 return rc; ··· 389 389 390 390 static void __exit thermal_exit(void) 391 391 { 392 - spu_remove_sysdev_attr_group(&spu_attribute_group); 393 - cpu_remove_sysdev_attr_group(&ppe_attribute_group); 392 + spu_remove_dev_attr_group(&spu_attribute_group); 393 + cpu_remove_dev_attr_group(&ppe_attribute_group); 394 394 } 395 395 module_exit(thermal_exit); 396 396
+31 -30
arch/powerpc/platforms/cell/spu_base.c
··· 522 522 } 523 523 EXPORT_SYMBOL_GPL(spu_init_channels); 524 524 525 - static struct sysdev_class spu_sysdev_class = { 525 + static struct bus_type spu_subsys = { 526 526 .name = "spu", 527 + .dev_name = "spu", 527 528 }; 528 529 529 - int spu_add_sysdev_attr(struct sysdev_attribute *attr) 530 + int spu_add_dev_attr(struct device_attribute *attr) 530 531 { 531 532 struct spu *spu; 532 533 533 534 mutex_lock(&spu_full_list_mutex); 534 535 list_for_each_entry(spu, &spu_full_list, full_list) 535 - sysdev_create_file(&spu->sysdev, attr); 536 + device_create_file(&spu->dev, attr); 536 537 mutex_unlock(&spu_full_list_mutex); 537 538 538 539 return 0; 539 540 } 540 - EXPORT_SYMBOL_GPL(spu_add_sysdev_attr); 541 + EXPORT_SYMBOL_GPL(spu_add_dev_attr); 541 542 542 - int spu_add_sysdev_attr_group(struct attribute_group *attrs) 543 + int spu_add_dev_attr_group(struct attribute_group *attrs) 543 544 { 544 545 struct spu *spu; 545 546 int rc = 0; 546 547 547 548 mutex_lock(&spu_full_list_mutex); 548 549 list_for_each_entry(spu, &spu_full_list, full_list) { 549 - rc = sysfs_create_group(&spu->sysdev.kobj, attrs); 550 + rc = sysfs_create_group(&spu->dev.kobj, attrs); 550 551 551 552 /* we're in trouble here, but try unwinding anyway */ 552 553 if (rc) { ··· 556 555 557 556 list_for_each_entry_continue_reverse(spu, 558 557 &spu_full_list, full_list) 559 - sysfs_remove_group(&spu->sysdev.kobj, attrs); 558 + sysfs_remove_group(&spu->dev.kobj, attrs); 560 559 break; 561 560 } 562 561 } ··· 565 564 566 565 return rc; 567 566 } 568 - EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); 567 + EXPORT_SYMBOL_GPL(spu_add_dev_attr_group); 569 568 570 569 571 - void spu_remove_sysdev_attr(struct sysdev_attribute *attr) 570 + void spu_remove_dev_attr(struct device_attribute *attr) 572 571 { 573 572 struct spu *spu; 574 573 575 574 mutex_lock(&spu_full_list_mutex); 576 575 list_for_each_entry(spu, &spu_full_list, full_list) 577 - sysdev_remove_file(&spu->sysdev, attr); 576 + device_remove_file(&spu->dev, attr); 578 577 mutex_unlock(&spu_full_list_mutex); 579 578 } 580 - EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr); 579 + EXPORT_SYMBOL_GPL(spu_remove_dev_attr); 581 580 582 - void spu_remove_sysdev_attr_group(struct attribute_group *attrs) 581 + void spu_remove_dev_attr_group(struct attribute_group *attrs) 583 582 { 584 583 struct spu *spu; 585 584 586 585 mutex_lock(&spu_full_list_mutex); 587 586 list_for_each_entry(spu, &spu_full_list, full_list) 588 - sysfs_remove_group(&spu->sysdev.kobj, attrs); 587 + sysfs_remove_group(&spu->dev.kobj, attrs); 589 588 mutex_unlock(&spu_full_list_mutex); 590 589 } 591 - EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group); 590 + EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group); 592 591 593 - static int spu_create_sysdev(struct spu *spu) 592 + static int spu_create_dev(struct spu *spu) 594 593 { 595 594 int ret; 596 595 597 - spu->sysdev.id = spu->number; 598 - spu->sysdev.cls = &spu_sysdev_class; 599 - ret = sysdev_register(&spu->sysdev); 596 + spu->dev.id = spu->number; 597 + spu->dev.bus = &spu_subsys; 598 + ret = device_register(&spu->dev); 600 599 if (ret) { 601 600 printk(KERN_ERR "Can't register SPU %d with sysfs\n", 602 601 spu->number); 603 602 return ret; 604 603 } 605 604 606 - sysfs_add_device_to_node(&spu->sysdev, spu->node); 605 + sysfs_add_device_to_node(&spu->dev, spu->node); 607 606 608 607 return 0; 609 608 } ··· 639 638 if (ret) 640 639 goto out_destroy; 641 640 642 - ret = spu_create_sysdev(spu); 641 + ret = spu_create_dev(spu); 643 642 if (ret) 644 643 goto out_free_irqs; 645 644 ··· 696 695 } 697 696 698 697 699 - static ssize_t spu_stat_show(struct sys_device *sysdev, 700 - struct sysdev_attribute *attr, char *buf) 698 + static ssize_t spu_stat_show(struct device *dev, 699 + struct device_attribute *attr, char *buf) 701 700 { 702 - struct spu *spu = container_of(sysdev, struct spu, sysdev); 701 + struct spu *spu = container_of(dev, struct spu, dev); 703 702 704 703 return sprintf(buf, "%s %llu %llu %llu %llu " 705 704 "%llu %llu %llu %llu %llu %llu %llu %llu\n", ··· 718 717 spu->stats.libassist); 719 718 } 720 719 721 - static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 720 + static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL); 722 721 723 722 #ifdef CONFIG_KEXEC 724 723 ··· 817 816 if (!spu_management_ops) 818 817 goto out; 819 818 820 - /* create sysdev class for spus */ 821 - ret = sysdev_class_register(&spu_sysdev_class); 819 + /* create system subsystem for spus */ 820 + ret = subsys_system_register(&spu_subsys, NULL); 822 821 if (ret) 823 822 goto out; 824 823 ··· 827 826 if (ret < 0) { 828 827 printk(KERN_WARNING "%s: Error initializing spus\n", 829 828 __func__); 830 - goto out_unregister_sysdev_class; 829 + goto out_unregister_subsys; 831 830 } 832 831 833 832 if (ret > 0) ··· 837 836 xmon_register_spus(&spu_full_list); 838 837 crash_register_spus(&spu_full_list); 839 838 mutex_unlock(&spu_full_list_mutex); 840 - spu_add_sysdev_attr(&attr_stat); 839 + spu_add_dev_attr(&dev_attr_stat); 841 840 register_syscore_ops(&spu_syscore_ops); 842 841 843 842 spu_init_affinity(); 844 843 845 844 return 0; 846 845 847 - out_unregister_sysdev_class: 848 - sysdev_class_unregister(&spu_sysdev_class); 846 + out_unregister_subsys: 847 + bus_unregister(&spu_subsys); 849 848 out: 850 849 return ret; 851 850 }
+34 -37
arch/powerpc/platforms/pseries/pseries_energy.c
··· 15 15 #include <linux/errno.h> 16 16 #include <linux/init.h> 17 17 #include <linux/seq_file.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/device.h> 19 19 #include <linux/cpu.h> 20 20 #include <linux/of.h> 21 21 #include <asm/cputhreads.h> ··· 184 184 return s-page; 185 185 } 186 186 187 - static ssize_t get_best_energy_data(struct sys_device *dev, 187 + static ssize_t get_best_energy_data(struct device *dev, 188 188 char *page, int activate) 189 189 { 190 190 int rc; ··· 207 207 208 208 /* Wrapper functions */ 209 209 210 - static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class, 211 - struct sysdev_class_attribute *attr, char *page) 210 + static ssize_t cpu_activate_hint_list_show(struct device *dev, 211 + struct device_attribute *attr, char *page) 212 212 { 213 213 return get_best_energy_list(page, 1); 214 214 } 215 215 216 - static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class, 217 - struct sysdev_class_attribute *attr, char *page) 216 + static ssize_t cpu_deactivate_hint_list_show(struct device *dev, 217 + struct device_attribute *attr, char *page) 218 218 { 219 219 return get_best_energy_list(page, 0); 220 220 } 221 221 222 - static ssize_t percpu_activate_hint_show(struct sys_device *dev, 223 - struct sysdev_attribute *attr, char *page) 222 + static ssize_t percpu_activate_hint_show(struct device *dev, 223 + struct device_attribute *attr, char *page) 224 224 { 225 225 return get_best_energy_data(dev, page, 1); 226 226 } 227 227 228 - static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, 229 - struct sysdev_attribute *attr, char *page) 228 + static ssize_t percpu_deactivate_hint_show(struct device *dev, 229 + struct device_attribute *attr, char *page) 230 230 { 231 231 return get_best_energy_data(dev, page, 0); 232 232 } ··· 241 241 * Per-cpu value of the hint 242 242 */ 243 243 244 - struct sysdev_class_attribute attr_cpu_activate_hint_list = 245 - _SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444, 244 + struct device_attribute attr_cpu_activate_hint_list = 245 + __ATTR(pseries_activate_hint_list, 0444, 246 246 cpu_activate_hint_list_show, NULL); 247 247 248 - struct sysdev_class_attribute attr_cpu_deactivate_hint_list = 249 - _SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444, 248 + struct device_attribute attr_cpu_deactivate_hint_list = 249 + __ATTR(pseries_deactivate_hint_list, 0444, 250 250 cpu_deactivate_hint_list_show, NULL); 251 251 252 - struct sysdev_attribute attr_percpu_activate_hint = 253 - _SYSDEV_ATTR(pseries_activate_hint, 0444, 252 + struct device_attribute attr_percpu_activate_hint = 253 + __ATTR(pseries_activate_hint, 0444, 254 254 percpu_activate_hint_show, NULL); 255 255 256 - struct sysdev_attribute attr_percpu_deactivate_hint = 257 - _SYSDEV_ATTR(pseries_deactivate_hint, 0444, 256 + struct device_attribute attr_percpu_deactivate_hint = 257 + __ATTR(pseries_deactivate_hint, 0444, 258 258 percpu_deactivate_hint_show, NULL); 259 259 260 260 static int __init pseries_energy_init(void) 261 261 { 262 262 int cpu, err; 263 - struct sys_device *cpu_sys_dev; 263 + struct device *cpu_dev; 264 264 265 265 if (!check_for_h_best_energy()) { 266 266 printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n"); 267 267 return 0; 268 268 } 269 269 /* Create the sysfs files */ 270 - err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 271 - &attr_cpu_activate_hint_list.attr); 270 + err = device_create_file(cpu_subsys.dev_root, 271 + &attr_cpu_activate_hint_list); 272 272 if (!err) 273 - err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 274 - &attr_cpu_deactivate_hint_list.attr); 273 + err = device_create_file(cpu_subsys.dev_root, 274 + &attr_cpu_deactivate_hint_list); 275 275 276 276 if (err) 277 277 return err; 278 278 for_each_possible_cpu(cpu) { 279 - cpu_sys_dev = get_cpu_sysdev(cpu); 280 - err = sysfs_create_file(&cpu_sys_dev->kobj, 281 - &attr_percpu_activate_hint.attr); 279 + cpu_dev = get_cpu_device(cpu); 280 + err = device_create_file(cpu_dev, 281 + &attr_percpu_activate_hint); 282 282 if (err) 283 283 break; 284 - err = sysfs_create_file(&cpu_sys_dev->kobj, 285 - &attr_percpu_deactivate_hint.attr); 284 + err = device_create_file(cpu_dev, 285 + &attr_percpu_deactivate_hint); 286 286 if (err) 287 287 break; 288 288 } ··· 298 298 static void __exit pseries_energy_cleanup(void) 299 299 { 300 300 int cpu; 301 - struct sys_device *cpu_sys_dev; 301 + struct device *cpu_dev; 302 302 303 303 if (!sysfs_entries) 304 304 return; 305 305 306 306 /* Remove the sysfs files */ 307 - sysfs_remove_file(&cpu_sysdev_class.kset.kobj, 308 - &attr_cpu_activate_hint_list.attr); 309 - 310 - sysfs_remove_file(&cpu_sysdev_class.kset.kobj, 311 - &attr_cpu_deactivate_hint_list.attr); 307 + device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list); 308 + device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list); 312 309 313 310 for_each_possible_cpu(cpu) { 314 - cpu_sys_dev = get_cpu_sysdev(cpu); 315 - sysfs_remove_file(&cpu_sys_dev->kobj, 311 + cpu_dev = get_cpu_device(cpu); 312 + sysfs_remove_file(&cpu_dev->kobj, 316 313 &attr_percpu_activate_hint.attr); 317 - sysfs_remove_file(&cpu_sys_dev->kobj, 314 + sysfs_remove_file(&cpu_dev->kobj, 318 315 &attr_percpu_deactivate_hint.attr); 319 316 } 320 317 }
+3 -3
arch/powerpc/sysdev/ppc4xx_cpm.c
··· 179 179 180 180 static void cpm_idle_config_sysfs(void) 181 181 { 182 - struct sys_device *sys_dev; 182 + struct device *dev; 183 183 unsigned long ret; 184 184 185 - sys_dev = get_cpu_sysdev(0); 185 + dev = get_cpu_device(0); 186 186 187 - ret = sysfs_create_file(&sys_dev->kobj, 187 + ret = sysfs_create_file(&dev->kobj, 188 188 &cpm_idle_attr.attr); 189 189 if (ret) 190 190 printk(KERN_WARNING
+38 -38
arch/s390/kernel/smp.c
··· 831 831 } 832 832 833 833 #ifdef CONFIG_HOTPLUG_CPU 834 - static ssize_t cpu_configure_show(struct sys_device *dev, 835 - struct sysdev_attribute *attr, char *buf) 834 + static ssize_t cpu_configure_show(struct device *dev, 835 + struct device_attribute *attr, char *buf) 836 836 { 837 837 ssize_t count; 838 838 ··· 842 842 return count; 843 843 } 844 844 845 - static ssize_t cpu_configure_store(struct sys_device *dev, 846 - struct sysdev_attribute *attr, 845 + static ssize_t cpu_configure_store(struct device *dev, 846 + struct device_attribute *attr, 847 847 const char *buf, size_t count) 848 848 { 849 849 int cpu = dev->id; ··· 889 889 put_online_cpus(); 890 890 return rc ? rc : count; 891 891 } 892 - static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 892 + static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 893 893 #endif /* CONFIG_HOTPLUG_CPU */ 894 894 895 - static ssize_t cpu_polarization_show(struct sys_device *dev, 896 - struct sysdev_attribute *attr, char *buf) 895 + static ssize_t cpu_polarization_show(struct device *dev, 896 + struct device_attribute *attr, char *buf) 897 897 { 898 898 int cpu = dev->id; 899 899 ssize_t count; ··· 919 919 mutex_unlock(&smp_cpu_state_mutex); 920 920 return count; 921 921 } 922 - static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); 922 + static DEVICE_ATTR(polarization, 0444, cpu_polarization_show, NULL); 923 923 924 - static ssize_t show_cpu_address(struct sys_device *dev, 925 - struct sysdev_attribute *attr, char *buf) 924 + static ssize_t show_cpu_address(struct device *dev, 925 + struct device_attribute *attr, char *buf) 926 926 { 927 927 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); 928 928 } 929 - static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL); 929 + static DEVICE_ATTR(address, 0444, show_cpu_address, NULL); 930 930 931 931 932 932 static struct attribute *cpu_common_attrs[] = { 933 933 #ifdef CONFIG_HOTPLUG_CPU 934 - &attr_configure.attr, 934 + &dev_attr_configure.attr, 935 935 #endif 936 - &attr_address.attr, 937 - &attr_polarization.attr, 936 + &dev_attr_address.attr, 937 + &dev_attr_polarization.attr, 938 938 NULL, 939 939 }; 940 940 ··· 942 942 .attrs = cpu_common_attrs, 943 943 }; 944 944 945 - static ssize_t show_capability(struct sys_device *dev, 946 - struct sysdev_attribute *attr, char *buf) 945 + static ssize_t show_capability(struct device *dev, 946 + struct device_attribute *attr, char *buf) 947 947 { 948 948 unsigned int capability; 949 949 int rc; ··· 953 953 return rc; 954 954 return sprintf(buf, "%u\n", capability); 955 955 } 956 - static SYSDEV_ATTR(capability, 0444, show_capability, NULL); 956 + static DEVICE_ATTR(capability, 0444, show_capability, NULL); 957 957 958 - static ssize_t show_idle_count(struct sys_device *dev, 959 - struct sysdev_attribute *attr, char *buf) 958 + static ssize_t show_idle_count(struct device *dev, 959 + struct device_attribute *attr, char *buf) 960 960 { 961 961 struct s390_idle_data *idle; 962 962 unsigned long long idle_count; ··· 976 976 goto repeat; 977 977 return sprintf(buf, "%llu\n", idle_count); 978 978 } 979 - static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); 979 + static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); 980 980 981 - static ssize_t show_idle_time(struct sys_device *dev, 982 - struct sysdev_attribute *attr, char *buf) 981 + static ssize_t show_idle_time(struct device *dev, 982 + struct device_attribute *attr, char *buf) 983 983 { 984 984 struct s390_idle_data *idle; 985 985 unsigned long long now, idle_time, idle_enter; ··· 1001 1001 goto repeat; 1002 1002 return sprintf(buf, "%llu\n", idle_time >> 12); 1003 1003 } 1004 - static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); 1004 + static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL); 1005 1005 1006 1006 static struct attribute *cpu_online_attrs[] = { 1007 - &attr_capability.attr, 1008 - &attr_idle_count.attr, 1009 - &attr_idle_time_us.attr, 1007 + &dev_attr_capability.attr, 1008 + &dev_attr_idle_count.attr, 1009 + &dev_attr_idle_time_us.attr, 1010 1010 NULL, 1011 1011 }; 1012 1012 ··· 1019 1019 { 1020 1020 unsigned int cpu = (unsigned int)(long)hcpu; 1021 1021 struct cpu *c = &per_cpu(cpu_devices, cpu); 1022 - struct sys_device *s = &c->sysdev; 1022 + struct device *s = &c->dev; 1023 1023 struct s390_idle_data *idle; 1024 1024 int err = 0; 1025 1025 ··· 1045 1045 static int __devinit smp_add_present_cpu(int cpu) 1046 1046 { 1047 1047 struct cpu *c = &per_cpu(cpu_devices, cpu); 1048 - struct sys_device *s = &c->sysdev; 1048 + struct device *s = &c->dev; 1049 1049 int rc; 1050 1050 1051 1051 c->hotpluggable = 1; ··· 1098 1098 return rc; 1099 1099 } 1100 1100 1101 - static ssize_t __ref rescan_store(struct sysdev_class *class, 1102 - struct sysdev_class_attribute *attr, 1101 + static ssize_t __ref rescan_store(struct device *dev, 1102 + struct device_attribute *attr, 1103 1103 const char *buf, 1104 1104 size_t count) 1105 1105 { ··· 1108 1108 rc = smp_rescan_cpus(); 1109 1109 return rc ? rc : count; 1110 1110 } 1111 - static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); 1111 + static DEVICE_ATTR(rescan, 0200, NULL, rescan_store); 1112 1112 #endif /* CONFIG_HOTPLUG_CPU */ 1113 1113 1114 - static ssize_t dispatching_show(struct sysdev_class *class, 1115 - struct sysdev_class_attribute *attr, 1114 + static ssize_t dispatching_show(struct device *dev, 1115 + struct device_attribute *attr, 1116 1116 char *buf) 1117 1117 { 1118 1118 ssize_t count; ··· 1123 1123 return count; 1124 1124 } 1125 1125 1126 - static ssize_t dispatching_store(struct sysdev_class *dev, 1127 - struct sysdev_class_attribute *attr, 1126 + static ssize_t dispatching_store(struct device *dev, 1127 + struct device_attribute *attr, 1128 1128 const char *buf, 1129 1129 size_t count) 1130 1130 { ··· 1148 1148 put_online_cpus(); 1149 1149 return rc ? rc : count; 1150 1150 } 1151 - static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, 1151 + static DEVICE_ATTR(dispatching, 0644, dispatching_show, 1152 1152 dispatching_store); 1153 1153 1154 1154 static int __init topology_init(void) ··· 1159 1159 register_cpu_notifier(&smp_cpu_nb); 1160 1160 1161 1161 #ifdef CONFIG_HOTPLUG_CPU 1162 - rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan); 1162 + rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan); 1163 1163 if (rc) 1164 1164 return rc; 1165 1165 #endif 1166 - rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching); 1166 + rc = device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching); 1167 1167 if (rc) 1168 1168 return rc; 1169 1169 for_each_present_cpu(cpu) {
+3 -3
arch/s390/kernel/topology.c
··· 230 230 int arch_update_cpu_topology(void) 231 231 { 232 232 struct sysinfo_15_1_x *info = tl_info; 233 - struct sys_device *sysdev; 233 + struct device *dev; 234 234 int cpu; 235 235 236 236 if (!MACHINE_HAS_TOPOLOGY) { ··· 242 242 tl_to_cores(info); 243 243 update_cpu_core_map(); 244 244 for_each_online_cpu(cpu) { 245 - sysdev = get_cpu_sysdev(cpu); 246 - kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 245 + dev = get_cpu_device(cpu); 246 + kobject_uevent(&dev->kobj, KOBJ_CHANGE); 247 247 } 248 248 return 1; 249 249 }
+13 -11
arch/sh/kernel/cpu/sh4/sq.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/cpu.h> 15 15 #include <linux/bitmap.h> 16 - #include <linux/sysdev.h> 16 + #include <linux/device.h> 17 17 #include <linux/kernel.h> 18 18 #include <linux/module.h> 19 19 #include <linux/slab.h> ··· 337 337 .default_attrs = sq_sysfs_attrs, 338 338 }; 339 339 340 - static int __devinit sq_sysdev_add(struct sys_device *sysdev) 340 + static int __devinit sq_dev_add(struct device *dev) 341 341 { 342 - unsigned int cpu = sysdev->id; 342 + unsigned int cpu = dev->id; 343 343 struct kobject *kobj; 344 344 int error; 345 345 ··· 348 348 return -ENOMEM; 349 349 350 350 kobj = sq_kobject[cpu]; 351 - error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj, 351 + error = kobject_init_and_add(kobj, &ktype_percpu_entry, &dev->kobj, 352 352 "%s", "sq"); 353 353 if (!error) 354 354 kobject_uevent(kobj, KOBJ_ADD); 355 355 return error; 356 356 } 357 357 358 - static int __devexit sq_sysdev_remove(struct sys_device *sysdev) 358 + static int __devexit sq_dev_remove(struct device *dev) 359 359 { 360 - unsigned int cpu = sysdev->id; 360 + unsigned int cpu = dev->id; 361 361 struct kobject *kobj = sq_kobject[cpu]; 362 362 363 363 kobject_put(kobj); 364 364 return 0; 365 365 } 366 366 367 - static struct sysdev_driver sq_sysdev_driver = { 368 - .add = sq_sysdev_add, 369 - .remove = __devexit_p(sq_sysdev_remove), 367 + static struct subsys_interface sq_interface = { 368 + .name = "sq" 369 + .subsys = &cpu_subsys, 370 + .add_dev = sq_dev_add, 371 + .remove_dev = __devexit_p(sq_dev_remove), 370 372 }; 371 373 372 374 static int __init sq_api_init(void) ··· 388 386 if (unlikely(!sq_bitmap)) 389 387 goto out; 390 388 391 - ret = sysdev_driver_register(&cpu_sysdev_class, &sq_sysdev_driver); 389 + ret = subsys_interface_register(&sq_interface); 392 390 if (unlikely(ret != 0)) 393 391 goto out; 394 392 ··· 403 401 404 402 static void __exit sq_api_exit(void) 405 403 { 406 - sysdev_driver_unregister(&cpu_sysdev_class, &sq_sysdev_driver); 404 + subsys_interface_unregister(&sq_interface); 407 405 kfree(sq_bitmap); 408 406 kmem_cache_destroy(sq_cache); 409 407 }
+61 -61
arch/sparc/kernel/sysfs.c
··· 3 3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 4 4 */ 5 5 #include <linux/sched.h> 6 - #include <linux/sysdev.h> 6 + #include <linux/device.h> 7 7 #include <linux/cpu.h> 8 8 #include <linux/smp.h> 9 9 #include <linux/percpu.h> ··· 16 16 static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); 17 17 18 18 #define SHOW_MMUSTAT_ULONG(NAME) \ 19 - static ssize_t show_##NAME(struct sys_device *dev, \ 20 - struct sysdev_attribute *attr, char *buf) \ 19 + static ssize_t show_##NAME(struct device *dev, \ 20 + struct device_attribute *attr, char *buf) \ 21 21 { \ 22 22 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ 23 23 return sprintf(buf, "%lu\n", p->NAME); \ 24 24 } \ 25 - static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL) 25 + static DEVICE_ATTR(NAME, 0444, show_##NAME, NULL) 26 26 27 27 SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte); 28 28 SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte); ··· 58 58 SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte); 59 59 60 60 static struct attribute *mmu_stat_attrs[] = { 61 - &attr_immu_tsb_hits_ctx0_8k_tte.attr, 62 - &attr_immu_tsb_ticks_ctx0_8k_tte.attr, 63 - &attr_immu_tsb_hits_ctx0_64k_tte.attr, 64 - &attr_immu_tsb_ticks_ctx0_64k_tte.attr, 65 - &attr_immu_tsb_hits_ctx0_4mb_tte.attr, 66 - &attr_immu_tsb_ticks_ctx0_4mb_tte.attr, 67 - &attr_immu_tsb_hits_ctx0_256mb_tte.attr, 68 - &attr_immu_tsb_ticks_ctx0_256mb_tte.attr, 69 - &attr_immu_tsb_hits_ctxnon0_8k_tte.attr, 70 - &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, 71 - &attr_immu_tsb_hits_ctxnon0_64k_tte.attr, 72 - &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, 73 - &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, 74 - &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, 75 - &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, 76 - &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, 77 - &attr_dmmu_tsb_hits_ctx0_8k_tte.attr, 78 - &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, 79 - &attr_dmmu_tsb_hits_ctx0_64k_tte.attr, 80 - &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, 81 - &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, 82 - &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, 83 - &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, 84 - &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, 85 - &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, 86 - &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, 87 - &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, 88 - &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, 89 - &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, 90 - &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, 91 - &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, 92 - &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, 61 + &dev_attr_immu_tsb_hits_ctx0_8k_tte.attr, 62 + &dev_attr_immu_tsb_ticks_ctx0_8k_tte.attr, 63 + &dev_attr_immu_tsb_hits_ctx0_64k_tte.attr, 64 + &dev_attr_immu_tsb_ticks_ctx0_64k_tte.attr, 65 + &dev_attr_immu_tsb_hits_ctx0_4mb_tte.attr, 66 + &dev_attr_immu_tsb_ticks_ctx0_4mb_tte.attr, 67 + &dev_attr_immu_tsb_hits_ctx0_256mb_tte.attr, 68 + &dev_attr_immu_tsb_ticks_ctx0_256mb_tte.attr, 69 + &dev_attr_immu_tsb_hits_ctxnon0_8k_tte.attr, 70 + &dev_attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, 71 + &dev_attr_immu_tsb_hits_ctxnon0_64k_tte.attr, 72 + &dev_attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, 73 + &dev_attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, 74 + &dev_attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, 75 + &dev_attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, 76 + &dev_attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, 77 + &dev_attr_dmmu_tsb_hits_ctx0_8k_tte.attr, 78 + &dev_attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, 79 + &dev_attr_dmmu_tsb_hits_ctx0_64k_tte.attr, 80 + &dev_attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, 81 + &dev_attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, 82 + &dev_attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, 83 + &dev_attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, 84 + &dev_attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, 85 + &dev_attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, 86 + &dev_attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, 87 + &dev_attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, 88 + &dev_attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, 89 + &dev_attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, 90 + &dev_attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, 91 + &dev_attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, 92 + &dev_attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, 93 93 NULL, 94 94 }; 95 95 ··· 139 139 return sun4v_mmustat_conf(ra, &orig_ra); 140 140 } 141 141 142 - static ssize_t show_mmustat_enable(struct sys_device *s, 143 - struct sysdev_attribute *attr, char *buf) 142 + static ssize_t show_mmustat_enable(struct device *s, 143 + struct device_attribute *attr, char *buf) 144 144 { 145 145 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); 146 146 return sprintf(buf, "%lx\n", val); 147 147 } 148 148 149 - static ssize_t store_mmustat_enable(struct sys_device *s, 150 - struct sysdev_attribute *attr, const char *buf, 149 + static ssize_t store_mmustat_enable(struct device *s, 150 + struct device_attribute *attr, const char *buf, 151 151 size_t count) 152 152 { 153 153 unsigned long val, err; ··· 163 163 return count; 164 164 } 165 165 166 - static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); 166 + static DEVICE_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); 167 167 168 168 static int mmu_stats_supported; 169 169 170 - static int register_mmu_stats(struct sys_device *s) 170 + static int register_mmu_stats(struct device *s) 171 171 { 172 172 if (!mmu_stats_supported) 173 173 return 0; 174 - sysdev_create_file(s, &attr_mmustat_enable); 174 + device_create_file(s, &dev_attr_mmustat_enable); 175 175 return sysfs_create_group(&s->kobj, &mmu_stat_group); 176 176 } 177 177 178 178 #ifdef CONFIG_HOTPLUG_CPU 179 - static void unregister_mmu_stats(struct sys_device *s) 179 + static void unregister_mmu_stats(struct device *s) 180 180 { 181 181 if (!mmu_stats_supported) 182 182 return; 183 183 sysfs_remove_group(&s->kobj, &mmu_stat_group); 184 - sysdev_remove_file(s, &attr_mmustat_enable); 184 + device_remove_file(s, &dev_attr_mmustat_enable); 185 185 } 186 186 #endif 187 187 188 188 #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ 189 - static ssize_t show_##NAME(struct sys_device *dev, \ 190 - struct sysdev_attribute *attr, char *buf) \ 189 + static ssize_t show_##NAME(struct device *dev, \ 190 + struct device_attribute *attr, char *buf) \ 191 191 { \ 192 192 cpuinfo_sparc *c = &cpu_data(dev->id); \ 193 193 return sprintf(buf, "%lu\n", c->MEMBER); \ 194 194 } 195 195 196 196 #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ 197 - static ssize_t show_##NAME(struct sys_device *dev, \ 198 - struct sysdev_attribute *attr, char *buf) \ 197 + static ssize_t show_##NAME(struct device *dev, \ 198 + struct device_attribute *attr, char *buf) \ 199 199 { \ 200 200 cpuinfo_sparc *c = &cpu_data(dev->id); \ 201 201 return sprintf(buf, "%u\n", c->MEMBER); \ ··· 209 209 SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size); 210 210 SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size); 211 211 212 - static struct sysdev_attribute cpu_core_attrs[] = { 213 - _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL), 214 - _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), 215 - _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), 216 - _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), 217 - _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), 218 - _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), 219 - _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), 212 + static struct device_attribute cpu_core_attrs[] = { 213 + __ATTR(clock_tick, 0444, show_clock_tick, NULL), 214 + __ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), 215 + __ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), 216 + __ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), 217 + __ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), 218 + __ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), 219 + __ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), 220 220 }; 221 221 222 222 static DEFINE_PER_CPU(struct cpu, cpu_devices); ··· 224 224 static void register_cpu_online(unsigned int cpu) 225 225 { 226 226 struct cpu *c = &per_cpu(cpu_devices, cpu); 227 - struct sys_device *s = &c->sysdev; 227 + struct device *s = &c->dev; 228 228 int i; 229 229 230 230 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) 231 - sysdev_create_file(s, &cpu_core_attrs[i]); 231 + device_create_file(s, &cpu_core_attrs[i]); 232 232 233 233 register_mmu_stats(s); 234 234 } ··· 237 237 static void unregister_cpu_online(unsigned int cpu) 238 238 { 239 239 struct cpu *c = &per_cpu(cpu_devices, cpu); 240 - struct sys_device *s = &c->sysdev; 240 + struct device *s = &c->dev; 241 241 int i; 242 242 243 243 unregister_mmu_stats(s); 244 244 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) 245 - sysdev_remove_file(s, &cpu_core_attrs[i]); 245 + device_remove_file(s, &cpu_core_attrs[i]); 246 246 } 247 247 #endif 248 248
+30 -31
arch/tile/kernel/sysfs.c
··· 14 14 * /sys entry support. 15 15 */ 16 16 17 - #include <linux/sysdev.h> 17 + #include <linux/device.h> 18 18 #include <linux/cpu.h> 19 19 #include <linux/slab.h> 20 20 #include <linux/smp.h> ··· 31 31 return n; 32 32 } 33 33 34 - static ssize_t chip_width_show(struct sysdev_class *dev, 35 - struct sysdev_class_attribute *attr, 34 + static ssize_t chip_width_show(struct device *dev, 35 + struct device_attribute *attr, 36 36 char *page) 37 37 { 38 38 return sprintf(page, "%u\n", smp_width); 39 39 } 40 - static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL); 40 + static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL); 41 41 42 - static ssize_t chip_height_show(struct sysdev_class *dev, 43 - struct sysdev_class_attribute *attr, 42 + static ssize_t chip_height_show(struct device *dev, 43 + struct device_attribute *attr, 44 44 char *page) 45 45 { 46 46 return sprintf(page, "%u\n", smp_height); 47 47 } 48 - static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL); 48 + static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL); 49 49 50 - static ssize_t chip_serial_show(struct sysdev_class *dev, 51 - struct sysdev_class_attribute *attr, 50 + static ssize_t chip_serial_show(struct device *dev, 51 + struct device_attribute *attr, 52 52 char *page) 53 53 { 54 54 return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM); 55 55 } 56 - static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL); 56 + static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL); 57 57 58 - static ssize_t chip_revision_show(struct sysdev_class *dev, 59 - struct sysdev_class_attribute *attr, 58 + static ssize_t chip_revision_show(struct device *dev, 59 + struct device_attribute *attr, 60 60 char *page) 61 61 { 62 62 return get_hv_confstr(page, HV_CONFSTR_CHIP_REV); 63 63 } 64 - static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL); 64 + static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL); 65 65 66 66 67 - static ssize_t type_show(struct sysdev_class *dev, 68 - struct sysdev_class_attribute *attr, 67 + static ssize_t type_show(struct device *dev, 68 + struct device_attribute *attr, 69 69 char *page) 70 70 { 71 71 return sprintf(page, "tilera\n"); 72 72 } 73 - static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL); 73 + static DEVICE_ATTR(type, 0444, type_show, NULL); 74 74 75 75 #define HV_CONF_ATTR(name, conf) \ 76 - static ssize_t name ## _show(struct sysdev_class *dev, \ 77 - struct sysdev_class_attribute *attr, \ 76 + static ssize_t name ## _show(struct device *dev, \ 77 + struct device_attribute *attr, \ 78 78 char *page) \ 79 79 { \ 80 80 return get_hv_confstr(page, conf); \ 81 81 } \ 82 - static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL); 82 + static DEVICE_ATTR(name, 0444, name ## _show, NULL); 83 83 84 84 HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER) 85 85 HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER) ··· 95 95 HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL) 96 96 97 97 static struct attribute *board_attrs[] = { 98 - &attr_board_part.attr, 99 - &attr_board_serial.attr, 100 - &attr_board_revision.attr, 101 - &attr_board_description.attr, 102 - &attr_mezz_part.attr, 103 - &attr_mezz_serial.attr, 104 - &attr_mezz_revision.attr, 105 - &attr_mezz_description.attr, 106 - &attr_switch_control.attr, 98 + &dev_attr_board_part.attr, 99 + &dev_attr_board_serial.attr, 100 + &dev_attr_board_revision.attr, 101 + &dev_attr_board_description.attr, 102 + &dev_attr_mezz_part.attr, 103 + &dev_attr_mezz_serial.attr, 104 + &dev_attr_mezz_revision.attr, 105 + &dev_attr_mezz_description.attr, 106 + &dev_attr_switch_control.attr, 107 107 NULL 108 108 }; 109 109 ··· 150 150 151 151 static int __init create_sysfs_entries(void) 152 152 { 153 - struct sysdev_class *cls = &cpu_sysdev_class; 154 153 int err = 0; 155 154 156 155 #define create_cpu_attr(name) \ 157 156 if (!err) \ 158 - err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr); 157 + err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name); 159 158 create_cpu_attr(chip_width); 160 159 create_cpu_attr(chip_height); 161 160 create_cpu_attr(chip_serial); ··· 162 163 163 164 #define create_hv_attr(name) \ 164 165 if (!err) \ 165 - err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr); 166 + err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name); 166 167 create_hv_attr(type); 167 168 create_hv_attr(version); 168 169 create_hv_attr(config_version);
+1 -1
arch/x86/include/asm/mce.h
··· 149 149 150 150 void mce_setup(struct mce *m); 151 151 void mce_log(struct mce *m); 152 - DECLARE_PER_CPU(struct sys_device, mce_sysdev); 152 + DECLARE_PER_CPU(struct device, mce_device); 153 153 154 154 /* 155 155 * Maximum banks number.
+12 -13
arch/x86/kernel/cpu/intel_cacheinfo.c
··· 844 844 845 845 #include <linux/kobject.h> 846 846 #include <linux/sysfs.h> 847 - 848 - extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */ 847 + #include <linux/cpu.h> 849 848 850 849 /* pointer to kobject for cpuX/cache */ 851 850 static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); ··· 1072 1073 static DECLARE_BITMAP(cache_dev_map, NR_CPUS); 1073 1074 1074 1075 /* Add/Remove cache interface for CPU device */ 1075 - static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 1076 + static int __cpuinit cache_add_dev(struct device *dev) 1076 1077 { 1077 - unsigned int cpu = sys_dev->id; 1078 + unsigned int cpu = dev->id; 1078 1079 unsigned long i, j; 1079 1080 struct _index_kobject *this_object; 1080 1081 struct _cpuid4_info *this_leaf; ··· 1086 1087 1087 1088 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), 1088 1089 &ktype_percpu_entry, 1089 - &sys_dev->kobj, "%s", "cache"); 1090 + &dev->kobj, "%s", "cache"); 1090 1091 if (retval < 0) { 1091 1092 cpuid4_cache_sysfs_exit(cpu); 1092 1093 return retval; ··· 1123 1124 return 0; 1124 1125 } 1125 1126 1126 - static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) 1127 + static void __cpuinit cache_remove_dev(struct device *dev) 1127 1128 { 1128 - unsigned int cpu = sys_dev->id; 1129 + unsigned int cpu = dev->id; 1129 1130 unsigned long i; 1130 1131 1131 1132 if (per_cpu(ici_cpuid4_info, cpu) == NULL) ··· 1144 1145 unsigned long action, void *hcpu) 1145 1146 { 1146 1147 unsigned int cpu = (unsigned long)hcpu; 1147 - struct sys_device *sys_dev; 1148 + struct device *dev; 1148 1149 1149 - sys_dev = get_cpu_sysdev(cpu); 1150 + dev = get_cpu_device(cpu); 1150 1151 switch (action) { 1151 1152 case CPU_ONLINE: 1152 1153 case CPU_ONLINE_FROZEN: 1153 - cache_add_dev(sys_dev); 1154 + cache_add_dev(dev); 1154 1155 break; 1155 1156 case CPU_DEAD: 1156 1157 case CPU_DEAD_FROZEN: 1157 - cache_remove_dev(sys_dev); 1158 + cache_remove_dev(dev); 1158 1159 break; 1159 1160 } 1160 1161 return NOTIFY_OK; ··· 1173 1174 1174 1175 for_each_online_cpu(i) { 1175 1176 int err; 1176 - struct sys_device *sys_dev = get_cpu_sysdev(i); 1177 + struct device *dev = get_cpu_device(i); 1177 1178 1178 - err = cache_add_dev(sys_dev); 1179 + err = cache_add_dev(dev); 1179 1180 if (err) 1180 1181 return err; 1181 1182 }
+2 -2
arch/x86/kernel/cpu/mcheck/mce-internal.h
··· 1 - #include <linux/sysdev.h> 1 + #include <linux/device.h> 2 2 #include <asm/mce.h> 3 3 4 4 enum severity_level { ··· 17 17 struct mce_bank { 18 18 u64 ctl; /* subevents to enable */ 19 19 unsigned char init; /* initialise bank? */ 20 - struct sysdev_attribute attr; /* sysdev attribute */ 20 + struct device_attribute attr; /* device attribute */ 21 21 char attrname[ATTR_LEN]; /* attribute name */ 22 22 }; 23 23
+64 -64
arch/x86/kernel/cpu/mcheck/mce.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/percpu.h> 21 21 #include <linux/string.h> 22 - #include <linux/sysdev.h> 22 + #include <linux/device.h> 23 23 #include <linux/syscore_ops.h> 24 24 #include <linux/delay.h> 25 25 #include <linux/ctype.h> ··· 1751 1751 }; 1752 1752 1753 1753 /* 1754 - * mce_sysdev: Sysfs support 1754 + * mce_device: Sysfs support 1755 1755 */ 1756 1756 1757 1757 static void mce_cpu_restart(void *data) ··· 1787 1787 __mcheck_cpu_init_timer(); 1788 1788 } 1789 1789 1790 - static struct sysdev_class mce_sysdev_class = { 1790 + static struct bus_type mce_subsys = { 1791 1791 .name = "machinecheck", 1792 + .dev_name = "machinecheck", 1792 1793 }; 1793 1794 1794 - DEFINE_PER_CPU(struct sys_device, mce_sysdev); 1795 + DEFINE_PER_CPU(struct device, mce_device); 1795 1796 1796 1797 __cpuinitdata 1797 1798 void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 1798 1799 1799 - static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr) 1800 + static inline struct mce_bank *attr_to_bank(struct device_attribute *attr) 1800 1801 { 1801 1802 return container_of(attr, struct mce_bank, attr); 1802 1803 } 1803 1804 1804 - static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, 1805 + static ssize_t show_bank(struct device *s, struct device_attribute *attr, 1805 1806 char *buf) 1806 1807 { 1807 1808 return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl); 1808 1809 } 1809 1810 1810 - static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, 1811 + static ssize_t set_bank(struct device *s, struct device_attribute *attr, 1811 1812 const char *buf, size_t size) 1812 1813 { 1813 1814 u64 new; ··· 1823 1822 } 1824 1823 1825 1824 static ssize_t 1826 - show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf) 1825 + show_trigger(struct device *s, struct device_attribute *attr, char *buf) 1827 1826 { 1828 1827 strcpy(buf, mce_helper); 1829 1828 strcat(buf, "\n"); 1830 1829 return strlen(mce_helper) + 1; 1831 1830 } 1832 1831 1833 - static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, 1832 + static ssize_t set_trigger(struct device *s, struct device_attribute *attr, 1834 1833 const char *buf, size_t siz) 1835 1834 { 1836 1835 char *p; ··· 1845 1844 return strlen(mce_helper) + !!p; 1846 1845 } 1847 1846 1848 - static ssize_t set_ignore_ce(struct sys_device *s, 1849 - struct sysdev_attribute *attr, 1847 + static ssize_t set_ignore_ce(struct device *s, 1848 + struct device_attribute *attr, 1850 1849 const char *buf, size_t size) 1851 1850 { 1852 1851 u64 new; ··· 1869 1868 return size; 1870 1869 } 1871 1870 1872 - static ssize_t set_cmci_disabled(struct sys_device *s, 1873 - struct sysdev_attribute *attr, 1871 + static ssize_t set_cmci_disabled(struct device *s, 1872 + struct device_attribute *attr, 1874 1873 const char *buf, size_t size) 1875 1874 { 1876 1875 u64 new; ··· 1892 1891 return size; 1893 1892 } 1894 1893 1895 - static ssize_t store_int_with_restart(struct sys_device *s, 1896 - struct sysdev_attribute *attr, 1894 + static ssize_t store_int_with_restart(struct device *s, 1895 + struct device_attribute *attr, 1897 1896 const char *buf, size_t size) 1898 1897 { 1899 - ssize_t ret = sysdev_store_int(s, attr, buf, size); 1898 + ssize_t ret = device_store_int(s, attr, buf, size); 1900 1899 mce_restart(); 1901 1900 return ret; 1902 1901 } 1903 1902 1904 - static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); 1905 - static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); 1906 - static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); 1907 - static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); 1903 + static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger); 1904 + static DEVICE_INT_ATTR(tolerant, 0644, tolerant); 1905 + static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout); 1906 + static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); 1908 1907 1909 - static struct sysdev_ext_attribute attr_check_interval = { 1910 - _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int, 1911 - store_int_with_restart), 1908 + static struct dev_ext_attribute dev_attr_check_interval = { 1909 + __ATTR(check_interval, 0644, device_show_int, store_int_with_restart), 1912 1910 &check_interval 1913 1911 }; 1914 1912 1915 - static struct sysdev_ext_attribute attr_ignore_ce = { 1916 - _SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce), 1913 + static struct dev_ext_attribute dev_attr_ignore_ce = { 1914 + __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce), 1917 1915 &mce_ignore_ce 1918 1916 }; 1919 1917 1920 - static struct sysdev_ext_attribute attr_cmci_disabled = { 1921 - _SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled), 1918 + static struct dev_ext_attribute dev_attr_cmci_disabled = { 1919 + __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled), 1922 1920 &mce_cmci_disabled 1923 1921 }; 1924 1922 1925 - static struct sysdev_attribute *mce_sysdev_attrs[] = { 1926 - &attr_tolerant.attr, 1927 - &attr_check_interval.attr, 1928 - &attr_trigger, 1929 - &attr_monarch_timeout.attr, 1930 - &attr_dont_log_ce.attr, 1931 - &attr_ignore_ce.attr, 1932 - &attr_cmci_disabled.attr, 1923 + static struct device_attribute *mce_device_attrs[] = { 1924 + &dev_attr_tolerant.attr, 1925 + &dev_attr_check_interval.attr, 1926 + &dev_attr_trigger, 1927 + &dev_attr_monarch_timeout.attr, 1928 + &dev_attr_dont_log_ce.attr, 1929 + &dev_attr_ignore_ce.attr, 1930 + &dev_attr_cmci_disabled.attr, 1933 1931 NULL 1934 1932 }; 1935 1933 1936 - static cpumask_var_t mce_sysdev_initialized; 1934 + static cpumask_var_t mce_device_initialized; 1937 1935 1938 - /* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ 1939 - static __cpuinit int mce_sysdev_create(unsigned int cpu) 1936 + /* Per cpu device init. All of the cpus still share the same ctrl bank: */ 1937 + static __cpuinit int mce_device_create(unsigned int cpu) 1940 1938 { 1941 - struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 1939 + struct device *dev = &per_cpu(mce_device, cpu); 1942 1940 int err; 1943 1941 int i, j; 1944 1942 1945 1943 if (!mce_available(&boot_cpu_data)) 1946 1944 return -EIO; 1947 1945 1948 - memset(&sysdev->kobj, 0, sizeof(struct kobject)); 1949 - sysdev->id = cpu; 1950 - sysdev->cls = &mce_sysdev_class; 1946 + memset(&dev->kobj, 0, sizeof(struct kobject)); 1947 + dev->id = cpu; 1948 + dev->bus = &mce_subsys; 1951 1949 1952 - err = sysdev_register(sysdev); 1950 + err = device_register(dev); 1953 1951 if (err) 1954 1952 return err; 1955 1953 1956 - for (i = 0; mce_sysdev_attrs[i]; i++) { 1957 - err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]); 1954 + for (i = 0; mce_device_attrs[i]; i++) { 1955 + err = device_create_file(dev, mce_device_attrs[i]); 1958 1956 if (err) 1959 1957 goto error; 1960 1958 } 1961 1959 for (j = 0; j < banks; j++) { 1962 - err = sysdev_create_file(sysdev, &mce_banks[j].attr); 1960 + err = device_create_file(dev, &mce_banks[j].attr); 1963 1961 if (err) 1964 1962 goto error2; 1965 1963 } 1966 - cpumask_set_cpu(cpu, mce_sysdev_initialized); 1964 + cpumask_set_cpu(cpu, mce_device_initialized); 1967 1965 1968 1966 return 0; 1969 1967 error2: 1970 1968 while (--j >= 0) 1971 - sysdev_remove_file(sysdev, &mce_banks[j].attr); 1969 + device_remove_file(dev, &mce_banks[j].attr); 1972 1970 error: 1973 1971 while (--i >= 0) 1974 - sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 1972 + device_remove_file(dev, mce_device_attrs[i]); 1975 1973 1976 - sysdev_unregister(sysdev); 1974 + device_unregister(dev); 1977 1975 1978 1976 return err; 1979 1977 } 1980 1978 1981 - static __cpuinit void mce_sysdev_remove(unsigned int cpu) 1979 + static __cpuinit void mce_device_remove(unsigned int cpu) 1982 1980 { 1983 - struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 1981 + struct device *dev = &per_cpu(mce_device, cpu); 1984 1982 int i; 1985 1983 1986 - if (!cpumask_test_cpu(cpu, mce_sysdev_initialized)) 1984 + if (!cpumask_test_cpu(cpu, mce_device_initialized)) 1987 1985 return; 1988 1986 1989 - for (i = 0; mce_sysdev_attrs[i]; i++) 1990 - sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 1987 + for (i = 0; mce_device_attrs[i]; i++) 1988 + device_remove_file(dev, mce_device_attrs[i]); 1991 1989 1992 1990 for (i = 0; i < banks; i++) 1993 - sysdev_remove_file(sysdev, &mce_banks[i].attr); 1991 + device_remove_file(dev, &mce_banks[i].attr); 1994 1992 1995 - sysdev_unregister(sysdev); 1996 - cpumask_clear_cpu(cpu, mce_sysdev_initialized); 1993 + device_unregister(dev); 1994 + cpumask_clear_cpu(cpu, mce_device_initialized); 1997 1995 } 1998 1996 1999 1997 /* Make sure there are no machine checks on offlined CPUs. */ ··· 2042 2042 switch (action) { 2043 2043 case CPU_ONLINE: 2044 2044 case CPU_ONLINE_FROZEN: 2045 - mce_sysdev_create(cpu); 2045 + mce_device_create(cpu); 2046 2046 if (threshold_cpu_callback) 2047 2047 threshold_cpu_callback(action, cpu); 2048 2048 break; ··· 2050 2050 case CPU_DEAD_FROZEN: 2051 2051 if (threshold_cpu_callback) 2052 2052 threshold_cpu_callback(action, cpu); 2053 - mce_sysdev_remove(cpu); 2053 + mce_device_remove(cpu); 2054 2054 break; 2055 2055 case CPU_DOWN_PREPARE: 2056 2056 case CPU_DOWN_PREPARE_FROZEN: ··· 2084 2084 2085 2085 for (i = 0; i < banks; i++) { 2086 2086 struct mce_bank *b = &mce_banks[i]; 2087 - struct sysdev_attribute *a = &b->attr; 2087 + struct device_attribute *a = &b->attr; 2088 2088 2089 2089 sysfs_attr_init(&a->attr); 2090 2090 a->attr.name = b->attrname; ··· 2104 2104 if (!mce_available(&boot_cpu_data)) 2105 2105 return -EIO; 2106 2106 2107 - zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL); 2107 + zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL); 2108 2108 2109 2109 mce_init_banks(); 2110 2110 2111 - err = sysdev_class_register(&mce_sysdev_class); 2111 + err = subsys_system_register(&mce_subsys, NULL); 2112 2112 if (err) 2113 2113 return err; 2114 2114 2115 2115 for_each_online_cpu(i) { 2116 - err = mce_sysdev_create(i); 2116 + err = mce_device_create(i); 2117 2117 if (err) 2118 2118 return err; 2119 2119 }
+5 -6
arch/x86/kernel/cpu/mcheck/mce_amd.c
··· 17 17 #include <linux/notifier.h> 18 18 #include <linux/kobject.h> 19 19 #include <linux/percpu.h> 20 - #include <linux/sysdev.h> 21 20 #include <linux/errno.h> 22 21 #include <linux/sched.h> 23 22 #include <linux/sysfs.h> ··· 547 548 if (!b) 548 549 goto out; 549 550 550 - err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj, 551 + err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj, 551 552 b->kobj, name); 552 553 if (err) 553 554 goto out; ··· 570 571 goto out; 571 572 } 572 573 573 - b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj); 574 + b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj); 574 575 if (!b->kobj) 575 576 goto out_free; 576 577 ··· 590 591 if (i == cpu) 591 592 continue; 592 593 593 - err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj, 594 + err = sysfs_create_link(&per_cpu(mce_device, i).kobj, 594 595 b->kobj, name); 595 596 if (err) 596 597 goto out; ··· 668 669 #ifdef CONFIG_SMP 669 670 /* sibling symlink */ 670 671 if (shared_bank[bank] && b->blocks->cpu != cpu) { 671 - sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name); 672 + sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name); 672 673 per_cpu(threshold_banks, cpu)[bank] = NULL; 673 674 674 675 return; ··· 680 681 if (i == cpu) 681 682 continue; 682 683 683 - sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name); 684 + sysfs_remove_link(&per_cpu(mce_device, i).kobj, name); 684 685 per_cpu(threshold_banks, i)[bank] = NULL; 685 686 } 686 687
+31 -32
arch/x86/kernel/cpu/mcheck/therm_throt.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/percpu.h> 21 21 #include <linux/export.h> 22 - #include <linux/sysdev.h> 23 22 #include <linux/types.h> 24 23 #include <linux/init.h> 25 24 #include <linux/smp.h> ··· 68 69 static u32 lvtthmr_init __read_mostly; 69 70 70 71 #ifdef CONFIG_SYSFS 71 - #define define_therm_throt_sysdev_one_ro(_name) \ 72 - static SYSDEV_ATTR(_name, 0444, \ 73 - therm_throt_sysdev_show_##_name, \ 72 + #define define_therm_throt_device_one_ro(_name) \ 73 + static DEVICE_ATTR(_name, 0444, \ 74 + therm_throt_device_show_##_name, \ 74 75 NULL) \ 75 76 76 - #define define_therm_throt_sysdev_show_func(event, name) \ 77 + #define define_therm_throt_device_show_func(event, name) \ 77 78 \ 78 - static ssize_t therm_throt_sysdev_show_##event##_##name( \ 79 - struct sys_device *dev, \ 80 - struct sysdev_attribute *attr, \ 79 + static ssize_t therm_throt_device_show_##event##_##name( \ 80 + struct device *dev, \ 81 + struct device_attribute *attr, \ 81 82 char *buf) \ 82 83 { \ 83 84 unsigned int cpu = dev->id; \ ··· 94 95 return ret; \ 95 96 } 96 97 97 - define_therm_throt_sysdev_show_func(core_throttle, count); 98 - define_therm_throt_sysdev_one_ro(core_throttle_count); 98 + define_therm_throt_device_show_func(core_throttle, count); 99 + define_therm_throt_device_one_ro(core_throttle_count); 99 100 100 - define_therm_throt_sysdev_show_func(core_power_limit, count); 101 - define_therm_throt_sysdev_one_ro(core_power_limit_count); 101 + define_therm_throt_device_show_func(core_power_limit, count); 102 + define_therm_throt_device_one_ro(core_power_limit_count); 102 103 103 - define_therm_throt_sysdev_show_func(package_throttle, count); 104 - define_therm_throt_sysdev_one_ro(package_throttle_count); 104 + define_therm_throt_device_show_func(package_throttle, count); 105 + define_therm_throt_device_one_ro(package_throttle_count); 105 106 106 - define_therm_throt_sysdev_show_func(package_power_limit, count); 107 - define_therm_throt_sysdev_one_ro(package_power_limit_count); 107 + define_therm_throt_device_show_func(package_power_limit, count); 108 + define_therm_throt_device_one_ro(package_power_limit_count); 108 109 109 110 static struct attribute *thermal_throttle_attrs[] = { 110 - &attr_core_throttle_count.attr, 111 + &dev_attr_core_throttle_count.attr, 111 112 NULL 112 113 }; 113 114 ··· 222 223 223 224 #ifdef CONFIG_SYSFS 224 225 /* Add/Remove thermal_throttle interface for CPU device: */ 225 - static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, 226 + static __cpuinit int thermal_throttle_add_dev(struct device *dev, 226 227 unsigned int cpu) 227 228 { 228 229 int err; 229 230 struct cpuinfo_x86 *c = &cpu_data(cpu); 230 231 231 - err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); 232 + err = sysfs_create_group(&dev->kobj, &thermal_attr_group); 232 233 if (err) 233 234 return err; 234 235 235 236 if (cpu_has(c, X86_FEATURE_PLN)) 236 - err = sysfs_add_file_to_group(&sys_dev->kobj, 237 - &attr_core_power_limit_count.attr, 237 + err = sysfs_add_file_to_group(&dev->kobj, 238 + &dev_attr_core_power_limit_count.attr, 238 239 thermal_attr_group.name); 239 240 if (cpu_has(c, X86_FEATURE_PTS)) { 240 - err = sysfs_add_file_to_group(&sys_dev->kobj, 241 - &attr_package_throttle_count.attr, 241 + err = sysfs_add_file_to_group(&dev->kobj, 242 + &dev_attr_package_throttle_count.attr, 242 243 thermal_attr_group.name); 243 244 if (cpu_has(c, X86_FEATURE_PLN)) 244 - err = sysfs_add_file_to_group(&sys_dev->kobj, 245 - &attr_package_power_limit_count.attr, 245 + err = sysfs_add_file_to_group(&dev->kobj, 246 + &dev_attr_package_power_limit_count.attr, 246 247 thermal_attr_group.name); 247 248 } 248 249 249 250 return err; 250 251 } 251 252 252 - static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) 253 + static __cpuinit void thermal_throttle_remove_dev(struct device *dev) 253 254 { 254 - sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group); 255 + sysfs_remove_group(&dev->kobj, &thermal_attr_group); 255 256 } 256 257 257 258 /* Mutex protecting device creation against CPU hotplug: */ ··· 264 265 void *hcpu) 265 266 { 266 267 unsigned int cpu = (unsigned long)hcpu; 267 - struct sys_device *sys_dev; 268 + struct device *dev; 268 269 int err = 0; 269 270 270 - sys_dev = get_cpu_sysdev(cpu); 271 + dev = get_cpu_device(cpu); 271 272 272 273 switch (action) { 273 274 case CPU_UP_PREPARE: 274 275 case CPU_UP_PREPARE_FROZEN: 275 276 mutex_lock(&therm_cpu_lock); 276 - err = thermal_throttle_add_dev(sys_dev, cpu); 277 + err = thermal_throttle_add_dev(dev, cpu); 277 278 mutex_unlock(&therm_cpu_lock); 278 279 WARN_ON(err); 279 280 break; ··· 282 283 case CPU_DEAD: 283 284 case CPU_DEAD_FROZEN: 284 285 mutex_lock(&therm_cpu_lock); 285 - thermal_throttle_remove_dev(sys_dev); 286 + thermal_throttle_remove_dev(dev); 286 287 mutex_unlock(&therm_cpu_lock); 287 288 break; 288 289 } ··· 309 310 #endif 310 311 /* connect live CPUs to sysfs */ 311 312 for_each_online_cpu(cpu) { 312 - err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); 313 + err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu); 313 314 WARN_ON(err); 314 315 } 315 316 #ifdef CONFIG_HOTPLUG_CPU
+30 -28
arch/x86/kernel/microcode_core.c
··· 292 292 return err; 293 293 } 294 294 295 - static ssize_t reload_store(struct sys_device *dev, 296 - struct sysdev_attribute *attr, 295 + static ssize_t reload_store(struct device *dev, 296 + struct device_attribute *attr, 297 297 const char *buf, size_t size) 298 298 { 299 299 unsigned long val; ··· 318 318 return ret; 319 319 } 320 320 321 - static ssize_t version_show(struct sys_device *dev, 322 - struct sysdev_attribute *attr, char *buf) 321 + static ssize_t version_show(struct device *dev, 322 + struct device_attribute *attr, char *buf) 323 323 { 324 324 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 325 325 326 326 return sprintf(buf, "0x%x\n", uci->cpu_sig.rev); 327 327 } 328 328 329 - static ssize_t pf_show(struct sys_device *dev, 330 - struct sysdev_attribute *attr, char *buf) 329 + static ssize_t pf_show(struct device *dev, 330 + struct device_attribute *attr, char *buf) 331 331 { 332 332 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 333 333 334 334 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); 335 335 } 336 336 337 - static SYSDEV_ATTR(reload, 0200, NULL, reload_store); 338 - static SYSDEV_ATTR(version, 0400, version_show, NULL); 339 - static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL); 337 + static DEVICE_ATTR(reload, 0200, NULL, reload_store); 338 + static DEVICE_ATTR(version, 0400, version_show, NULL); 339 + static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL); 340 340 341 341 static struct attribute *mc_default_attrs[] = { 342 - &attr_reload.attr, 343 - &attr_version.attr, 344 - &attr_processor_flags.attr, 342 + &dev_attr_reload.attr, 343 + &dev_attr_version.attr, 344 + &dev_attr_processor_flags.attr, 345 345 NULL 346 346 }; 347 347 ··· 405 405 return ustate; 406 406 } 407 407 408 - static int mc_sysdev_add(struct sys_device *sys_dev) 408 + static int mc_device_add(struct device *dev, struct subsys_interface *sif) 409 409 { 410 - int err, cpu = sys_dev->id; 410 + int err, cpu = dev->id; 411 411 412 412 if (!cpu_online(cpu)) 413 413 return 0; 414 414 415 415 pr_debug("CPU%d added\n", cpu); 416 416 417 - err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 417 + err = sysfs_create_group(&dev->kobj, &mc_attr_group); 418 418 if (err) 419 419 return err; 420 420 421 421 if (microcode_init_cpu(cpu) == UCODE_ERROR) { 422 - sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 422 + sysfs_remove_group(&dev->kobj, &mc_attr_group); 423 423 return -EINVAL; 424 424 } 425 425 426 426 return err; 427 427 } 428 428 429 - static int mc_sysdev_remove(struct sys_device *sys_dev) 429 + static int mc_device_remove(struct device *dev, struct subsys_interface *sif) 430 430 { 431 - int cpu = sys_dev->id; 431 + int cpu = dev->id; 432 432 433 433 if (!cpu_online(cpu)) 434 434 return 0; 435 435 436 436 pr_debug("CPU%d removed\n", cpu); 437 437 microcode_fini_cpu(cpu); 438 - sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 438 + sysfs_remove_group(&dev->kobj, &mc_attr_group); 439 439 return 0; 440 440 } 441 441 442 - static struct sysdev_driver mc_sysdev_driver = { 443 - .add = mc_sysdev_add, 444 - .remove = mc_sysdev_remove, 442 + static struct subsys_interface mc_cpu_interface = { 443 + .name = "microcode", 444 + .subsys = &cpu_subsys, 445 + .add_dev = mc_device_add, 446 + .remove_dev = mc_device_remove, 445 447 }; 446 448 447 449 /** ··· 466 464 mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 467 465 { 468 466 unsigned int cpu = (unsigned long)hcpu; 469 - struct sys_device *sys_dev; 467 + struct device *dev; 470 468 471 - sys_dev = get_cpu_sysdev(cpu); 469 + dev = get_cpu_device(cpu); 472 470 switch (action) { 473 471 case CPU_ONLINE: 474 472 case CPU_ONLINE_FROZEN: ··· 476 474 case CPU_DOWN_FAILED: 477 475 case CPU_DOWN_FAILED_FROZEN: 478 476 pr_debug("CPU%d added\n", cpu); 479 - if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) 477 + if (sysfs_create_group(&dev->kobj, &mc_attr_group)) 480 478 pr_err("Failed to create group for CPU%d\n", cpu); 481 479 break; 482 480 case CPU_DOWN_PREPARE: 483 481 case CPU_DOWN_PREPARE_FROZEN: 484 482 /* Suspend is in progress, only remove the interface */ 485 - sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 483 + sysfs_remove_group(&dev->kobj, &mc_attr_group); 486 484 pr_debug("CPU%d removed\n", cpu); 487 485 break; 488 486 ··· 529 527 get_online_cpus(); 530 528 mutex_lock(&microcode_mutex); 531 529 532 - error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver); 530 + error = subsys_interface_register(&mc_cpu_interface); 533 531 534 532 mutex_unlock(&microcode_mutex); 535 533 put_online_cpus(); ··· 563 561 get_online_cpus(); 564 562 mutex_lock(&microcode_mutex); 565 563 566 - sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); 564 + subsys_interface_unregister(&mc_cpu_interface); 567 565 568 566 mutex_unlock(&microcode_mutex); 569 567 put_online_cpus();
+3 -3
drivers/acpi/processor_driver.c
··· 446 446 { 447 447 struct acpi_processor *pr = NULL; 448 448 int result = 0; 449 - struct sys_device *sysdev; 449 + struct device *dev; 450 450 451 451 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); 452 452 if (!pr) ··· 491 491 492 492 per_cpu(processors, pr->id) = pr; 493 493 494 - sysdev = get_cpu_sysdev(pr->id); 495 - if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { 494 + dev = get_cpu_device(pr->id); 495 + if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { 496 496 result = -EFAULT; 497 497 goto err_free_cpumask; 498 498 }
-1
drivers/acpi/processor_thermal.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/init.h> 32 32 #include <linux/cpufreq.h> 33 - #include <linux/sysdev.h> 34 33 35 34 #include <asm/uaccess.h> 36 35
+78 -70
drivers/base/cpu.c
··· 1 1 /* 2 - * drivers/base/cpu.c - basic CPU class support 2 + * CPU subsystem support 3 3 */ 4 4 5 - #include <linux/sysdev.h> 6 5 #include <linux/module.h> 7 6 #include <linux/init.h> 8 7 #include <linux/sched.h> ··· 13 14 14 15 #include "base.h" 15 16 16 - static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; 17 - 18 - struct sysdev_class cpu_sysdev_class = { 17 + struct bus_type cpu_subsys = { 19 18 .name = "cpu", 20 - .attrs = cpu_sysdev_class_attrs, 19 + .dev_name = "cpu", 21 20 }; 22 - EXPORT_SYMBOL(cpu_sysdev_class); 21 + EXPORT_SYMBOL_GPL(cpu_subsys); 23 22 24 - static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); 23 + static DEFINE_PER_CPU(struct device *, cpu_sys_devices); 25 24 26 25 #ifdef CONFIG_HOTPLUG_CPU 27 - static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, 26 + static ssize_t show_online(struct device *dev, 27 + struct device_attribute *attr, 28 28 char *buf) 29 29 { 30 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 30 + struct cpu *cpu = container_of(dev, struct cpu, dev); 31 31 32 - return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); 32 + return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id)); 33 33 } 34 34 35 - static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, 36 - const char *buf, size_t count) 35 + static ssize_t __ref store_online(struct device *dev, 36 + struct device_attribute *attr, 37 + const char *buf, size_t count) 37 38 { 38 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 39 + struct cpu *cpu = container_of(dev, struct cpu, dev); 39 40 ssize_t ret; 40 41 41 42 cpu_hotplug_driver_lock(); 42 43 switch (buf[0]) { 43 44 case '0': 44 - ret = cpu_down(cpu->sysdev.id); 45 + ret = cpu_down(cpu->dev.id); 45 46 if (!ret) 46 47 kobject_uevent(&dev->kobj, KOBJ_OFFLINE); 47 48 break; 48 49 case '1': 49 - ret = cpu_up(cpu->sysdev.id); 50 + ret = cpu_up(cpu->dev.id); 50 51 if (!ret) 51 52 kobject_uevent(&dev->kobj, KOBJ_ONLINE); 52 53 break; ··· 59 60 ret = count; 60 61 return ret; 61 62 } 62 - static SYSDEV_ATTR(online, 0644, show_online, store_online); 63 + static DEVICE_ATTR(online, 0644, show_online, store_online); 63 64 64 65 static void __cpuinit register_cpu_control(struct cpu *cpu) 65 66 { 66 - sysdev_create_file(&cpu->sysdev, &attr_online); 67 + device_create_file(&cpu->dev, &dev_attr_online); 67 68 } 68 69 void unregister_cpu(struct cpu *cpu) 69 70 { 70 - int logical_cpu = cpu->sysdev.id; 71 + int logical_cpu = cpu->dev.id; 71 72 72 73 unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); 73 74 74 - sysdev_remove_file(&cpu->sysdev, &attr_online); 75 + device_remove_file(&cpu->dev, &dev_attr_online); 75 76 76 - sysdev_unregister(&cpu->sysdev); 77 + device_unregister(&cpu->dev); 77 78 per_cpu(cpu_sys_devices, logical_cpu) = NULL; 78 79 return; 79 80 } 80 81 81 82 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 82 - static ssize_t cpu_probe_store(struct sysdev_class *class, 83 - struct sysdev_class_attribute *attr, 83 + static ssize_t cpu_probe_store(struct device *dev, 84 + struct device_attribute *attr, 84 85 const char *buf, 85 86 size_t count) 86 87 { 87 88 return arch_cpu_probe(buf, count); 88 89 } 89 90 90 - static ssize_t cpu_release_store(struct sysdev_class *class, 91 - struct sysdev_class_attribute *attr, 91 + static ssize_t cpu_release_store(struct device *dev, 92 + struct device_attribute *attr, 92 93 const char *buf, 93 94 size_t count) 94 95 { 95 96 return arch_cpu_release(buf, count); 96 97 } 97 98 98 - static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 99 - static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); 99 + static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 100 + static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); 100 101 #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ 101 102 102 103 #else /* ... !CONFIG_HOTPLUG_CPU */ ··· 108 109 #ifdef CONFIG_KEXEC 109 110 #include <linux/kexec.h> 110 111 111 - static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, 112 + static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr, 112 113 char *buf) 113 114 { 114 - struct cpu *cpu = container_of(dev, struct cpu, sysdev); 115 + struct cpu *cpu = container_of(dev, struct cpu, dev); 115 116 ssize_t rc; 116 117 unsigned long long addr; 117 118 int cpunum; 118 119 119 - cpunum = cpu->sysdev.id; 120 + cpunum = cpu->dev.id; 120 121 121 122 /* 122 123 * Might be reading other cpu's data based on which cpu read thread ··· 128 129 rc = sprintf(buf, "%Lx\n", addr); 129 130 return rc; 130 131 } 131 - static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); 132 + static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL); 132 133 #endif 133 134 134 135 /* ··· 136 137 */ 137 138 138 139 struct cpu_attr { 139 - struct sysdev_class_attribute attr; 140 + struct device_attribute attr; 140 141 const struct cpumask *const * const map; 141 142 }; 142 143 143 - static ssize_t show_cpus_attr(struct sysdev_class *class, 144 - struct sysdev_class_attribute *attr, 144 + static ssize_t show_cpus_attr(struct device *dev, 145 + struct device_attribute *attr, 145 146 char *buf) 146 147 { 147 148 struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr); ··· 152 153 return n; 153 154 } 154 155 155 - #define _CPU_ATTR(name, map) \ 156 - { _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map } 156 + #define _CPU_ATTR(name, map) \ 157 + { __ATTR(name, 0444, show_cpus_attr, NULL), map } 157 158 158 - /* Keep in sync with cpu_sysdev_class_attrs */ 159 + /* Keep in sync with cpu_subsys_attrs */ 159 160 static struct cpu_attr cpu_attrs[] = { 160 161 _CPU_ATTR(online, &cpu_online_mask), 161 162 _CPU_ATTR(possible, &cpu_possible_mask), ··· 165 166 /* 166 167 * Print values for NR_CPUS and offlined cpus 167 168 */ 168 - static ssize_t print_cpus_kernel_max(struct sysdev_class *class, 169 - struct sysdev_class_attribute *attr, char *buf) 169 + static ssize_t print_cpus_kernel_max(struct device *dev, 170 + struct device_attribute *attr, char *buf) 170 171 { 171 172 int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); 172 173 return n; 173 174 } 174 - static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); 175 + static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); 175 176 176 177 /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ 177 178 unsigned int total_cpus; 178 179 179 - static ssize_t print_cpus_offline(struct sysdev_class *class, 180 - struct sysdev_class_attribute *attr, char *buf) 180 + static ssize_t print_cpus_offline(struct device *dev, 181 + struct device_attribute *attr, char *buf) 181 182 { 182 183 int n = 0, len = PAGE_SIZE-2; 183 184 cpumask_var_t offline; ··· 204 205 n += snprintf(&buf[n], len - n, "\n"); 205 206 return n; 206 207 } 207 - static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); 208 + static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); 208 209 209 210 /* 210 211 * register_cpu - Setup a sysfs device for a CPU. ··· 217 218 int __cpuinit register_cpu(struct cpu *cpu, int num) 218 219 { 219 220 int error; 221 + 220 222 cpu->node_id = cpu_to_node(num); 221 - cpu->sysdev.id = num; 222 - cpu->sysdev.cls = &cpu_sysdev_class; 223 - 224 - error = sysdev_register(&cpu->sysdev); 225 - 223 + cpu->dev.id = num; 224 + cpu->dev.bus = &cpu_subsys; 225 + error = device_register(&cpu->dev); 226 226 if (!error && cpu->hotpluggable) 227 227 register_cpu_control(cpu); 228 228 if (!error) 229 - per_cpu(cpu_sys_devices, num) = &cpu->sysdev; 229 + per_cpu(cpu_sys_devices, num) = &cpu->dev; 230 230 if (!error) 231 231 register_cpu_under_node(num, cpu_to_node(num)); 232 232 233 233 #ifdef CONFIG_KEXEC 234 234 if (!error) 235 - error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); 235 + error = device_create_file(&cpu->dev, &dev_attr_crash_notes); 236 236 #endif 237 237 return error; 238 238 } 239 239 240 - struct sys_device *get_cpu_sysdev(unsigned cpu) 240 + struct device *get_cpu_device(unsigned cpu) 241 241 { 242 242 if (cpu < nr_cpu_ids && cpu_possible(cpu)) 243 243 return per_cpu(cpu_sys_devices, cpu); 244 244 else 245 245 return NULL; 246 246 } 247 - EXPORT_SYMBOL_GPL(get_cpu_sysdev); 247 + EXPORT_SYMBOL_GPL(get_cpu_device); 248 + 249 + static struct attribute *cpu_root_attrs[] = { 250 + #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 251 + &dev_attr_probe.attr, 252 + &dev_attr_release.attr, 253 + #endif 254 + &cpu_attrs[0].attr.attr, 255 + &cpu_attrs[1].attr.attr, 256 + &cpu_attrs[2].attr.attr, 257 + &dev_attr_kernel_max.attr, 258 + &dev_attr_offline.attr, 259 + NULL 260 + }; 261 + 262 + static struct attribute_group cpu_root_attr_group = { 263 + .attrs = cpu_root_attrs, 264 + }; 265 + 266 + static const struct attribute_group *cpu_root_attr_groups[] = { 267 + &cpu_root_attr_group, 268 + NULL, 269 + }; 248 270 249 271 int __init cpu_dev_init(void) 250 272 { 251 273 int err; 252 274 253 - err = sysdev_class_register(&cpu_sysdev_class); 254 - #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 255 - if (!err) 256 - err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); 257 - #endif 275 + err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups); 276 + if (err) 277 + return err; 258 278 279 + #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 280 + err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); 281 + #endif 259 282 return err; 260 283 } 261 - 262 - static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = { 263 - #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 264 - &attr_probe, 265 - &attr_release, 266 - #endif 267 - &cpu_attrs[0].attr, 268 - &cpu_attrs[1].attr, 269 - &cpu_attrs[2].attr, 270 - &attr_kernel_max, 271 - &attr_offline, 272 - NULL 273 - };
+4 -4
drivers/base/node.c
··· 315 315 int register_cpu_under_node(unsigned int cpu, unsigned int nid) 316 316 { 317 317 int ret; 318 - struct sys_device *obj; 318 + struct device *obj; 319 319 320 320 if (!node_online(nid)) 321 321 return 0; 322 322 323 - obj = get_cpu_sysdev(cpu); 323 + obj = get_cpu_device(cpu); 324 324 if (!obj) 325 325 return 0; 326 326 ··· 337 337 338 338 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) 339 339 { 340 - struct sys_device *obj; 340 + struct device *obj; 341 341 342 342 if (!node_online(nid)) 343 343 return 0; 344 344 345 - obj = get_cpu_sysdev(cpu); 345 + obj = get_cpu_device(cpu); 346 346 if (!obj) 347 347 return 0; 348 348
+25 -26
drivers/base/topology.c
··· 23 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 24 * 25 25 */ 26 - #include <linux/sysdev.h> 27 26 #include <linux/init.h> 28 27 #include <linux/mm.h> 29 28 #include <linux/cpu.h> ··· 31 32 #include <linux/topology.h> 32 33 33 34 #define define_one_ro_named(_name, _func) \ 34 - static SYSDEV_ATTR(_name, 0444, _func, NULL) 35 + static DEVICE_ATTR(_name, 0444, _func, NULL) 35 36 36 37 #define define_one_ro(_name) \ 37 - static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) 38 + static DEVICE_ATTR(_name, 0444, show_##_name, NULL) 38 39 39 40 #define define_id_show_func(name) \ 40 - static ssize_t show_##name(struct sys_device *dev, \ 41 - struct sysdev_attribute *attr, char *buf) \ 41 + static ssize_t show_##name(struct device *dev, \ 42 + struct device_attribute *attr, char *buf) \ 42 43 { \ 43 44 unsigned int cpu = dev->id; \ 44 45 return sprintf(buf, "%d\n", topology_##name(cpu)); \ ··· 64 65 65 66 #ifdef arch_provides_topology_pointers 66 67 #define define_siblings_show_map(name) \ 67 - static ssize_t show_##name(struct sys_device *dev, \ 68 - struct sysdev_attribute *attr, char *buf) \ 68 + static ssize_t show_##name(struct device *dev, \ 69 + struct device_attribute *attr, char *buf) \ 69 70 { \ 70 71 unsigned int cpu = dev->id; \ 71 72 return show_cpumap(0, topology_##name(cpu), buf); \ 72 73 } 73 74 74 75 #define define_siblings_show_list(name) \ 75 - static ssize_t show_##name##_list(struct sys_device *dev, \ 76 - struct sysdev_attribute *attr, \ 76 + static ssize_t show_##name##_list(struct device *dev, \ 77 + struct device_attribute *attr, \ 77 78 char *buf) \ 78 79 { \ 79 80 unsigned int cpu = dev->id; \ ··· 82 83 83 84 #else 84 85 #define define_siblings_show_map(name) \ 85 - static ssize_t show_##name(struct sys_device *dev, \ 86 - struct sysdev_attribute *attr, char *buf) \ 86 + static ssize_t show_##name(struct device *dev, \ 87 + struct device_attribute *attr, char *buf) \ 87 88 { \ 88 89 return show_cpumap(0, topology_##name(dev->id), buf); \ 89 90 } 90 91 91 92 #define define_siblings_show_list(name) \ 92 - static ssize_t show_##name##_list(struct sys_device *dev, \ 93 - struct sysdev_attribute *attr, \ 93 + static ssize_t show_##name##_list(struct device *dev, \ 94 + struct device_attribute *attr, \ 94 95 char *buf) \ 95 96 { \ 96 97 return show_cpumap(1, topology_##name(dev->id), buf); \ ··· 123 124 #endif 124 125 125 126 static struct attribute *default_attrs[] = { 126 - &attr_physical_package_id.attr, 127 - &attr_core_id.attr, 128 - &attr_thread_siblings.attr, 129 - &attr_thread_siblings_list.attr, 130 - &attr_core_siblings.attr, 131 - &attr_core_siblings_list.attr, 127 + &dev_attr_physical_package_id.attr, 128 + &dev_attr_core_id.attr, 129 + &dev_attr_thread_siblings.attr, 130 + &dev_attr_thread_siblings_list.attr, 131 + &dev_attr_core_siblings.attr, 132 + &dev_attr_core_siblings_list.attr, 132 133 #ifdef CONFIG_SCHED_BOOK 133 - &attr_book_id.attr, 134 - &attr_book_siblings.attr, 135 - &attr_book_siblings_list.attr, 134 + &dev_attr_book_id.attr, 135 + &dev_attr_book_siblings.attr, 136 + &dev_attr_book_siblings_list.attr, 136 137 #endif 137 138 NULL 138 139 }; ··· 145 146 /* Add/Remove cpu_topology interface for CPU device */ 146 147 static int __cpuinit topology_add_dev(unsigned int cpu) 147 148 { 148 - struct sys_device *sys_dev = get_cpu_sysdev(cpu); 149 + struct device *dev = get_cpu_device(cpu); 149 150 150 - return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); 151 + return sysfs_create_group(&dev->kobj, &topology_attr_group); 151 152 } 152 153 153 154 static void __cpuinit topology_remove_dev(unsigned int cpu) 154 155 { 155 - struct sys_device *sys_dev = get_cpu_sysdev(cpu); 156 + struct device *dev = get_cpu_device(cpu); 156 157 157 - sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); 158 + sysfs_remove_group(&dev->kobj, &topology_attr_group); 158 159 } 159 160 160 161 static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,
+39 -40
drivers/cpufreq/cpufreq.c
··· 679 679 */ 680 680 static int cpufreq_add_dev_policy(unsigned int cpu, 681 681 struct cpufreq_policy *policy, 682 - struct sys_device *sys_dev) 682 + struct device *dev) 683 683 { 684 684 int ret = 0; 685 685 #ifdef CONFIG_SMP ··· 728 728 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 729 729 730 730 pr_debug("CPU already managed, adding link\n"); 731 - ret = sysfs_create_link(&sys_dev->kobj, 731 + ret = sysfs_create_link(&dev->kobj, 732 732 &managed_policy->kobj, 733 733 "cpufreq"); 734 734 if (ret) ··· 761 761 762 762 for_each_cpu(j, policy->cpus) { 763 763 struct cpufreq_policy *managed_policy; 764 - struct sys_device *cpu_sys_dev; 764 + struct device *cpu_dev; 765 765 766 766 if (j == cpu) 767 767 continue; ··· 770 770 771 771 pr_debug("CPU %u already managed, adding link\n", j); 772 772 managed_policy = cpufreq_cpu_get(cpu); 773 - cpu_sys_dev = get_cpu_sysdev(j); 774 - ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 773 + cpu_dev = get_cpu_device(j); 774 + ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj, 775 775 "cpufreq"); 776 776 if (ret) { 777 777 cpufreq_cpu_put(managed_policy); ··· 783 783 784 784 static int cpufreq_add_dev_interface(unsigned int cpu, 785 785 struct cpufreq_policy *policy, 786 - struct sys_device *sys_dev) 786 + struct device *dev) 787 787 { 788 788 struct cpufreq_policy new_policy; 789 789 struct freq_attr **drv_attr; ··· 793 793 794 794 /* prepare interface data */ 795 795 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, 796 - &sys_dev->kobj, "cpufreq"); 796 + &dev->kobj, "cpufreq"); 797 797 if (ret) 798 798 return ret; 799 799 ··· 866 866 * with with cpu hotplugging and all hell will break loose. Tried to clean this 867 867 * mess up, but more thorough testing is needed. - Mathieu 868 868 */ 869 - static int cpufreq_add_dev(struct sys_device *sys_dev) 869 + static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) 870 870 { 871 - unsigned int cpu = sys_dev->id; 871 + unsigned int cpu = dev->id; 872 872 int ret = 0, found = 0; 873 873 struct cpufreq_policy *policy; 874 874 unsigned long flags; ··· 947 947 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 948 948 CPUFREQ_START, policy); 949 949 950 - ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); 950 + ret = cpufreq_add_dev_policy(cpu, policy, dev); 951 951 if (ret) { 952 952 if (ret > 0) 953 953 /* This is a managed cpu, symlink created, ··· 956 956 goto err_unlock_policy; 957 957 } 958 958 959 - ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); 959 + ret = cpufreq_add_dev_interface(cpu, policy, dev); 960 960 if (ret) 961 961 goto err_out_unregister; 962 962 ··· 999 999 * Caller should already have policy_rwsem in write mode for this CPU. 1000 1000 * This routine frees the rwsem before returning. 1001 1001 */ 1002 - static int __cpufreq_remove_dev(struct sys_device *sys_dev) 1002 + static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) 1003 1003 { 1004 - unsigned int cpu = sys_dev->id; 1004 + unsigned int cpu = dev->id; 1005 1005 unsigned long flags; 1006 1006 struct cpufreq_policy *data; 1007 1007 struct kobject *kobj; 1008 1008 struct completion *cmp; 1009 1009 #ifdef CONFIG_SMP 1010 - struct sys_device *cpu_sys_dev; 1010 + struct device *cpu_dev; 1011 1011 unsigned int j; 1012 1012 #endif 1013 1013 ··· 1032 1032 pr_debug("removing link\n"); 1033 1033 cpumask_clear_cpu(cpu, data->cpus); 1034 1034 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1035 - kobj = &sys_dev->kobj; 1035 + kobj = &dev->kobj; 1036 1036 cpufreq_cpu_put(data); 1037 1037 unlock_policy_rwsem_write(cpu); 1038 1038 sysfs_remove_link(kobj, "cpufreq"); ··· 1071 1071 strncpy(per_cpu(cpufreq_cpu_governor, j), 1072 1072 data->governor->name, CPUFREQ_NAME_LEN); 1073 1073 #endif 1074 - cpu_sys_dev = get_cpu_sysdev(j); 1075 - kobj = &cpu_sys_dev->kobj; 1074 + cpu_dev = get_cpu_device(j); 1075 + kobj = &cpu_dev->kobj; 1076 1076 unlock_policy_rwsem_write(cpu); 1077 1077 sysfs_remove_link(kobj, "cpufreq"); 1078 1078 lock_policy_rwsem_write(cpu); ··· 1112 1112 if (unlikely(cpumask_weight(data->cpus) > 1)) { 1113 1113 /* first sibling now owns the new sysfs dir */ 1114 1114 cpumask_clear_cpu(cpu, data->cpus); 1115 - cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); 1115 + cpufreq_add_dev(get_cpu_device(cpumask_first(data->cpus)), NULL); 1116 1116 1117 1117 /* finally remove our own symlink */ 1118 1118 lock_policy_rwsem_write(cpu); 1119 - __cpufreq_remove_dev(sys_dev); 1119 + __cpufreq_remove_dev(dev, sif); 1120 1120 } 1121 1121 #endif 1122 1122 ··· 1128 1128 } 1129 1129 1130 1130 1131 - static int cpufreq_remove_dev(struct sys_device *sys_dev) 1131 + static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) 1132 1132 { 1133 - unsigned int cpu = sys_dev->id; 1133 + unsigned int cpu = dev->id; 1134 1134 int retval; 1135 1135 1136 1136 if (cpu_is_offline(cpu)) ··· 1139 1139 if (unlikely(lock_policy_rwsem_write(cpu))) 1140 1140 BUG(); 1141 1141 1142 - retval = __cpufreq_remove_dev(sys_dev); 1142 + retval = __cpufreq_remove_dev(dev, sif); 1143 1143 return retval; 1144 1144 } 1145 1145 ··· 1271 1271 } 1272 1272 EXPORT_SYMBOL(cpufreq_get); 1273 1273 1274 - static struct sysdev_driver cpufreq_sysdev_driver = { 1275 - .add = cpufreq_add_dev, 1276 - .remove = cpufreq_remove_dev, 1274 + static struct subsys_interface cpufreq_interface = { 1275 + .name = "cpufreq", 1276 + .subsys = &cpu_subsys, 1277 + .add_dev = cpufreq_add_dev, 1278 + .remove_dev = cpufreq_remove_dev, 1277 1279 }; 1278 1280 1279 1281 ··· 1767 1765 unsigned long action, void *hcpu) 1768 1766 { 1769 1767 unsigned int cpu = (unsigned long)hcpu; 1770 - struct sys_device *sys_dev; 1768 + struct device *dev; 1771 1769 1772 - sys_dev = get_cpu_sysdev(cpu); 1773 - if (sys_dev) { 1770 + dev = get_cpu_device(cpu); 1771 + if (dev) { 1774 1772 switch (action) { 1775 1773 case CPU_ONLINE: 1776 1774 case CPU_ONLINE_FROZEN: 1777 - cpufreq_add_dev(sys_dev); 1775 + cpufreq_add_dev(dev, NULL); 1778 1776 break; 1779 1777 case CPU_DOWN_PREPARE: 1780 1778 case CPU_DOWN_PREPARE_FROZEN: 1781 1779 if (unlikely(lock_policy_rwsem_write(cpu))) 1782 1780 BUG(); 1783 1781 1784 - __cpufreq_remove_dev(sys_dev); 1782 + __cpufreq_remove_dev(dev, NULL); 1785 1783 break; 1786 1784 case CPU_DOWN_FAILED: 1787 1785 case CPU_DOWN_FAILED_FROZEN: 1788 - cpufreq_add_dev(sys_dev); 1786 + cpufreq_add_dev(dev, NULL); 1789 1787 break; 1790 1788 } 1791 1789 } ··· 1832 1830 cpufreq_driver = driver_data; 1833 1831 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1834 1832 1835 - ret = sysdev_driver_register(&cpu_sysdev_class, 1836 - &cpufreq_sysdev_driver); 1833 + ret = subsys_interface_register(&cpufreq_interface); 1837 1834 if (ret) 1838 1835 goto err_null_driver; 1839 1836 ··· 1851 1850 if (ret) { 1852 1851 pr_debug("no CPU initialized for driver %s\n", 1853 1852 driver_data->name); 1854 - goto err_sysdev_unreg; 1853 + goto err_if_unreg; 1855 1854 } 1856 1855 } 1857 1856 ··· 1859 1858 pr_debug("driver %s up and running\n", driver_data->name); 1860 1859 1861 1860 return 0; 1862 - err_sysdev_unreg: 1863 - sysdev_driver_unregister(&cpu_sysdev_class, 1864 - &cpufreq_sysdev_driver); 1861 + err_if_unreg: 1862 + subsys_interface_unregister(&cpufreq_interface); 1865 1863 err_null_driver: 1866 1864 spin_lock_irqsave(&cpufreq_driver_lock, flags); 1867 1865 cpufreq_driver = NULL; ··· 1887 1887 1888 1888 pr_debug("unregistering driver %s\n", driver->name); 1889 1889 1890 - sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); 1890 + subsys_interface_unregister(&cpufreq_interface); 1891 1891 unregister_hotcpu_notifier(&cpufreq_cpu_notifier); 1892 1892 1893 1893 spin_lock_irqsave(&cpufreq_driver_lock, flags); ··· 1907 1907 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); 1908 1908 } 1909 1909 1910 - cpufreq_global_kobject = kobject_create_and_add("cpufreq", 1911 - &cpu_sysdev_class.kset.kobj); 1910 + cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj); 1912 1911 BUG_ON(!cpufreq_global_kobject); 1913 1912 register_syscore_ops(&cpufreq_syscore_ops); 1914 1913
-1
drivers/cpufreq/cpufreq_stats.c
··· 11 11 12 12 #include <linux/kernel.h> 13 13 #include <linux/slab.h> 14 - #include <linux/sysdev.h> 15 14 #include <linux/cpu.h> 16 15 #include <linux/sysfs.h> 17 16 #include <linux/cpufreq.h>
+6 -6
drivers/cpuidle/cpuidle.c
··· 291 291 static int __cpuidle_register_device(struct cpuidle_device *dev) 292 292 { 293 293 int ret; 294 - struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 294 + struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); 295 295 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 296 296 297 - if (!sys_dev) 297 + if (!dev) 298 298 return -EINVAL; 299 299 if (!try_module_get(cpuidle_driver->owner)) 300 300 return -EINVAL; ··· 303 303 304 304 per_cpu(cpuidle_devices, dev->cpu) = dev; 305 305 list_add(&dev->device_list, &cpuidle_detected_devices); 306 - if ((ret = cpuidle_add_sysfs(sys_dev))) { 306 + if ((ret = cpuidle_add_sysfs(cpu_dev))) { 307 307 module_put(cpuidle_driver->owner); 308 308 return ret; 309 309 } ··· 344 344 */ 345 345 void cpuidle_unregister_device(struct cpuidle_device *dev) 346 346 { 347 - struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 347 + struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); 348 348 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 349 349 350 350 if (dev->registered == 0) ··· 354 354 355 355 cpuidle_disable_device(dev); 356 356 357 - cpuidle_remove_sysfs(sys_dev); 357 + cpuidle_remove_sysfs(cpu_dev); 358 358 list_del(&dev->device_list); 359 359 wait_for_completion(&dev->kobj_unregister); 360 360 per_cpu(cpuidle_devices, dev->cpu) = NULL; ··· 411 411 if (cpuidle_disabled()) 412 412 return -ENODEV; 413 413 414 - ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); 414 + ret = cpuidle_add_interface(cpu_subsys.dev_root); 415 415 if (ret) 416 416 return ret; 417 417
+5 -5
drivers/cpuidle/cpuidle.h
··· 5 5 #ifndef __DRIVER_CPUIDLE_H 6 6 #define __DRIVER_CPUIDLE_H 7 7 8 - #include <linux/sysdev.h> 8 + #include <linux/device.h> 9 9 10 10 /* For internal use only */ 11 11 extern struct cpuidle_governor *cpuidle_curr_governor; ··· 23 23 extern int cpuidle_switch_governor(struct cpuidle_governor *gov); 24 24 25 25 /* sysfs */ 26 - extern int cpuidle_add_class_sysfs(struct sysdev_class *cls); 27 - extern void cpuidle_remove_class_sysfs(struct sysdev_class *cls); 26 + extern int cpuidle_add_interface(struct device *dev); 27 + extern void cpuidle_remove_interface(struct device *dev); 28 28 extern int cpuidle_add_state_sysfs(struct cpuidle_device *device); 29 29 extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device); 30 - extern int cpuidle_add_sysfs(struct sys_device *sysdev); 31 - extern void cpuidle_remove_sysfs(struct sys_device *sysdev); 30 + extern int cpuidle_add_sysfs(struct device *dev); 31 + extern void cpuidle_remove_sysfs(struct device *dev); 32 32 33 33 #endif /* __DRIVER_CPUIDLE_H */
+36 -38
drivers/cpuidle/sysfs.c
··· 22 22 } 23 23 __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); 24 24 25 - static ssize_t show_available_governors(struct sysdev_class *class, 26 - struct sysdev_class_attribute *attr, 25 + static ssize_t show_available_governors(struct device *dev, 26 + struct device_attribute *attr, 27 27 char *buf) 28 28 { 29 29 ssize_t i = 0; ··· 42 42 return i; 43 43 } 44 44 45 - static ssize_t show_current_driver(struct sysdev_class *class, 46 - struct sysdev_class_attribute *attr, 45 + static ssize_t show_current_driver(struct device *dev, 46 + struct device_attribute *attr, 47 47 char *buf) 48 48 { 49 49 ssize_t ret; ··· 59 59 return ret; 60 60 } 61 61 62 - static ssize_t show_current_governor(struct sysdev_class *class, 63 - struct sysdev_class_attribute *attr, 62 + static ssize_t show_current_governor(struct device *dev, 63 + struct device_attribute *attr, 64 64 char *buf) 65 65 { 66 66 ssize_t ret; ··· 75 75 return ret; 76 76 } 77 77 78 - static ssize_t store_current_governor(struct sysdev_class *class, 79 - struct sysdev_class_attribute *attr, 78 + static ssize_t store_current_governor(struct device *dev, 79 + struct device_attribute *attr, 80 80 const char *buf, size_t count) 81 81 { 82 82 char gov_name[CPUIDLE_NAME_LEN]; ··· 109 109 return count; 110 110 } 111 111 112 - static SYSDEV_CLASS_ATTR(current_driver, 0444, show_current_driver, NULL); 113 - static SYSDEV_CLASS_ATTR(current_governor_ro, 0444, show_current_governor, 114 - NULL); 112 + static DEVICE_ATTR(current_driver, 0444, show_current_driver, NULL); 113 + static DEVICE_ATTR(current_governor_ro, 0444, show_current_governor, NULL); 115 114 116 - static struct attribute *cpuclass_default_attrs[] = { 117 - &attr_current_driver.attr, 118 - &attr_current_governor_ro.attr, 115 + static struct attribute *cpuidle_default_attrs[] = { 116 + &dev_attr_current_driver.attr, 117 + &dev_attr_current_governor_ro.attr, 119 118 NULL 120 119 }; 121 120 122 - static SYSDEV_CLASS_ATTR(available_governors, 0444, show_available_governors, 123 - NULL); 124 - static SYSDEV_CLASS_ATTR(current_governor, 0644, show_current_governor, 125 - store_current_governor); 121 + static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL); 122 + static DEVICE_ATTR(current_governor, 0644, show_current_governor, 123 + store_current_governor); 126 124 127 - static struct attribute *cpuclass_switch_attrs[] = { 128 - &attr_available_governors.attr, 129 - &attr_current_driver.attr, 130 - &attr_current_governor.attr, 125 + static struct attribute *cpuidle_switch_attrs[] = { 126 + &dev_attr_available_governors.attr, 127 + &dev_attr_current_driver.attr, 128 + &dev_attr_current_governor.attr, 131 129 NULL 132 130 }; 133 131 134 - static struct attribute_group cpuclass_attr_group = { 135 - .attrs = cpuclass_default_attrs, 132 + static struct attribute_group cpuidle_attr_group = { 133 + .attrs = cpuidle_default_attrs, 136 134 .name = "cpuidle", 137 135 }; 138 136 139 137 /** 140 - * cpuidle_add_class_sysfs - add CPU global sysfs attributes 138 + * cpuidle_add_interface - add CPU global sysfs attributes 141 139 */ 142 - int cpuidle_add_class_sysfs(struct sysdev_class *cls) 140 + int cpuidle_add_interface(struct device *dev) 143 141 { 144 142 if (sysfs_switch) 145 - cpuclass_attr_group.attrs = cpuclass_switch_attrs; 143 + cpuidle_attr_group.attrs = cpuidle_switch_attrs; 146 144 147 - return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group); 145 + return sysfs_create_group(&dev->kobj, &cpuidle_attr_group); 148 146 } 149 147 150 148 /** 151 - * cpuidle_remove_class_sysfs - remove CPU global sysfs attributes 149 + * cpuidle_remove_interface - remove CPU global sysfs attributes 152 150 */ 153 - void cpuidle_remove_class_sysfs(struct sysdev_class *cls) 151 + void cpuidle_remove_interface(struct device *dev) 154 152 { 155 - sysfs_remove_group(&cls->kset.kobj, &cpuclass_attr_group); 153 + sysfs_remove_group(&dev->kobj, &cpuidle_attr_group); 156 154 } 157 155 158 156 struct cpuidle_attr { ··· 363 365 364 366 /** 365 367 * cpuidle_add_sysfs - creates a sysfs instance for the target device 366 - * @sysdev: the target device 368 + * @dev: the target device 367 369 */ 368 - int cpuidle_add_sysfs(struct sys_device *sysdev) 370 + int cpuidle_add_sysfs(struct device *cpu_dev) 369 371 { 370 - int cpu = sysdev->id; 372 + int cpu = cpu_dev->id; 371 373 struct cpuidle_device *dev; 372 374 int error; 373 375 374 376 dev = per_cpu(cpuidle_devices, cpu); 375 - error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, 377 + error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj, 376 378 "cpuidle"); 377 379 if (!error) 378 380 kobject_uevent(&dev->kobj, KOBJ_ADD); ··· 381 383 382 384 /** 383 385 * cpuidle_remove_sysfs - deletes a sysfs instance on the target device 384 - * @sysdev: the target device 386 + * @dev: the target device 385 387 */ 386 - void cpuidle_remove_sysfs(struct sys_device *sysdev) 388 + void cpuidle_remove_sysfs(struct device *cpu_dev) 387 389 { 388 - int cpu = sysdev->id; 390 + int cpu = cpu_dev->id; 389 391 struct cpuidle_device *dev; 390 392 391 393 dev = per_cpu(cpuidle_devices, cpu);
+4 -4
drivers/s390/char/sclp_config.c
··· 11 11 #include <linux/init.h> 12 12 #include <linux/errno.h> 13 13 #include <linux/cpu.h> 14 - #include <linux/sysdev.h> 14 + #include <linux/device.h> 15 15 #include <linux/workqueue.h> 16 16 #include <asm/smp.h> 17 17 ··· 31 31 static void sclp_cpu_capability_notify(struct work_struct *work) 32 32 { 33 33 int cpu; 34 - struct sys_device *sysdev; 34 + struct device *dev; 35 35 36 36 s390_adjust_jiffies(); 37 37 pr_warning("cpu capability changed.\n"); 38 38 get_online_cpus(); 39 39 for_each_online_cpu(cpu) { 40 - sysdev = get_cpu_sysdev(cpu); 41 - kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 40 + dev = get_cpu_device(cpu); 41 + kobject_uevent(&dev->kobj, KOBJ_CHANGE); 42 42 } 43 43 put_online_cpus(); 44 44 }
+9 -9
include/linux/cpu.h
··· 14 14 #ifndef _LINUX_CPU_H_ 15 15 #define _LINUX_CPU_H_ 16 16 17 - #include <linux/sysdev.h> 17 + #include <linux/device.h> 18 18 #include <linux/node.h> 19 19 #include <linux/compiler.h> 20 20 #include <linux/cpumask.h> ··· 22 22 struct cpu { 23 23 int node_id; /* The node which contains the CPU */ 24 24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 25 - struct sys_device sysdev; 25 + struct device dev; 26 26 }; 27 27 28 28 extern int register_cpu(struct cpu *cpu, int num); 29 - extern struct sys_device *get_cpu_sysdev(unsigned cpu); 29 + extern struct device *get_cpu_device(unsigned cpu); 30 30 31 - extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); 32 - extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); 31 + extern int cpu_add_dev_attr(struct device_attribute *attr); 32 + extern void cpu_remove_dev_attr(struct device_attribute *attr); 33 33 34 - extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 35 - extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 34 + extern int cpu_add_dev_attr_group(struct attribute_group *attrs); 35 + extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); 36 36 37 - extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 37 + extern int sched_create_sysfs_power_savings_entries(struct device *dev); 38 38 39 39 #ifdef CONFIG_HOTPLUG_CPU 40 40 extern void unregister_cpu(struct cpu *cpu); ··· 160 160 } 161 161 162 162 #endif /* CONFIG_SMP */ 163 - extern struct sysdev_class cpu_sysdev_class; 163 + extern struct bus_type cpu_subsys; 164 164 165 165 #ifdef CONFIG_HOTPLUG_CPU 166 166 /* Stop CPUs going up and down. */
+19 -21
kernel/sched.c
··· 7923 7923 } 7924 7924 7925 7925 #ifdef CONFIG_SCHED_MC 7926 - static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, 7927 - struct sysdev_class_attribute *attr, 7928 - char *page) 7926 + static ssize_t sched_mc_power_savings_show(struct device *dev, 7927 + struct device_attribute *attr, 7928 + char *buf) 7929 7929 { 7930 - return sprintf(page, "%u\n", sched_mc_power_savings); 7930 + return sprintf(buf, "%u\n", sched_mc_power_savings); 7931 7931 } 7932 - static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, 7933 - struct sysdev_class_attribute *attr, 7932 + static ssize_t sched_mc_power_savings_store(struct device *dev, 7933 + struct device_attribute *attr, 7934 7934 const char *buf, size_t count) 7935 7935 { 7936 7936 return sched_power_savings_store(buf, count, 0); 7937 7937 } 7938 - static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, 7939 - sched_mc_power_savings_show, 7940 - sched_mc_power_savings_store); 7938 + static DEVICE_ATTR(sched_mc_power_savings, 0644, 7939 + sched_mc_power_savings_show, 7940 + sched_mc_power_savings_store); 7941 7941 #endif 7942 7942 7943 7943 #ifdef CONFIG_SCHED_SMT 7944 - static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, 7945 - struct sysdev_class_attribute *attr, 7946 - char *page) 7944 + static ssize_t sched_smt_power_savings_show(struct device *dev, 7945 + struct device_attribute *attr, 7946 + char *buf) 7947 7947 { 7948 - return sprintf(page, "%u\n", sched_smt_power_savings); 7948 + return sprintf(buf, "%u\n", sched_smt_power_savings); 7949 7949 } 7950 - static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, 7951 - struct sysdev_class_attribute *attr, 7950 + static ssize_t sched_smt_power_savings_store(struct device *dev, 7951 + struct device_attribute *attr, 7952 7952 const char *buf, size_t count) 7953 7953 { 7954 7954 return sched_power_savings_store(buf, count, 1); 7955 7955 } 7956 - static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, 7956 + static DEVICE_ATTR(sched_smt_power_savings, 0644, 7957 7957 sched_smt_power_savings_show, 7958 7958 sched_smt_power_savings_store); 7959 7959 #endif 7960 7960 7961 - int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) 7961 + int __init sched_create_sysfs_power_savings_entries(struct device *dev) 7962 7962 { 7963 7963 int err = 0; 7964 7964 7965 7965 #ifdef CONFIG_SCHED_SMT 7966 7966 if (smt_capable()) 7967 - err = sysfs_create_file(&cls->kset.kobj, 7968 - &attr_sched_smt_power_savings.attr); 7967 + err = device_create_file(dev, &dev_attr_sched_smt_power_savings); 7969 7968 #endif 7970 7969 #ifdef CONFIG_SCHED_MC 7971 7970 if (!err && mc_capable()) 7972 - err = sysfs_create_file(&cls->kset.kobj, 7973 - &attr_sched_mc_power_savings.attr); 7971 + err = device_create_file(dev, &dev_attr_sched_mc_power_savings); 7974 7972 #endif 7975 7973 return err; 7976 7974 }