summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-01-27 13:58:08 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-14 23:28:17 +0100
commitcf2ad4d13c4ac6366c730fcf6c6be00db12fb75f (patch)
tree869cc14ff8790e1e3d90750cacbe24aeb0c372d9 /kernel
parent9d3651a23dc1f7ed7d207f9118459d3a73d485a7 (diff)
downloadlwn-cf2ad4d13c4ac6366c730fcf6c6be00db12fb75f.tar.gz
lwn-cf2ad4d13c4ac6366c730fcf6c6be00db12fb75f.zip
lockdep: remove macro usage from mark_held_locks()
Now that we have nice numerical relations for the states, remove the macro magics. 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.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 000d53a2da32..f40d916c191c 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2099,14 +2099,6 @@ enum mark_type {
#undef LOCKDEP_STATE
};
-#define MARK_HELD_CASE(__STATE) \
- case __STATE: \
- if (hlock->read) \
- usage_bit = LOCK_ENABLED_##__STATE##_READ; \
- else \
- usage_bit = LOCK_ENABLED_##__STATE; \
- break;
-
/*
* Mark all held locks with a usage bit:
*/
@@ -2120,13 +2112,11 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
for (i = 0; i < curr->lockdep_depth; i++) {
hlock = curr->held_locks + i;
- switch (mark) {
-#define LOCKDEP_STATE(__STATE) MARK_HELD_CASE(__STATE)
-#include "lockdep_states.h"
-#undef LOCKDEP_STATE
- default:
- BUG();
- }
+ usage_bit = 2 + (mark << 2); /* ENABLED */
+ if (hlock->read)
+ usage_bit += 1; /* READ */
+
+ BUG_ON(usage_bit >= LOCK_USAGE_STATES);
if (!mark_lock(curr, hlock, usage_bit))
return 0;