Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31d92845 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Thomas Gleixner
Browse files

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: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: mingo@elte.hu
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5a51b713
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -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);
	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
			return timr;
		}
		spin_unlock(&timr->it_lock);
	}
	spin_unlock_irqrestore(&idr_lock, *flags);

	return timr;
	return NULL;
}

/*