diff options
Diffstat (limited to 'arch/powerpc/kernel/sysfs.c')
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 261 |
1 files changed, 130 insertions, 131 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index ce035c1905f0..5e7c1655f13a 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include <linux/sysdev.h> | 1 | #include <linux/device.h> |
2 | #include <linux/cpu.h> | 2 | #include <linux/cpu.h> |
3 | #include <linux/smp.h> | 3 | #include <linux/smp.h> |
4 | #include <linux/percpu.h> | 4 | #include <linux/percpu.h> |
@@ -37,12 +37,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
37 | /* Time in microseconds we delay before sleeping in the idle loop */ | 37 | /* Time in microseconds we delay before sleeping in the idle loop */ |
38 | DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; | 38 | DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; |
39 | 39 | ||
40 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, | 40 | static ssize_t store_smt_snooze_delay(struct device *dev, |
41 | struct sysdev_attribute *attr, | 41 | struct device_attribute *attr, |
42 | const char *buf, | 42 | const char *buf, |
43 | size_t count) | 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 | ssize_t ret; | 46 | ssize_t ret; |
47 | long snooze; | 47 | long snooze; |
48 | 48 | ||
@@ -50,21 +50,21 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev, | |||
50 | if (ret != 1) | 50 | if (ret != 1) |
51 | return -EINVAL; | 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 | return count; | 55 | return count; |
56 | } | 56 | } |
57 | 57 | ||
58 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, | 58 | static ssize_t show_smt_snooze_delay(struct device *dev, |
59 | struct sysdev_attribute *attr, | 59 | struct device_attribute *attr, |
60 | char *buf) | 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 | store_smt_snooze_delay); | 68 | store_smt_snooze_delay); |
69 | 69 | ||
70 | static int __init setup_smt_snooze_delay(char *str) | 70 | static int __init setup_smt_snooze_delay(char *str) |
@@ -117,25 +117,25 @@ static void write_##NAME(void *val) \ | |||
117 | ppc_enable_pmcs(); \ | 117 | ppc_enable_pmcs(); \ |
118 | mtspr(ADDRESS, *(unsigned long *)val); \ | 118 | mtspr(ADDRESS, *(unsigned long *)val); \ |
119 | } \ | 119 | } \ |
120 | static ssize_t show_##NAME(struct sys_device *dev, \ | 120 | static ssize_t show_##NAME(struct device *dev, \ |
121 | struct sysdev_attribute *attr, \ | 121 | struct device_attribute *attr, \ |
122 | char *buf) \ | 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 | unsigned long val; \ | 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 | return sprintf(buf, "%lx\n", val); \ | 127 | return sprintf(buf, "%lx\n", val); \ |
128 | } \ | 128 | } \ |
129 | static ssize_t __used \ | 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 | const char *buf, size_t count) \ | 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 | unsigned long val; \ | 134 | unsigned long val; \ |
135 | int ret = sscanf(buf, "%lx", &val); \ | 135 | int ret = sscanf(buf, "%lx", &val); \ |
136 | if (ret != 1) \ | 136 | if (ret != 1) \ |
137 | return -EINVAL; \ | 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 | return count; \ | 139 | return count; \ |
140 | } | 140 | } |
141 | 141 | ||
@@ -178,22 +178,22 @@ SYSFS_PMCSETUP(purr, SPRN_PURR); | |||
178 | SYSFS_PMCSETUP(spurr, SPRN_SPURR); | 178 | SYSFS_PMCSETUP(spurr, SPRN_SPURR); |
179 | SYSFS_PMCSETUP(dscr, SPRN_DSCR); | 179 | SYSFS_PMCSETUP(dscr, SPRN_DSCR); |
180 | 180 | ||
181 | static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); | 181 | static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); |
182 | static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); | 182 | static DEVICE_ATTR(spurr, 0600, show_spurr, NULL); |
183 | static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); | 183 | static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); |
184 | static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); | 184 | static DEVICE_ATTR(purr, 0600, show_purr, store_purr); |
185 | 185 | ||
186 | unsigned long dscr_default = 0; | 186 | unsigned long dscr_default = 0; |
187 | EXPORT_SYMBOL(dscr_default); | 187 | EXPORT_SYMBOL(dscr_default); |
188 | 188 | ||
189 | static ssize_t show_dscr_default(struct sysdev_class *class, | 189 | static ssize_t show_dscr_default(struct device *dev, |
190 | struct sysdev_class_attribute *attr, char *buf) | 190 | struct device_attribute *attr, char *buf) |
191 | { | 191 | { |
192 | return sprintf(buf, "%lx\n", dscr_default); | 192 | return sprintf(buf, "%lx\n", dscr_default); |
193 | } | 193 | } |
194 | 194 | ||
195 | static ssize_t __used store_dscr_default(struct sysdev_class *class, | 195 | static ssize_t __used store_dscr_default(struct device *dev, |
196 | struct sysdev_class_attribute *attr, const char *buf, | 196 | struct device_attribute *attr, const char *buf, |
197 | size_t count) | 197 | size_t count) |
198 | { | 198 | { |
199 | unsigned long val; | 199 | unsigned long val; |
@@ -207,15 +207,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class, | |||
207 | return count; | 207 | return count; |
208 | } | 208 | } |
209 | 209 | ||
210 | static SYSDEV_CLASS_ATTR(dscr_default, 0600, | 210 | static DEVICE_ATTR(dscr_default, 0600, |
211 | show_dscr_default, store_dscr_default); | 211 | show_dscr_default, store_dscr_default); |
212 | 212 | ||
213 | static void sysfs_create_dscr_default(void) | 213 | static void sysfs_create_dscr_default(void) |
214 | { | 214 | { |
215 | int err = 0; | 215 | int err = 0; |
216 | if (cpu_has_feature(CPU_FTR_DSCR)) | 216 | if (cpu_has_feature(CPU_FTR_DSCR)) |
217 | err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | 217 | err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); |
218 | &attr_dscr_default.attr); | ||
219 | } | 218 | } |
220 | #endif /* CONFIG_PPC64 */ | 219 | #endif /* CONFIG_PPC64 */ |
221 | 220 | ||
@@ -259,72 +258,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); | |||
259 | #endif /* HAS_PPC_PMC_PA6T */ | 258 | #endif /* HAS_PPC_PMC_PA6T */ |
260 | 259 | ||
261 | #ifdef HAS_PPC_PMC_IBM | 260 | #ifdef HAS_PPC_PMC_IBM |
262 | static struct sysdev_attribute ibm_common_attrs[] = { | 261 | static struct device_attribute ibm_common_attrs[] = { |
263 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 262 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
264 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 263 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
265 | }; | 264 | }; |
266 | #endif /* HAS_PPC_PMC_G4 */ | 265 | #endif /* HAS_PPC_PMC_G4 */ |
267 | 266 | ||
268 | #ifdef HAS_PPC_PMC_G4 | 267 | #ifdef HAS_PPC_PMC_G4 |
269 | static struct sysdev_attribute g4_common_attrs[] = { | 268 | static struct device_attribute g4_common_attrs[] = { |
270 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 269 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
271 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 270 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
272 | _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), | 271 | __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), |
273 | }; | 272 | }; |
274 | #endif /* HAS_PPC_PMC_G4 */ | 273 | #endif /* HAS_PPC_PMC_G4 */ |
275 | 274 | ||
276 | static struct sysdev_attribute classic_pmc_attrs[] = { | 275 | static struct device_attribute classic_pmc_attrs[] = { |
277 | _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), | 276 | __ATTR(pmc1, 0600, show_pmc1, store_pmc1), |
278 | _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), | 277 | __ATTR(pmc2, 0600, show_pmc2, store_pmc2), |
279 | _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), | 278 | __ATTR(pmc3, 0600, show_pmc3, store_pmc3), |
280 | _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), | 279 | __ATTR(pmc4, 0600, show_pmc4, store_pmc4), |
281 | _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), | 280 | __ATTR(pmc5, 0600, show_pmc5, store_pmc5), |
282 | _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), | 281 | __ATTR(pmc6, 0600, show_pmc6, store_pmc6), |
283 | #ifdef CONFIG_PPC64 | 282 | #ifdef CONFIG_PPC64 |
284 | _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), | 283 | __ATTR(pmc7, 0600, show_pmc7, store_pmc7), |
285 | _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), | 284 | __ATTR(pmc8, 0600, show_pmc8, store_pmc8), |
286 | #endif | 285 | #endif |
287 | }; | 286 | }; |
288 | 287 | ||
289 | #ifdef HAS_PPC_PMC_PA6T | 288 | #ifdef HAS_PPC_PMC_PA6T |
290 | static struct sysdev_attribute pa6t_attrs[] = { | 289 | static struct device_attribute pa6t_attrs[] = { |
291 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 290 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
292 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 291 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
293 | _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), | 292 | __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), |
294 | _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), | 293 | __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), |
295 | _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), | 294 | __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), |
296 | _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), | 295 | __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), |
297 | _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), | 296 | __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), |
298 | _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), | 297 | __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), |
299 | #ifdef CONFIG_DEBUG_KERNEL | 298 | #ifdef CONFIG_DEBUG_KERNEL |
300 | _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), | 299 | __ATTR(hid0, 0600, show_hid0, store_hid0), |
301 | _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), | 300 | __ATTR(hid1, 0600, show_hid1, store_hid1), |
302 | _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), | 301 | __ATTR(hid4, 0600, show_hid4, store_hid4), |
303 | _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), | 302 | __ATTR(hid5, 0600, show_hid5, store_hid5), |
304 | _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), | 303 | __ATTR(ima0, 0600, show_ima0, store_ima0), |
305 | _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), | 304 | __ATTR(ima1, 0600, show_ima1, store_ima1), |
306 | _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), | 305 | __ATTR(ima2, 0600, show_ima2, store_ima2), |
307 | _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), | 306 | __ATTR(ima3, 0600, show_ima3, store_ima3), |
308 | _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), | 307 | __ATTR(ima4, 0600, show_ima4, store_ima4), |
309 | _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), | 308 | __ATTR(ima5, 0600, show_ima5, store_ima5), |
310 | _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), | 309 | __ATTR(ima6, 0600, show_ima6, store_ima6), |
311 | _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), | 310 | __ATTR(ima7, 0600, show_ima7, store_ima7), |
312 | _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), | 311 | __ATTR(ima8, 0600, show_ima8, store_ima8), |
313 | _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), | 312 | __ATTR(ima9, 0600, show_ima9, store_ima9), |
314 | _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), | 313 | __ATTR(imaat, 0600, show_imaat, store_imaat), |
315 | _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), | 314 | __ATTR(btcr, 0600, show_btcr, store_btcr), |
316 | _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), | 315 | __ATTR(pccr, 0600, show_pccr, store_pccr), |
317 | _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), | 316 | __ATTR(rpccr, 0600, show_rpccr, store_rpccr), |
318 | _SYSDEV_ATTR(der, 0600, show_der, store_der), | 317 | __ATTR(der, 0600, show_der, store_der), |
319 | _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), | 318 | __ATTR(mer, 0600, show_mer, store_mer), |
320 | _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), | 319 | __ATTR(ber, 0600, show_ber, store_ber), |
321 | _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), | 320 | __ATTR(ier, 0600, show_ier, store_ier), |
322 | _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), | 321 | __ATTR(sier, 0600, show_sier, store_sier), |
323 | _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), | 322 | __ATTR(siar, 0600, show_siar, store_siar), |
324 | _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), | 323 | __ATTR(tsr0, 0600, show_tsr0, store_tsr0), |
325 | _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), | 324 | __ATTR(tsr1, 0600, show_tsr1, store_tsr1), |
326 | _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), | 325 | __ATTR(tsr2, 0600, show_tsr2, store_tsr2), |
327 | _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), | 326 | __ATTR(tsr3, 0600, show_tsr3, store_tsr3), |
328 | #endif /* CONFIG_DEBUG_KERNEL */ | 327 | #endif /* CONFIG_DEBUG_KERNEL */ |
329 | }; | 328 | }; |
330 | #endif /* HAS_PPC_PMC_PA6T */ | 329 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -333,14 +332,14 @@ static struct sysdev_attribute pa6t_attrs[] = { | |||
333 | static void __cpuinit register_cpu_online(unsigned int cpu) | 332 | static void __cpuinit register_cpu_online(unsigned int cpu) |
334 | { | 333 | { |
335 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 334 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
336 | struct sys_device *s = &c->sysdev; | 335 | struct device *s = &c->dev; |
337 | struct sysdev_attribute *attrs, *pmc_attrs; | 336 | struct device_attribute *attrs, *pmc_attrs; |
338 | int i, nattrs; | 337 | int i, nattrs; |
339 | 338 | ||
340 | #ifdef CONFIG_PPC64 | 339 | #ifdef CONFIG_PPC64 |
341 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && | 340 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && |
342 | cpu_has_feature(CPU_FTR_SMT)) | 341 | cpu_has_feature(CPU_FTR_SMT)) |
343 | sysdev_create_file(s, &attr_smt_snooze_delay); | 342 | device_create_file(s, &dev_attr_smt_snooze_delay); |
344 | #endif | 343 | #endif |
345 | 344 | ||
346 | /* PMC stuff */ | 345 | /* PMC stuff */ |
@@ -348,14 +347,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
348 | #ifdef HAS_PPC_PMC_IBM | 347 | #ifdef HAS_PPC_PMC_IBM |
349 | case PPC_PMC_IBM: | 348 | case PPC_PMC_IBM: |
350 | attrs = ibm_common_attrs; | 349 | attrs = ibm_common_attrs; |
351 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); | 350 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); |
352 | pmc_attrs = classic_pmc_attrs; | 351 | pmc_attrs = classic_pmc_attrs; |
353 | break; | 352 | break; |
354 | #endif /* HAS_PPC_PMC_IBM */ | 353 | #endif /* HAS_PPC_PMC_IBM */ |
355 | #ifdef HAS_PPC_PMC_G4 | 354 | #ifdef HAS_PPC_PMC_G4 |
356 | case PPC_PMC_G4: | 355 | case PPC_PMC_G4: |
357 | attrs = g4_common_attrs; | 356 | attrs = g4_common_attrs; |
358 | nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); | 357 | nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); |
359 | pmc_attrs = classic_pmc_attrs; | 358 | pmc_attrs = classic_pmc_attrs; |
360 | break; | 359 | break; |
361 | #endif /* HAS_PPC_PMC_G4 */ | 360 | #endif /* HAS_PPC_PMC_G4 */ |
@@ -363,7 +362,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
363 | case PPC_PMC_PA6T: | 362 | case PPC_PMC_PA6T: |
364 | /* PA Semi starts counting at PMC0 */ | 363 | /* PA Semi starts counting at PMC0 */ |
365 | attrs = pa6t_attrs; | 364 | attrs = pa6t_attrs; |
366 | nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); | 365 | nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); |
367 | pmc_attrs = NULL; | 366 | pmc_attrs = NULL; |
368 | break; | 367 | break; |
369 | #endif /* HAS_PPC_PMC_PA6T */ | 368 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -374,24 +373,24 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
374 | } | 373 | } |
375 | 374 | ||
376 | for (i = 0; i < nattrs; i++) | 375 | for (i = 0; i < nattrs; i++) |
377 | sysdev_create_file(s, &attrs[i]); | 376 | device_create_file(s, &attrs[i]); |
378 | 377 | ||
379 | if (pmc_attrs) | 378 | if (pmc_attrs) |
380 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) | 379 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) |
381 | sysdev_create_file(s, &pmc_attrs[i]); | 380 | device_create_file(s, &pmc_attrs[i]); |
382 | 381 | ||
383 | #ifdef CONFIG_PPC64 | 382 | #ifdef CONFIG_PPC64 |
384 | if (cpu_has_feature(CPU_FTR_MMCRA)) | 383 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
385 | sysdev_create_file(s, &attr_mmcra); | 384 | device_create_file(s, &dev_attr_mmcra); |
386 | 385 | ||
387 | if (cpu_has_feature(CPU_FTR_PURR)) | 386 | if (cpu_has_feature(CPU_FTR_PURR)) |
388 | sysdev_create_file(s, &attr_purr); | 387 | device_create_file(s, &dev_attr_purr); |
389 | 388 | ||
390 | if (cpu_has_feature(CPU_FTR_SPURR)) | 389 | if (cpu_has_feature(CPU_FTR_SPURR)) |
391 | sysdev_create_file(s, &attr_spurr); | 390 | device_create_file(s, &dev_attr_spurr); |
392 | 391 | ||
393 | if (cpu_has_feature(CPU_FTR_DSCR)) | 392 | if (cpu_has_feature(CPU_FTR_DSCR)) |
394 | sysdev_create_file(s, &attr_dscr); | 393 | device_create_file(s, &dev_attr_dscr); |
395 | #endif /* CONFIG_PPC64 */ | 394 | #endif /* CONFIG_PPC64 */ |
396 | 395 | ||
397 | cacheinfo_cpu_online(cpu); | 396 | cacheinfo_cpu_online(cpu); |
@@ -401,8 +400,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
401 | static void unregister_cpu_online(unsigned int cpu) | 400 | static void unregister_cpu_online(unsigned int cpu) |
402 | { | 401 | { |
403 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 402 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
404 | struct sys_device *s = &c->sysdev; | 403 | struct device *s = &c->dev; |
405 | struct sysdev_attribute *attrs, *pmc_attrs; | 404 | struct device_attribute *attrs, *pmc_attrs; |
406 | int i, nattrs; | 405 | int i, nattrs; |
407 | 406 | ||
408 | BUG_ON(!c->hotpluggable); | 407 | BUG_ON(!c->hotpluggable); |
@@ -410,7 +409,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
410 | #ifdef CONFIG_PPC64 | 409 | #ifdef CONFIG_PPC64 |
411 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && | 410 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && |
412 | cpu_has_feature(CPU_FTR_SMT)) | 411 | cpu_has_feature(CPU_FTR_SMT)) |
413 | sysdev_remove_file(s, &attr_smt_snooze_delay); | 412 | device_remove_file(s, &dev_attr_smt_snooze_delay); |
414 | #endif | 413 | #endif |
415 | 414 | ||
416 | /* PMC stuff */ | 415 | /* PMC stuff */ |
@@ -418,14 +417,14 @@ static void unregister_cpu_online(unsigned int cpu) | |||
418 | #ifdef HAS_PPC_PMC_IBM | 417 | #ifdef HAS_PPC_PMC_IBM |
419 | case PPC_PMC_IBM: | 418 | case PPC_PMC_IBM: |
420 | attrs = ibm_common_attrs; | 419 | attrs = ibm_common_attrs; |
421 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); | 420 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); |
422 | pmc_attrs = classic_pmc_attrs; | 421 | pmc_attrs = classic_pmc_attrs; |
423 | break; | 422 | break; |
424 | #endif /* HAS_PPC_PMC_IBM */ | 423 | #endif /* HAS_PPC_PMC_IBM */ |
425 | #ifdef HAS_PPC_PMC_G4 | 424 | #ifdef HAS_PPC_PMC_G4 |
426 | case PPC_PMC_G4: | 425 | case PPC_PMC_G4: |
427 | attrs = g4_common_attrs; | 426 | attrs = g4_common_attrs; |
428 | nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); | 427 | nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); |
429 | pmc_attrs = classic_pmc_attrs; | 428 | pmc_attrs = classic_pmc_attrs; |
430 | break; | 429 | break; |
431 | #endif /* HAS_PPC_PMC_G4 */ | 430 | #endif /* HAS_PPC_PMC_G4 */ |
@@ -433,7 +432,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
433 | case PPC_PMC_PA6T: | 432 | case PPC_PMC_PA6T: |
434 | /* PA Semi starts counting at PMC0 */ | 433 | /* PA Semi starts counting at PMC0 */ |
435 | attrs = pa6t_attrs; | 434 | attrs = pa6t_attrs; |
436 | nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); | 435 | nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); |
437 | pmc_attrs = NULL; | 436 | pmc_attrs = NULL; |
438 | break; | 437 | break; |
439 | #endif /* HAS_PPC_PMC_PA6T */ | 438 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -444,24 +443,24 @@ static void unregister_cpu_online(unsigned int cpu) | |||
444 | } | 443 | } |
445 | 444 | ||
446 | for (i = 0; i < nattrs; i++) | 445 | for (i = 0; i < nattrs; i++) |
447 | sysdev_remove_file(s, &attrs[i]); | 446 | device_remove_file(s, &attrs[i]); |
448 | 447 | ||
449 | if (pmc_attrs) | 448 | if (pmc_attrs) |
450 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) | 449 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) |
451 | sysdev_remove_file(s, &pmc_attrs[i]); | 450 | device_remove_file(s, &pmc_attrs[i]); |
452 | 451 | ||
453 | #ifdef CONFIG_PPC64 | 452 | #ifdef CONFIG_PPC64 |
454 | if (cpu_has_feature(CPU_FTR_MMCRA)) | 453 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
455 | sysdev_remove_file(s, &attr_mmcra); | 454 | device_remove_file(s, &dev_attr_mmcra); |
456 | 455 | ||
457 | if (cpu_has_feature(CPU_FTR_PURR)) | 456 | if (cpu_has_feature(CPU_FTR_PURR)) |
458 | sysdev_remove_file(s, &attr_purr); | 457 | device_remove_file(s, &dev_attr_purr); |
459 | 458 | ||
460 | if (cpu_has_feature(CPU_FTR_SPURR)) | 459 | if (cpu_has_feature(CPU_FTR_SPURR)) |
461 | sysdev_remove_file(s, &attr_spurr); | 460 | device_remove_file(s, &dev_attr_spurr); |
462 | 461 | ||
463 | if (cpu_has_feature(CPU_FTR_DSCR)) | 462 | if (cpu_has_feature(CPU_FTR_DSCR)) |
464 | sysdev_remove_file(s, &attr_dscr); | 463 | device_remove_file(s, &dev_attr_dscr); |
465 | #endif /* CONFIG_PPC64 */ | 464 | #endif /* CONFIG_PPC64 */ |
466 | 465 | ||
467 | cacheinfo_cpu_offline(cpu); | 466 | cacheinfo_cpu_offline(cpu); |
@@ -513,70 +512,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = { | |||
513 | 512 | ||
514 | static DEFINE_MUTEX(cpu_mutex); | 513 | static DEFINE_MUTEX(cpu_mutex); |
515 | 514 | ||
516 | int cpu_add_sysdev_attr(struct sysdev_attribute *attr) | 515 | int cpu_add_dev_attr(struct device_attribute *attr) |
517 | { | 516 | { |
518 | int cpu; | 517 | int cpu; |
519 | 518 | ||
520 | mutex_lock(&cpu_mutex); | 519 | mutex_lock(&cpu_mutex); |
521 | 520 | ||
522 | for_each_possible_cpu(cpu) { | 521 | for_each_possible_cpu(cpu) { |
523 | sysdev_create_file(get_cpu_sysdev(cpu), attr); | 522 | device_create_file(get_cpu_device(cpu), attr); |
524 | } | 523 | } |
525 | 524 | ||
526 | mutex_unlock(&cpu_mutex); | 525 | mutex_unlock(&cpu_mutex); |
527 | return 0; | 526 | return 0; |
528 | } | 527 | } |
529 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); | 528 | EXPORT_SYMBOL_GPL(cpu_add_dev_attr); |
530 | 529 | ||
531 | int cpu_add_sysdev_attr_group(struct attribute_group *attrs) | 530 | int cpu_add_dev_attr_group(struct attribute_group *attrs) |
532 | { | 531 | { |
533 | int cpu; | 532 | int cpu; |
534 | struct sys_device *sysdev; | 533 | struct device *dev; |
535 | int ret; | 534 | int ret; |
536 | 535 | ||
537 | mutex_lock(&cpu_mutex); | 536 | mutex_lock(&cpu_mutex); |
538 | 537 | ||
539 | for_each_possible_cpu(cpu) { | 538 | for_each_possible_cpu(cpu) { |
540 | sysdev = get_cpu_sysdev(cpu); | 539 | dev = get_cpu_device(cpu); |
541 | ret = sysfs_create_group(&sysdev->kobj, attrs); | 540 | ret = sysfs_create_group(&dev->kobj, attrs); |
542 | WARN_ON(ret != 0); | 541 | WARN_ON(ret != 0); |
543 | } | 542 | } |
544 | 543 | ||
545 | mutex_unlock(&cpu_mutex); | 544 | mutex_unlock(&cpu_mutex); |
546 | return 0; | 545 | return 0; |
547 | } | 546 | } |
548 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); | 547 | EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group); |
549 | 548 | ||
550 | 549 | ||
551 | void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) | 550 | void cpu_remove_dev_attr(struct device_attribute *attr) |
552 | { | 551 | { |
553 | int cpu; | 552 | int cpu; |
554 | 553 | ||
555 | mutex_lock(&cpu_mutex); | 554 | mutex_lock(&cpu_mutex); |
556 | 555 | ||
557 | for_each_possible_cpu(cpu) { | 556 | for_each_possible_cpu(cpu) { |
558 | sysdev_remove_file(get_cpu_sysdev(cpu), attr); | 557 | device_remove_file(get_cpu_device(cpu), attr); |
559 | } | 558 | } |
560 | 559 | ||
561 | mutex_unlock(&cpu_mutex); | 560 | mutex_unlock(&cpu_mutex); |
562 | } | 561 | } |
563 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); | 562 | EXPORT_SYMBOL_GPL(cpu_remove_dev_attr); |
564 | 563 | ||
565 | void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) | 564 | void cpu_remove_dev_attr_group(struct attribute_group *attrs) |
566 | { | 565 | { |
567 | int cpu; | 566 | int cpu; |
568 | struct sys_device *sysdev; | 567 | struct device *dev; |
569 | 568 | ||
570 | mutex_lock(&cpu_mutex); | 569 | mutex_lock(&cpu_mutex); |
571 | 570 | ||
572 | for_each_possible_cpu(cpu) { | 571 | for_each_possible_cpu(cpu) { |
573 | sysdev = get_cpu_sysdev(cpu); | 572 | dev = get_cpu_device(cpu); |
574 | sysfs_remove_group(&sysdev->kobj, attrs); | 573 | sysfs_remove_group(&dev->kobj, attrs); |
575 | } | 574 | } |
576 | 575 | ||
577 | mutex_unlock(&cpu_mutex); | 576 | mutex_unlock(&cpu_mutex); |
578 | } | 577 | } |
579 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); | 578 | EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group); |
580 | 579 | ||
581 | 580 | ||
582 | /* NUMA stuff */ | 581 | /* NUMA stuff */ |
@@ -590,18 +589,18 @@ static void register_nodes(void) | |||
590 | register_one_node(i); | 589 | register_one_node(i); |
591 | } | 590 | } |
592 | 591 | ||
593 | int sysfs_add_device_to_node(struct sys_device *dev, int nid) | 592 | int sysfs_add_device_to_node(struct device *dev, int nid) |
594 | { | 593 | { |
595 | struct node *node = &node_devices[nid]; | 594 | struct node *node = &node_devices[nid]; |
596 | return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, | 595 | return sysfs_create_link(&node->dev.kobj, &dev->kobj, |
597 | kobject_name(&dev->kobj)); | 596 | kobject_name(&dev->kobj)); |
598 | } | 597 | } |
599 | EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); | 598 | EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); |
600 | 599 | ||
601 | void sysfs_remove_device_from_node(struct sys_device *dev, int nid) | 600 | void sysfs_remove_device_from_node(struct device *dev, int nid) |
602 | { | 601 | { |
603 | struct node *node = &node_devices[nid]; | 602 | struct node *node = &node_devices[nid]; |
604 | sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); | 603 | sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj)); |
605 | } | 604 | } |
606 | EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); | 605 | EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); |
607 | 606 | ||
@@ -614,14 +613,14 @@ static void register_nodes(void) | |||
614 | #endif | 613 | #endif |
615 | 614 | ||
616 | /* Only valid if CPU is present. */ | 615 | /* Only valid if CPU is present. */ |
617 | static ssize_t show_physical_id(struct sys_device *dev, | 616 | static ssize_t show_physical_id(struct device *dev, |
618 | struct sysdev_attribute *attr, char *buf) | 617 | struct device_attribute *attr, char *buf) |
619 | { | 618 | { |
620 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 619 | struct cpu *cpu = container_of(dev, struct cpu, dev); |
621 | 620 | ||
622 | return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); | 621 | return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id)); |
623 | } | 622 | } |
624 | static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); | 623 | static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL); |
625 | 624 | ||
626 | static int __init topology_init(void) | 625 | static int __init topology_init(void) |
627 | { | 626 | { |
@@ -646,7 +645,7 @@ static int __init topology_init(void) | |||
646 | if (cpu_online(cpu) || c->hotpluggable) { | 645 | if (cpu_online(cpu) || c->hotpluggable) { |
647 | register_cpu(c, cpu); | 646 | register_cpu(c, cpu); |
648 | 647 | ||
649 | sysdev_create_file(&c->sysdev, &attr_physical_id); | 648 | device_create_file(&c->dev, &dev_attr_physical_id); |
650 | } | 649 | } |
651 | 650 | ||
652 | if (cpu_online(cpu)) | 651 | if (cpu_online(cpu)) |