[ALSA] Remove SND_GENERIC_DRIVER from arm/Kconfig
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / ksysfs.c
blob015fb69ad94da0724fcd7806aecf29405fbc7949
1 /*
2 * kernel/ksysfs.c - sysfs attributes in /sys/kernel, which
3 * are not related to any other subsystem
5 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
6 *
7 * This file is release under the GPLv2
9 */
11 #include <linux/config.h>
12 #include <linux/kobject.h>
13 #include <linux/string.h>
14 #include <linux/sysfs.h>
15 #include <linux/module.h>
16 #include <linux/init.h>
18 #define KERNEL_ATTR_RO(_name) \
19 static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
21 #define KERNEL_ATTR_RW(_name) \
22 static struct subsys_attribute _name##_attr = \
23 __ATTR(_name, 0644, _name##_show, _name##_store)
25 #ifdef CONFIG_HOTPLUG
26 static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page)
28 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
30 KERNEL_ATTR_RO(hotplug_seqnum);
31 #endif
33 #ifdef CONFIG_KEXEC
34 #include <asm/kexec.h>
36 static ssize_t crash_notes_show(struct subsystem *subsys, char *page)
38 return sprintf(page, "%p\n", (void *)crash_notes);
40 KERNEL_ATTR_RO(crash_notes);
41 #endif
43 decl_subsys(kernel, NULL, NULL);
44 EXPORT_SYMBOL_GPL(kernel_subsys);
46 static struct attribute * kernel_attrs[] = {
47 #ifdef CONFIG_HOTPLUG
48 &hotplug_seqnum_attr.attr,
49 #endif
50 #ifdef CONFIG_KEXEC
51 &crash_notes_attr.attr,
52 #endif
53 NULL
56 static struct attribute_group kernel_attr_group = {
57 .attrs = kernel_attrs,
60 static int __init ksysfs_init(void)
62 int error = subsystem_register(&kernel_subsys);
63 if (!error)
64 error = sysfs_create_group(&kernel_subsys.kset.kobj,
65 &kernel_attr_group);
67 return error;
70 core_initcall(ksysfs_init);