aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/sysfs.c
diff options
context:
space:
mode:
authorChristian Krafft <krafft@de.ibm.com>2006-10-24 12:31:24 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-25 00:20:22 -0400
commit0344c6c5387ba335bba5a66fd44714b94c98573f (patch)
treeb6f3da50e29f10cf96e2fe6e98ad6aef0ae4562a /arch/powerpc/kernel/sysfs.c
parente570beb6bb1a623849901efbf939063ec4775c9e (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.c66
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
302static DEFINE_MUTEX(cpu_mutex);
303
304int 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}
317EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr);
318
319int 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}
334EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group);
335
336
337void 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}
349EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr);
350
351void 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}
365EXPORT_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