aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-03-12 15:10:29 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-03-12 16:40:43 -0500
commit576da126a6c7364d70dfd58d0bbe43d05cf5859f (patch)
treeb9e20cb948c0dce3da97bc3fa1ecc592416d070b /kernel
parent06f71b922ce5a05352acd706564ca4ae1f2add0e (diff)
timer: Split out timer function call
The ident level is starting to be annoying. More white space than actual code. Split out the timer function call into its own function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index f82f4bfe2d88..45229694dc6a 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -953,6 +953,41 @@ static int cascade(struct tvec_base *base, struct tvec *tv, int index)
953 return index; 953 return index;
954} 954}
955 955
956static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
957 unsigned long data)
958{
959 int preempt_count = preempt_count();
960
961#ifdef CONFIG_LOCKDEP
962 /*
963 * It is permissible to free the timer from inside the
964 * function that is called from it, this we need to take into
965 * account for lockdep too. To avoid bogus "held lock freed"
966 * warnings as well as problems when looking into
967 * timer->lockdep_map, make a copy and use that here.
968 */
969 struct lockdep_map lockdep_map = timer->lockdep_map;
970#endif
971 /*
972 * Couple the lock chain with the lock chain at
973 * del_timer_sync() by acquiring the lock_map around the fn()
974 * call here and in del_timer_sync().
975 */
976 lock_map_acquire(&lockdep_map);
977
978 trace_timer_expire_entry(timer);
979 fn(data);
980 trace_timer_expire_exit(timer);
981
982 lock_map_release(&lockdep_map);
983
984 if (preempt_count != preempt_count()) {
985 printk(KERN_ERR "timer: %pF preempt leak: %08x -> %08x\n",
986 fn, preempt_count, preempt_count());
987 BUG();
988 }
989}
990
956#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) 991#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
957 992
958/** 993/**
@@ -996,42 +1031,7 @@ static inline void __run_timers(struct tvec_base *base)
996 detach_timer(timer, 1); 1031 detach_timer(timer, 1);
997 1032
998 spin_unlock_irq(&base->lock); 1033 spin_unlock_irq(&base->lock);
999 { 1034 call_timer_fn(timer, fn, data);
1000 int preempt_count = preempt_count();
1001
1002#ifdef CONFIG_LOCKDEP
1003 /*
1004 * It is permissible to free the timer from
1005 * inside the function that is called from
1006 * it, this we need to take into account for
1007 * lockdep too. To avoid bogus "held lock
1008 * freed" warnings as well as problems when
1009 * looking into timer->lockdep_map, make a
1010 * copy and use that here.
1011 */
1012 struct lockdep_map lockdep_map =
1013 timer->lockdep_map;
1014#endif
1015 /*
1016 * Couple the lock chain with the lock chain at
1017 * del_timer_sync() by acquiring the lock_map
1018 * around the fn() call here and in
1019 * del_timer_sync().
1020 */
1021 lock_map_acquire(&lockdep_map);
1022
1023 trace_timer_expire_entry(timer);
1024 fn(data);
1025 trace_timer_expire_exit(timer);
1026
1027 lock_map_release(&lockdep_map);
1028
1029 if (preempt_count != preempt_count()) {
1030 printk(KERN_ERR "timer: %pF preempt leak: %08x -> %08x\n",
1031 fn, preempt_count, preempt_count());
1032 BUG();
1033 }
1034 }
1035 spin_lock_irq(&base->lock); 1035 spin_lock_irq(&base->lock);
1036 } 1036 }
1037 } 1037 }