aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-01-22 08:12:41 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-14 17:27:56 -0500
commit36bfb9bb03db2002a8574600c6aeb4cdd1ba01a6 (patch)
tree6e824e262cb857eba106aecb449bdb3c5fc9cbdc /kernel
parent9fe51abf7a1c787f918f66fa3cef9cd0cedb3791 (diff)
lockdep: simplify mark_held_locks
remove the explicit state iteration 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.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dd4716c08325..18e0990148e6 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2253,11 +2253,19 @@ static int mark_lock_irq(struct task_struct *curr, struct held_lock *this,
2253} 2253}
2254 2254
2255enum mark_type { 2255enum mark_type {
2256 HARDIRQ, 2256#define LOCKDEP_STATE(__STATE) __STATE,
2257 SOFTIRQ, 2257#include "lockdep_states.h"
2258 RECLAIM_FS, 2258#undef LOCKDEP_STATE
2259}; 2259};
2260 2260
2261#define MARK_HELD_CASE(__STATE) \
2262 case __STATE: \
2263 if (hlock->read) \
2264 usage_bit = LOCK_ENABLED_##__STATE##_READ; \
2265 else \
2266 usage_bit = LOCK_ENABLED_##__STATE; \
2267 break;
2268
2261/* 2269/*
2262 * Mark all held locks with a usage bit: 2270 * Mark all held locks with a usage bit:
2263 */ 2271 */
@@ -2272,27 +2280,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
2272 hlock = curr->held_locks + i; 2280 hlock = curr->held_locks + i;
2273 2281
2274 switch (mark) { 2282 switch (mark) {
2275 case HARDIRQ: 2283#define LOCKDEP_STATE(__STATE) MARK_HELD_CASE(__STATE)
2276 if (hlock->read) 2284#include "lockdep_states.h"
2277 usage_bit = LOCK_ENABLED_HARDIRQ_READ; 2285#undef LOCKDEP_STATE
2278 else
2279 usage_bit = LOCK_ENABLED_HARDIRQ;
2280 break;
2281
2282 case SOFTIRQ:
2283 if (hlock->read)
2284 usage_bit = LOCK_ENABLED_SOFTIRQ_READ;
2285 else
2286 usage_bit = LOCK_ENABLED_SOFTIRQ;
2287 break;
2288
2289 case RECLAIM_FS:
2290 if (hlock->read)
2291 usage_bit = LOCK_ENABLED_RECLAIM_FS_READ;
2292 else
2293 usage_bit = LOCK_ENABLED_RECLAIM_FS;
2294 break;
2295
2296 default: 2286 default:
2297 BUG(); 2287 BUG();
2298 } 2288 }