X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=kernel%2Fmutex.c;h=691b86564dd97fbe8f88e75a0f1cd6024cf6762b;hb=df3fe1f318b226453b8dc48622c2b6eb78d75dbb;hp=303eab18484b1c63b7a678bf2b24a928cfc847fa;hpb=0ab598099c18affd73a21482274c00e8119236be;p=linux-2.6-omap-h63xx.git diff --git a/kernel/mutex.c b/kernel/mutex.c index 303eab18484..691b86564dd 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -139,6 +139,12 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass) list_add_tail(&waiter.list, &lock->wait_list); waiter.task = task; + old_val = atomic_xchg(&lock->count, -1); + if (old_val == 1) + goto done; + + lock_contended(&lock->dep_map, _RET_IP_); + for (;;) { /* * Lets try to take the lock again - this is needed even if @@ -174,6 +180,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass) spin_lock_mutex(&lock->wait_lock, flags); } +done: + lock_acquired(&lock->dep_map); /* got the lock - rejoice! */ mutex_remove_waiter(lock, &waiter, task_thread_info(task)); debug_mutex_set_owner(lock, task_thread_info(task));