diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-03-31 05:30:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:53 -0500 |
commit | a2c348fe0117adced11e374329a5ea3f7c43cb41 (patch) | |
tree | 95233412196f8093e2e82437afeeadd2e479040c | |
parent | 3691c5199e8a4be1c7a91b5ab925db5feb866e19 (diff) |
[PATCH] __mod_timer: simplify ->base changing
Since base and new_base are of the same type now, we can save one 'if'
branch and simplify the code a bit.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | kernel/timer.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index b04dc03b5934..9062a82ee8ec 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -215,21 +215,19 @@ int __mod_timer(struct timer_list *timer, unsigned long expires) | |||
215 | * handler yet has not finished. This also guarantees that | 215 | * handler yet has not finished. This also guarantees that |
216 | * the timer is serialized wrt itself. | 216 | * the timer is serialized wrt itself. |
217 | */ | 217 | */ |
218 | if (unlikely(base->running_timer == timer)) { | 218 | if (likely(base->running_timer != timer)) { |
219 | /* The timer remains on a former base */ | ||
220 | new_base = base; | ||
221 | } else { | ||
222 | /* See the comment in lock_timer_base() */ | 219 | /* See the comment in lock_timer_base() */ |
223 | timer->base = NULL; | 220 | timer->base = NULL; |
224 | spin_unlock(&base->lock); | 221 | spin_unlock(&base->lock); |
225 | spin_lock(&new_base->lock); | 222 | base = new_base; |
226 | timer->base = new_base; | 223 | spin_lock(&base->lock); |
224 | timer->base = base; | ||
227 | } | 225 | } |
228 | } | 226 | } |
229 | 227 | ||
230 | timer->expires = expires; | 228 | timer->expires = expires; |
231 | internal_add_timer(new_base, timer); | 229 | internal_add_timer(base, timer); |
232 | spin_unlock_irqrestore(&new_base->lock, flags); | 230 | spin_unlock_irqrestore(&base->lock, flags); |
233 | 231 | ||
234 | return ret; | 232 | return ret; |
235 | } | 233 | } |