diff options
Diffstat (limited to 'fs/sysfs/sysfs.h')
-rw-r--r-- | fs/sysfs/sysfs.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index ca52e7b9d8f8..cdd9377a6e06 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -8,6 +8,7 @@ | |||
8 | * This file is released under the GPLv2. | 8 | * This file is released under the GPLv2. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/lockdep.h> | ||
11 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
12 | 13 | ||
13 | struct sysfs_open_dirent; | 14 | struct sysfs_open_dirent; |
@@ -50,6 +51,9 @@ struct sysfs_inode_attrs { | |||
50 | struct sysfs_dirent { | 51 | struct sysfs_dirent { |
51 | atomic_t s_count; | 52 | atomic_t s_count; |
52 | atomic_t s_active; | 53 | atomic_t s_active; |
54 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
55 | struct lockdep_map dep_map; | ||
56 | #endif | ||
53 | struct sysfs_dirent *s_parent; | 57 | struct sysfs_dirent *s_parent; |
54 | struct sysfs_dirent *s_sibling; | 58 | struct sysfs_dirent *s_sibling; |
55 | const char *s_name; | 59 | const char *s_name; |
@@ -84,6 +88,17 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | |||
84 | return sd->s_flags & SYSFS_TYPE_MASK; | 88 | return sd->s_flags & SYSFS_TYPE_MASK; |
85 | } | 89 | } |
86 | 90 | ||
91 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
92 | #define sysfs_dirent_init_lockdep(sd) \ | ||
93 | do { \ | ||
94 | static struct lock_class_key __key; \ | ||
95 | \ | ||
96 | lockdep_init_map(&sd->dep_map, "s_active", &__key, 0); \ | ||
97 | } while(0) | ||
98 | #else | ||
99 | #define sysfs_dirent_init_lockdep(sd) do {} while(0) | ||
100 | #endif | ||
101 | |||
87 | /* | 102 | /* |
88 | * Context structure to be used while adding/removing nodes. | 103 | * Context structure to be used while adding/removing nodes. |
89 | */ | 104 | */ |