summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-01-22 17:53:47 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-14 23:28:22 +0100
commitf510b233cfc7bfd57b6007071c52aa42e3d16b06 (patch)
treed7e91f4d82ee3bed078f5813377b73a1eb7e382f /kernel
parent3ff176ca47911630d1555f150d36daa2d0819ea9 (diff)
downloadop-kernel-dev-f510b233cfc7bfd57b6007071c52aa42e3d16b06.zip
op-kernel-dev-f510b233cfc7bfd57b6007071c52aa42e3d16b06.tar.gz
lockdep: get_user_chars() redo
Generic, states independent, get_user_chars(). 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.c24
-rw-r--r--kernel/lockdep_internals.h7
-rw-r--r--kernel/lockdep_proc.c6
3 files changed, 19 insertions, 18 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 1b4ee3c..22ced8d 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -487,25 +487,25 @@ static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit)
return c;
}
-void
-get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3,
- char *c4, char *c5, char *c6)
+void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS])
{
- *c1 = get_usage_char(class, LOCK_USED_IN_HARDIRQ);
- *c2 = get_usage_char(class, LOCK_USED_IN_SOFTITQ);
- *c3 = get_usage_char(class, LOCK_USED_IN_HARDIRQ_READ);
- *c4 = get_usage_char(class, LOCK_USED_IN_SOFTITQ_READ);
+ int i = 0;
- *c5 = get_usage_char(class, LOCK_USED_IN_RECLAIM_FS);
- *c6 = get_usage_char(class, LOCK_USED_IN_RECLAIM_FS_READ);
+#define LOCKDEP_STATE(__STATE) \
+ usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE); \
+ usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE##_READ);
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+
+ usage[i] = '\0';
}
static void print_lock_name(struct lock_class *class)
{
- char str[KSYM_NAME_LEN], c1, c2, c3, c4, c5, c6;
+ char str[KSYM_NAME_LEN], usage[LOCK_USAGE_CHARS];
const char *name;
- get_usage_chars(class, &c1, &c2, &c3, &c4, &c5, &c6);
+ get_usage_chars(class, usage);
name = class->name;
if (!name) {
@@ -518,7 +518,7 @@ static void print_lock_name(struct lock_class *class)
if (class->subclass)
printk("/%d", class->subclass);
}
- printk("){%c%c%c%c%c%c}", c1, c2, c3, c4, c5, c6);
+ printk("){%s}", usage);
}
static void print_lockdep_cache(struct lockdep_map *lock)
diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index 7e653e6..a2cc7e9 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -70,9 +70,10 @@ enum {
extern struct list_head all_lock_classes;
extern struct lock_chain lock_chains[];
-extern void
-get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3,
- char *c4, char *c5, char *c6);
+#define LOCK_USAGE_CHARS (1+LOCK_USAGE_STATES/2)
+
+extern void get_usage_chars(struct lock_class *class,
+ char usage[LOCK_USAGE_CHARS]);
extern const char * __get_key_name(struct lockdep_subclass_key *key, char *str);
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index bd474fd..b51064c 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -84,7 +84,7 @@ static int l_show(struct seq_file *m, void *v)
{
struct lock_class *class = v;
struct lock_list *entry;
- char c1, c2, c3, c4, c5, c6;
+ char usage[LOCK_USAGE_CHARS];
if (v == SEQ_START_TOKEN) {
seq_printf(m, "all lock classes:\n");
@@ -100,8 +100,8 @@ static int l_show(struct seq_file *m, void *v)
seq_printf(m, " BD:%5ld", lockdep_count_backward_deps(class));
#endif
- get_usage_chars(class, &c1, &c2, &c3, &c4, &c5, &c6);
- seq_printf(m, " %c%c%c%c%c%c", c1, c2, c3, c4, c5, c6);
+ get_usage_chars(class, usage);
+ seq_printf(m, " %s", usage);
seq_printf(m, ": ");
print_name(m, class);
OpenPOWER on IntegriCloud