]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/sysfs/sysfs.h
sysfs: Use one lockdep class per sysfs attribute.
[net-next-2.6.git] / fs / sysfs / sysfs.h
index 7db6884f420662b64896e7d737259011aa649aa8..37e0e086233c73697d6207d109bc028a0273b48e 100644 (file)
@@ -92,9 +92,12 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd)
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #define sysfs_dirent_init_lockdep(sd)                          \
 do {                                                           \
-       static struct lock_class_key __key;                     \
+       struct attribute *attr = sd->s_attr.attr;               \
+       struct lock_class_key *key = attr->key;                 \
+       if (!key)                                               \
+               key = &attr->skey;                              \
                                                                \
-       lockdep_init_map(&sd->dep_map, "s_active", &__key, 0);  \
+       lockdep_init_map(&sd->dep_map, "s_active", key, 0);     \
 } while(0)
 #else
 #define sysfs_dirent_init_lockdep(sd) do {} while(0)