]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mutex: small cleanup
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 14 Jan 2009 14:32:51 +0000 (15:32 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 14 Jan 2009 17:08:58 +0000 (18:08 +0100)
Remove a local variable by combining an assingment and test in one.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/mutex.c

index 4f45d4b658ef6ab1fda9357725b01361a6768a76..357c6d221efe5a3988565abf1321ed7f155e20a5 100644 (file)
@@ -129,7 +129,6 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
 {
        struct task_struct *task = current;
        struct mutex_waiter waiter;
-       unsigned int old_val;
        unsigned long flags;
 
        spin_lock_mutex(&lock->wait_lock, flags);
@@ -142,8 +141,7 @@ __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)
+       if (atomic_xchg(&lock->count, -1) == 1)
                goto done;
 
        lock_contended(&lock->dep_map, ip);
@@ -158,8 +156,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
                 * that when we release the lock, we properly wake up the
                 * other waiters:
                 */
-               old_val = atomic_xchg(&lock->count, -1);
-               if (old_val == 1)
+               if (atomic_xchg(&lock->count, -1) == 1)
                        break;
 
                /*