diff options
author | Christian Krafft <krafft@de.ibm.com> | 2006-10-24 12:31:24 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-25 00:20:22 -0400 |
commit | 0344c6c5387ba335bba5a66fd44714b94c98573f (patch) | |
tree | b6f3da50e29f10cf96e2fe6e98ad6aef0ae4562a /arch/powerpc/kernel/sysfs.c | |
parent | e570beb6bb1a623849901efbf939063ec4775c9e (diff) |
[POWERPC] sysfs: add support for adding/removing spu sysfs attributes
This patch adds two functions to create and remove sysfs attributes and
attribute_group to all cpus. That allows to register sysfs attributes in
a subdirectory like: /sys/devices/system/cpu/cpuX/group_name/what_ever
This will be used by cbe_thermal to group all attributes dealing with
thermal support in one directory.
Signed-of-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
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 |