[PATCH 1/9] timers: remove the fn and data arguments to call_timer_fn

From: Christoph Hellwig
Date: Tue May 16 2017 - 07:48:34 EST


And just move the dereferences inline, given that the timer gets
passed as an argument.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
kernel/time/timer.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 152a706ef8b8..c7978fcdbbea 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1240,8 +1240,7 @@ int del_timer_sync(struct timer_list *timer)
EXPORT_SYMBOL(del_timer_sync);
#endif

-static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
- unsigned long data)
+static void call_timer_fn(struct timer_list *timer)
{
int count = preempt_count();

@@ -1265,14 +1264,14 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
lock_map_acquire(&lockdep_map);

trace_timer_expire_entry(timer);
- fn(data);
+ timer->function(timer->data);
trace_timer_expire_exit(timer);

lock_map_release(&lockdep_map);

if (count != preempt_count()) {
WARN_ONCE(1, "timer: %pF preempt leak: %08x -> %08x\n",
- fn, count, preempt_count());
+ timer->function, count, preempt_count());
/*
* Restore the preempt count. That gives us a decent
* chance to survive and extract information. If the
@@ -1287,24 +1286,19 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head)
{
while (!hlist_empty(head)) {
struct timer_list *timer;
- void (*fn)(unsigned long);
- unsigned long data;

timer = hlist_entry(head->first, struct timer_list, entry);

base->running_timer = timer;
detach_timer(timer, true);

- fn = timer->function;
- data = timer->data;
-
if (timer->flags & TIMER_IRQSAFE) {
spin_unlock(&base->lock);
- call_timer_fn(timer, fn, data);
+ call_timer_fn(timer);
spin_lock(&base->lock);
} else {
spin_unlock_irq(&base->lock);
- call_timer_fn(timer, fn, data);
+ call_timer_fn(timer);
spin_lock_irq(&base->lock);
}
}
--
2.11.0