aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index d1a3b2cfe4a9..b739be2a6dc9 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1176,7 +1176,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
1176 * itself, so actual lookup of the hash should be once per lock object. 1176 * itself, so actual lookup of the hash should be once per lock object.
1177 */ 1177 */
1178static inline struct lock_class * 1178static inline struct lock_class *
1179register_lock_class(struct lockdep_map *lock, unsigned int subclass) 1179register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
1180{ 1180{
1181 struct lockdep_subclass_key *key; 1181 struct lockdep_subclass_key *key;
1182 struct list_head *hash_head; 1182 struct list_head *hash_head;
@@ -1248,7 +1248,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass)
1248out_unlock_set: 1248out_unlock_set:
1249 __raw_spin_unlock(&hash_lock); 1249 __raw_spin_unlock(&hash_lock);
1250 1250
1251 if (!subclass) 1251 if (!subclass || force)
1252 lock->class_cache = class; 1252 lock->class_cache = class;
1253 1253
1254 DEBUG_LOCKS_WARN_ON(class->subclass != subclass); 1254 DEBUG_LOCKS_WARN_ON(class->subclass != subclass);
@@ -1936,7 +1936,7 @@ void trace_softirqs_off(unsigned long ip)
1936 * Initialize a lock instance's lock-class mapping info: 1936 * Initialize a lock instance's lock-class mapping info:
1937 */ 1937 */
1938void lockdep_init_map(struct lockdep_map *lock, const char *name, 1938void lockdep_init_map(struct lockdep_map *lock, const char *name,
1939 struct lock_class_key *key) 1939 struct lock_class_key *key, int subclass)
1940{ 1940{
1941 if (unlikely(!debug_locks)) 1941 if (unlikely(!debug_locks))
1942 return; 1942 return;
@@ -1956,6 +1956,8 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name,
1956 lock->name = name; 1956 lock->name = name;
1957 lock->key = key; 1957 lock->key = key;
1958 lock->class_cache = NULL; 1958 lock->class_cache = NULL;
1959 if (subclass)
1960 register_lock_class(lock, subclass, 1);
1959} 1961}
1960 1962
1961EXPORT_SYMBOL_GPL(lockdep_init_map); 1963EXPORT_SYMBOL_GPL(lockdep_init_map);
@@ -1994,7 +1996,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
1994 * Not cached yet or subclass? 1996 * Not cached yet or subclass?
1995 */ 1997 */
1996 if (unlikely(!class)) { 1998 if (unlikely(!class)) {
1997 class = register_lock_class(lock, subclass); 1999 class = register_lock_class(lock, subclass, 0);
1998 if (!class) 2000 if (!class)
1999 return 0; 2001 return 0;
2000 } 2002 }