diff options
Diffstat (limited to 'arch/powerpc/kernel/sysfs.c')
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index d45a168bdaca..cda21a27490a 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -299,6 +299,72 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = { | |||
299 | .notifier_call = sysfs_cpu_notify, | 299 | .notifier_call = sysfs_cpu_notify, |
300 | }; | 300 | }; |
301 | 301 | ||
302 | static DEFINE_MUTEX(cpu_mutex); | ||
303 | |||
304 | int cpu_add_sysdev_attr(struct sysdev_attribute *attr) | ||
305 | { | ||
306 | int cpu; | ||
307 | |||
308 | mutex_lock(&cpu_mutex); | ||
309 | |||
310 | for_each_possible_cpu(cpu) { | ||
311 | sysdev_create_file(get_cpu_sysdev(cpu), attr); | ||
312 | } | ||
313 | |||
314 | mutex_unlock(&cpu_mutex); | ||
315 | return 0; | ||
316 | } | ||
317 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); | ||
318 | |||
319 | int cpu_add_sysdev_attr_group(struct attribute_group *attrs) | ||
320 | { | ||
321 | int cpu; | ||
322 | struct sys_device *sysdev; | ||
323 | |||
324 | mutex_lock(&cpu_mutex); | ||
325 | |||
326 | for_each_possible_cpu(cpu) { | ||
327 | sysdev = get_cpu_sysdev(cpu); | ||
328 | sysfs_create_group(&sysdev->kobj, attrs); | ||
329 | } | ||
330 | |||
331 | mutex_unlock(&cpu_mutex); | ||
332 | return 0; | ||
333 | } | ||
334 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); | ||
335 | |||
336 | |||
337 | void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) | ||
338 | { | ||
339 | int cpu; | ||
340 | |||
341 | mutex_lock(&cpu_mutex); | ||
342 | |||
343 | for_each_possible_cpu(cpu) { | ||
344 | sysdev_remove_file(get_cpu_sysdev(cpu), attr); | ||
345 | } | ||
346 | |||
347 | mutex_unlock(&cpu_mutex); | ||
348 | } | ||
349 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); | ||
350 | |||
351 | void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) | ||
352 | { | ||
353 | int cpu; | ||
354 | struct sys_device *sysdev; | ||
355 | |||
356 | mutex_lock(&cpu_mutex); | ||
357 | |||
358 | for_each_possible_cpu(cpu) { | ||
359 | sysdev = get_cpu_sysdev(cpu); | ||
360 | sysfs_remove_group(&sysdev->kobj, attrs); | ||
361 | } | ||
362 | |||
363 | mutex_unlock(&cpu_mutex); | ||
364 | } | ||
365 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); | ||
366 | |||
367 | |||
302 | /* NUMA stuff */ | 368 | /* NUMA stuff */ |
303 | 369 | ||
304 | #ifdef CONFIG_NUMA | 370 | #ifdef CONFIG_NUMA |