diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-11-02 08:47:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:18 -0500 |
commit | 386f275f5d097758f867bc99ddeaeb7a03b6b190 (patch) | |
tree | bd27130e78e1aad1ce080f8c8ca76b9166b33ed4 /kernel/ksysfs.c | |
parent | 23b5212cc7422f475b82124334b64277b5b43013 (diff) |
Driver Core: switch all dynamic ksets to kobj_sysfs_ops
Switch all dynamically created ksets, that export simple attributes,
to kobj_attribute from subsys_attribute. Struct subsys_attribute will
be removed.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mike Halcrow <mhalcrow@us.ibm.com>
Cc: Phillip Hellewell <phillip@hellewell.homeip.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/ksysfs.c')
-rw-r--r-- | kernel/ksysfs.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index cf02d4ba9add..dd0f9e7f3414 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -17,30 +17,34 @@ | |||
17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
18 | 18 | ||
19 | #define KERNEL_ATTR_RO(_name) \ | 19 | #define KERNEL_ATTR_RO(_name) \ |
20 | static struct subsys_attribute _name##_attr = __ATTR_RO(_name) | 20 | static struct kobj_attribute _name##_attr = __ATTR_RO(_name) |
21 | 21 | ||
22 | #define KERNEL_ATTR_RW(_name) \ | 22 | #define KERNEL_ATTR_RW(_name) \ |
23 | static struct subsys_attribute _name##_attr = \ | 23 | static struct kobj_attribute _name##_attr = \ |
24 | __ATTR(_name, 0644, _name##_show, _name##_store) | 24 | __ATTR(_name, 0644, _name##_show, _name##_store) |
25 | 25 | ||
26 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 26 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
27 | /* current uevent sequence number */ | 27 | /* current uevent sequence number */ |
28 | static ssize_t uevent_seqnum_show(struct kset *kset, char *page) | 28 | static ssize_t uevent_seqnum_show(struct kobject *kobj, |
29 | struct kobj_attribute *attr, char *buf) | ||
29 | { | 30 | { |
30 | return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); | 31 | return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum); |
31 | } | 32 | } |
32 | KERNEL_ATTR_RO(uevent_seqnum); | 33 | KERNEL_ATTR_RO(uevent_seqnum); |
33 | 34 | ||
34 | /* uevent helper program, used during early boo */ | 35 | /* uevent helper program, used during early boo */ |
35 | static ssize_t uevent_helper_show(struct kset *kset, char *page) | 36 | static ssize_t uevent_helper_show(struct kobject *kobj, |
37 | struct kobj_attribute *attr, char *buf) | ||
36 | { | 38 | { |
37 | return sprintf(page, "%s\n", uevent_helper); | 39 | return sprintf(buf, "%s\n", uevent_helper); |
38 | } | 40 | } |
39 | static ssize_t uevent_helper_store(struct kset *kset, const char *page, size_t count) | 41 | static ssize_t uevent_helper_store(struct kobject *kobj, |
42 | struct kobj_attribute *attr, | ||
43 | const char *buf, size_t count) | ||
40 | { | 44 | { |
41 | if (count+1 > UEVENT_HELPER_PATH_LEN) | 45 | if (count+1 > UEVENT_HELPER_PATH_LEN) |
42 | return -ENOENT; | 46 | return -ENOENT; |
43 | memcpy(uevent_helper, page, count); | 47 | memcpy(uevent_helper, buf, count); |
44 | uevent_helper[count] = '\0'; | 48 | uevent_helper[count] = '\0'; |
45 | if (count && uevent_helper[count-1] == '\n') | 49 | if (count && uevent_helper[count-1] == '\n') |
46 | uevent_helper[count-1] = '\0'; | 50 | uevent_helper[count-1] = '\0'; |
@@ -50,21 +54,24 @@ KERNEL_ATTR_RW(uevent_helper); | |||
50 | #endif | 54 | #endif |
51 | 55 | ||
52 | #ifdef CONFIG_KEXEC | 56 | #ifdef CONFIG_KEXEC |
53 | static ssize_t kexec_loaded_show(struct kset *kset, char *page) | 57 | static ssize_t kexec_loaded_show(struct kobject *kobj, |
58 | struct kobj_attribute *attr, char *buf) | ||
54 | { | 59 | { |
55 | return sprintf(page, "%d\n", !!kexec_image); | 60 | return sprintf(buf, "%d\n", !!kexec_image); |
56 | } | 61 | } |
57 | KERNEL_ATTR_RO(kexec_loaded); | 62 | KERNEL_ATTR_RO(kexec_loaded); |
58 | 63 | ||
59 | static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page) | 64 | static ssize_t kexec_crash_loaded_show(struct kobject *kobj, |
65 | struct kobj_attribute *attr, char *buf) | ||
60 | { | 66 | { |
61 | return sprintf(page, "%d\n", !!kexec_crash_image); | 67 | return sprintf(buf, "%d\n", !!kexec_crash_image); |
62 | } | 68 | } |
63 | KERNEL_ATTR_RO(kexec_crash_loaded); | 69 | KERNEL_ATTR_RO(kexec_crash_loaded); |
64 | 70 | ||
65 | static ssize_t vmcoreinfo_show(struct kset *kset, char *page) | 71 | static ssize_t vmcoreinfo_show(struct kobject *kobj, |
72 | struct kobj_attribute *attr, char *buf) | ||
66 | { | 73 | { |
67 | return sprintf(page, "%lx %x\n", | 74 | return sprintf(buf, "%lx %x\n", |
68 | paddr_vmcoreinfo_note(), | 75 | paddr_vmcoreinfo_note(), |
69 | (unsigned int)vmcoreinfo_max_size); | 76 | (unsigned int)vmcoreinfo_max_size); |
70 | } | 77 | } |