aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/sysfs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 3e8526582146..006c359e63c0 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -15,6 +15,7 @@
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
20struct kobject; 21struct kobject;
@@ -29,8 +30,23 @@ struct attribute {
29 const char *name; 30 const char *name;
30 struct module *owner; 31 struct module *owner;
31 mode_t mode; 32 mode_t mode;
33#ifdef CONFIG_DEBUG_LOCK_ALLOC
34 struct lock_class_key *key;
35 struct lock_class_key skey;
36#endif
32}; 37};
33 38
39#ifdef CONFIG_DEBUG_LOCK_ALLOC
40#define sysfs_attr_init(attr) \
41do { \
42 static struct lock_class_key __key; \
43 \
44 (attr)->key = &__key; \
45} while(0)
46#else
47#define sysfs_attr_init(attr) do {} while(0)
48#endif
49
34struct attribute_group { 50struct attribute_group {
35 const char *name; 51 const char *name;
36 mode_t (*is_visible)(struct kobject *, 52 mode_t (*is_visible)(struct kobject *,
@@ -74,6 +90,8 @@ struct bin_attribute {
74 struct vm_area_struct *vma); 90 struct vm_area_struct *vma);
75}; 91};
76 92
93#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&bin_attr->attr)
94
77struct sysfs_ops { 95struct sysfs_ops {
78 ssize_t (*show)(struct kobject *, struct attribute *,char *); 96 ssize_t (*show)(struct kobject *, struct attribute *,char *);
79 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 97 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);