mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
mutex: small cleanup
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>
This commit is contained in:
parent
a6525042bf
commit
93d81d1aca
1 changed files with 2 additions and 5 deletions
|
@ -129,7 +129,6 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
|
||||||
{
|
{
|
||||||
struct task_struct *task = current;
|
struct task_struct *task = current;
|
||||||
struct mutex_waiter waiter;
|
struct mutex_waiter waiter;
|
||||||
unsigned int old_val;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_mutex(&lock->wait_lock, 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);
|
list_add_tail(&waiter.list, &lock->wait_list);
|
||||||
waiter.task = task;
|
waiter.task = task;
|
||||||
|
|
||||||
old_val = atomic_xchg(&lock->count, -1);
|
if (atomic_xchg(&lock->count, -1) == 1)
|
||||||
if (old_val == 1)
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
lock_contended(&lock->dep_map, ip);
|
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
|
* that when we release the lock, we properly wake up the
|
||||||
* other waiters:
|
* other waiters:
|
||||||
*/
|
*/
|
||||||
old_val = atomic_xchg(&lock->count, -1);
|
if (atomic_xchg(&lock->count, -1) == 1)
|
||||||
if (old_val == 1)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue