diff options
-rw-r--r-- | include/linux/lockdep.h | 12 | ||||
-rw-r--r-- | kernel/lockdep.c | 24 |
2 files changed, 19 insertions, 17 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 8956daf64abd..37a0361f4685 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -314,8 +314,15 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
314 | extern void lock_release(struct lockdep_map *lock, int nested, | 314 | extern void lock_release(struct lockdep_map *lock, int nested, |
315 | unsigned long ip); | 315 | unsigned long ip); |
316 | 316 | ||
317 | extern void lock_set_subclass(struct lockdep_map *lock, unsigned int subclass, | 317 | extern void lock_set_class(struct lockdep_map *lock, const char *name, |
318 | unsigned long ip); | 318 | struct lock_class_key *key, unsigned int subclass, |
319 | unsigned long ip); | ||
320 | |||
321 | static inline void lock_set_subclass(struct lockdep_map *lock, | ||
322 | unsigned int subclass, unsigned long ip) | ||
323 | { | ||
324 | lock_set_class(lock, lock->name, lock->key, subclass, ip); | ||
325 | } | ||
319 | 326 | ||
320 | # define INIT_LOCKDEP .lockdep_recursion = 0, | 327 | # define INIT_LOCKDEP .lockdep_recursion = 0, |
321 | 328 | ||
@@ -333,6 +340,7 @@ static inline void lockdep_on(void) | |||
333 | 340 | ||
334 | # define lock_acquire(l, s, t, r, c, n, i) do { } while (0) | 341 | # define lock_acquire(l, s, t, r, c, n, i) do { } while (0) |
335 | # define lock_release(l, n, i) do { } while (0) | 342 | # define lock_release(l, n, i) do { } while (0) |
343 | # define lock_set_class(l, n, k, s, i) do { } while (0) | ||
336 | # define lock_set_subclass(l, s, i) do { } while (0) | 344 | # define lock_set_subclass(l, s, i) do { } while (0) |
337 | # define lockdep_init() do { } while (0) | 345 | # define lockdep_init() do { } while (0) |
338 | # define lockdep_info() do { } while (0) | 346 | # define lockdep_info() do { } while (0) |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 90f3fb64dbce..4fa6eeb4e8a7 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -291,14 +291,12 @@ void lockdep_off(void) | |||
291 | { | 291 | { |
292 | current->lockdep_recursion++; | 292 | current->lockdep_recursion++; |
293 | } | 293 | } |
294 | |||
295 | EXPORT_SYMBOL(lockdep_off); | 294 | EXPORT_SYMBOL(lockdep_off); |
296 | 295 | ||
297 | void lockdep_on(void) | 296 | void lockdep_on(void) |
298 | { | 297 | { |
299 | current->lockdep_recursion--; | 298 | current->lockdep_recursion--; |
300 | } | 299 | } |
301 | |||
302 | EXPORT_SYMBOL(lockdep_on); | 300 | EXPORT_SYMBOL(lockdep_on); |
303 | 301 | ||
304 | /* | 302 | /* |
@@ -2513,7 +2511,6 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
2513 | if (subclass) | 2511 | if (subclass) |
2514 | register_lock_class(lock, subclass, 1); | 2512 | register_lock_class(lock, subclass, 1); |
2515 | } | 2513 | } |
2516 | |||
2517 | EXPORT_SYMBOL_GPL(lockdep_init_map); | 2514 | EXPORT_SYMBOL_GPL(lockdep_init_map); |
2518 | 2515 | ||
2519 | /* | 2516 | /* |
@@ -2694,8 +2691,9 @@ static int check_unlock(struct task_struct *curr, struct lockdep_map *lock, | |||
2694 | } | 2691 | } |
2695 | 2692 | ||
2696 | static int | 2693 | static int |
2697 | __lock_set_subclass(struct lockdep_map *lock, | 2694 | __lock_set_class(struct lockdep_map *lock, const char *name, |
2698 | unsigned int subclass, unsigned long ip) | 2695 | struct lock_class_key *key, unsigned int subclass, |
2696 | unsigned long ip) | ||
2699 | { | 2697 | { |
2700 | struct task_struct *curr = current; | 2698 | struct task_struct *curr = current; |
2701 | struct held_lock *hlock, *prev_hlock; | 2699 | struct held_lock *hlock, *prev_hlock; |
@@ -2722,6 +2720,7 @@ __lock_set_subclass(struct lockdep_map *lock, | |||
2722 | return print_unlock_inbalance_bug(curr, lock, ip); | 2720 | return print_unlock_inbalance_bug(curr, lock, ip); |
2723 | 2721 | ||
2724 | found_it: | 2722 | found_it: |
2723 | lockdep_init_map(lock, name, key, 0); | ||
2725 | class = register_lock_class(lock, subclass, 0); | 2724 | class = register_lock_class(lock, subclass, 0); |
2726 | hlock->class_idx = class - lock_classes + 1; | 2725 | hlock->class_idx = class - lock_classes + 1; |
2727 | 2726 | ||
@@ -2906,9 +2905,9 @@ static void check_flags(unsigned long flags) | |||
2906 | #endif | 2905 | #endif |
2907 | } | 2906 | } |
2908 | 2907 | ||
2909 | void | 2908 | void lock_set_class(struct lockdep_map *lock, const char *name, |
2910 | lock_set_subclass(struct lockdep_map *lock, | 2909 | struct lock_class_key *key, unsigned int subclass, |
2911 | unsigned int subclass, unsigned long ip) | 2910 | unsigned long ip) |
2912 | { | 2911 | { |
2913 | unsigned long flags; | 2912 | unsigned long flags; |
2914 | 2913 | ||
@@ -2918,13 +2917,12 @@ lock_set_subclass(struct lockdep_map *lock, | |||
2918 | raw_local_irq_save(flags); | 2917 | raw_local_irq_save(flags); |
2919 | current->lockdep_recursion = 1; | 2918 | current->lockdep_recursion = 1; |
2920 | check_flags(flags); | 2919 | check_flags(flags); |
2921 | if (__lock_set_subclass(lock, subclass, ip)) | 2920 | if (__lock_set_class(lock, name, key, subclass, ip)) |
2922 | check_chain_key(current); | 2921 | check_chain_key(current); |
2923 | current->lockdep_recursion = 0; | 2922 | current->lockdep_recursion = 0; |
2924 | raw_local_irq_restore(flags); | 2923 | raw_local_irq_restore(flags); |
2925 | } | 2924 | } |
2926 | 2925 | EXPORT_SYMBOL_GPL(lock_set_class); | |
2927 | EXPORT_SYMBOL_GPL(lock_set_subclass); | ||
2928 | 2926 | ||
2929 | /* | 2927 | /* |
2930 | * We are not always called with irqs disabled - do that here, | 2928 | * We are not always called with irqs disabled - do that here, |
@@ -2948,7 +2946,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
2948 | current->lockdep_recursion = 0; | 2946 | current->lockdep_recursion = 0; |
2949 | raw_local_irq_restore(flags); | 2947 | raw_local_irq_restore(flags); |
2950 | } | 2948 | } |
2951 | |||
2952 | EXPORT_SYMBOL_GPL(lock_acquire); | 2949 | EXPORT_SYMBOL_GPL(lock_acquire); |
2953 | 2950 | ||
2954 | void lock_release(struct lockdep_map *lock, int nested, | 2951 | void lock_release(struct lockdep_map *lock, int nested, |
@@ -2966,7 +2963,6 @@ void lock_release(struct lockdep_map *lock, int nested, | |||
2966 | current->lockdep_recursion = 0; | 2963 | current->lockdep_recursion = 0; |
2967 | raw_local_irq_restore(flags); | 2964 | raw_local_irq_restore(flags); |
2968 | } | 2965 | } |
2969 | |||
2970 | EXPORT_SYMBOL_GPL(lock_release); | 2966 | EXPORT_SYMBOL_GPL(lock_release); |
2971 | 2967 | ||
2972 | #ifdef CONFIG_LOCK_STAT | 2968 | #ifdef CONFIG_LOCK_STAT |
@@ -3451,7 +3447,6 @@ retry: | |||
3451 | if (unlock) | 3447 | if (unlock) |
3452 | read_unlock(&tasklist_lock); | 3448 | read_unlock(&tasklist_lock); |
3453 | } | 3449 | } |
3454 | |||
3455 | EXPORT_SYMBOL_GPL(debug_show_all_locks); | 3450 | EXPORT_SYMBOL_GPL(debug_show_all_locks); |
3456 | 3451 | ||
3457 | /* | 3452 | /* |
@@ -3472,7 +3467,6 @@ void debug_show_held_locks(struct task_struct *task) | |||
3472 | { | 3467 | { |
3473 | __debug_show_held_locks(task); | 3468 | __debug_show_held_locks(task); |
3474 | } | 3469 | } |
3475 | |||
3476 | EXPORT_SYMBOL_GPL(debug_show_held_locks); | 3470 | EXPORT_SYMBOL_GPL(debug_show_held_locks); |
3477 | 3471 | ||
3478 | void lockdep_sys_exit(void) | 3472 | void lockdep_sys_exit(void) |