summaryrefslogtreecommitdiffstats
path: root/kernel/posix-timers.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-09-22 23:42:51 +0200
committerThomas Gleixner <tglx@linutronix.de>2008-09-24 15:45:48 +0200
commit31d9284569e38fb97117497af3e8047a6a3c86f0 (patch)
treea11b497fd51bdb01f42451e883a4617da3ef1d09 /kernel/posix-timers.c
parentposix-timers: lock_timer: kill the bogus ->it_id check (diff)
downloadlinux-31d9284569e38fb97117497af3e8047a6a3c86f0.tar.xz
linux-31d9284569e38fb97117497af3e8047a6a3c86f0.zip
posix-timers: lock_timer: make it readable
Cleanup. Imho makes the code much more understandable. At least this patch lessens both the source and compiled code. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: mingo@elte.hu Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r--kernel/posix-timers.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 7185f05d53a9..95451bf7d2eb 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -556,7 +556,7 @@ out:
* the find to the timer lock. To avoid a dead lock, the timer id MUST
* be release with out holding the timer lock.
*/
-static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
+static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags)
{
struct k_itimer *timr;
/*
@@ -564,23 +564,20 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
* flags part over to the timer lock. Must not let interrupts in
* while we are moving the lock.
*/
-
spin_lock_irqsave(&idr_lock, *flags);
- timr = idr_find(&posix_timers_id, (int) timer_id);
+ timr = idr_find(&posix_timers_id, (int)timer_id);
if (timr) {
spin_lock(&timr->it_lock);
-
- if (!timr->it_process ||
- !same_thread_group(timr->it_process, current)) {
- spin_unlock(&timr->it_lock);
- spin_unlock_irqrestore(&idr_lock, *flags);
- timr = NULL;
- } else
+ if (timr->it_process &&
+ same_thread_group(timr->it_process, current)) {
spin_unlock(&idr_lock);
- } else
- spin_unlock_irqrestore(&idr_lock, *flags);
+ return timr;
+ }
+ spin_unlock(&timr->it_lock);
+ }
+ spin_unlock_irqrestore(&idr_lock, *flags);
- return timr;
+ return NULL;
}
/*