diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-01-22 11:40:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-14 17:28:21 -0500 |
commit | 3ff176ca47911630d1555f150d36daa2d0819ea9 (patch) | |
tree | cd93a5e61c16127f5ed75efb37b469d28e4504e7 /kernel | |
parent | 38aa2714382d886f77f2565277fce293122808b0 (diff) |
lockdep: simplify get_user_chars()
there's too much repetition of code..
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/lockdep.c | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 02e6e066d563..1b4ee3c0b789 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -467,54 +467,37 @@ const char * __get_key_name(struct lockdep_subclass_key *key, char *str) | |||
467 | return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str); | 467 | return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str); |
468 | } | 468 | } |
469 | 469 | ||
470 | void | 470 | static inline unsigned long lock_flag(enum lock_usage_bit bit) |
471 | get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, | ||
472 | char *c4, char *c5, char *c6) | ||
473 | { | 471 | { |
474 | *c1 = '.', *c2 = '.', *c3 = '.', *c4 = '.', *c5 = '.', *c6 = '.'; | 472 | return 1UL << bit; |
475 | 473 | } | |
476 | if (class->usage_mask & LOCKF_USED_IN_HARDIRQ) | ||
477 | *c1 = '+'; | ||
478 | else | ||
479 | if (class->usage_mask & LOCKF_ENABLED_HARDIRQ) | ||
480 | *c1 = '-'; | ||
481 | |||
482 | if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ) | ||
483 | *c2 = '+'; | ||
484 | else | ||
485 | if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ) | ||
486 | *c2 = '-'; | ||
487 | 474 | ||
488 | if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ) | 475 | static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit) |
489 | *c3 = '-'; | 476 | { |
490 | if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ) { | 477 | char c = '.'; |
491 | *c3 = '+'; | ||
492 | if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ) | ||
493 | *c3 = '?'; | ||
494 | } | ||
495 | 478 | ||
496 | if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ_READ) | 479 | if (class->usage_mask & lock_flag(bit + 2)) |
497 | *c4 = '-'; | 480 | c = '+'; |
498 | if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ) { | 481 | if (class->usage_mask & lock_flag(bit)) { |
499 | *c4 = '+'; | 482 | c = '-'; |
500 | if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ_READ) | 483 | if (class->usage_mask & lock_flag(bit + 2)) |
501 | *c4 = '?'; | 484 | c = '?'; |
502 | } | 485 | } |
503 | 486 | ||
504 | if (class->usage_mask & LOCKF_USED_IN_RECLAIM_FS) | 487 | return c; |
505 | *c5 = '+'; | 488 | } |
506 | else | ||
507 | if (class->usage_mask & LOCKF_ENABLED_RECLAIM_FS) | ||
508 | *c5 = '-'; | ||
509 | 489 | ||
510 | if (class->usage_mask & LOCKF_ENABLED_RECLAIM_FS_READ) | 490 | void |
511 | *c6 = '-'; | 491 | get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, |
512 | if (class->usage_mask & LOCKF_USED_IN_RECLAIM_FS_READ) { | 492 | char *c4, char *c5, char *c6) |
513 | *c6 = '+'; | 493 | { |
514 | if (class->usage_mask & LOCKF_ENABLED_RECLAIM_FS_READ) | 494 | *c1 = get_usage_char(class, LOCK_USED_IN_HARDIRQ); |
515 | *c6 = '?'; | 495 | *c2 = get_usage_char(class, LOCK_USED_IN_SOFTITQ); |
516 | } | 496 | *c3 = get_usage_char(class, LOCK_USED_IN_HARDIRQ_READ); |
497 | *c4 = get_usage_char(class, LOCK_USED_IN_SOFTITQ_READ); | ||
517 | 498 | ||
499 | *c5 = get_usage_char(class, LOCK_USED_IN_RECLAIM_FS); | ||
500 | *c6 = get_usage_char(class, LOCK_USED_IN_RECLAIM_FS_READ); | ||
518 | } | 501 | } |
519 | 502 | ||
520 | static void print_lock_name(struct lock_class *class) | 503 | static void print_lock_name(struct lock_class *class) |