From 3c574d8e718890ef31753a68b38104e0aac5467e Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Thu, 3 May 2018 18:51:25 +0530 Subject: timer: Move update_timer_expiry call to separate function Signed-off-by: Vasant Hegde Signed-off-by: Stewart Smith --- core/timer.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/timer.c b/core/timer.c index 8eefb74..1c53951 100644 --- a/core/timer.c +++ b/core/timer.c @@ -23,6 +23,14 @@ static LIST_HEAD(timer_poll_list); static bool timer_in_poll; static uint64_t timer_poll_gen; +static inline void update_timer_expiry(uint64_t target) +{ + if (proc_gen < proc_gen_p9) + p8_sbe_update_timer_expiry(target); + else + p9_sbe_update_timer_expiry(target); +} + void init_timer(struct timer *t, timer_func_t expiry, void *data) { t->link.next = t->link.prev = NULL; @@ -111,10 +119,7 @@ static void __schedule_timer_at(struct timer *t, uint64_t when) /* Pick up the next timer and upddate the SBE HW timer */ lt = list_top(&timer_list, struct timer, link); if (lt) { - if (proc_gen < proc_gen_p9) - p8_sbe_update_timer_expiry(lt->target); - else - p9_sbe_update_timer_expiry(lt->target); + update_timer_expiry(lt->target); } } @@ -172,11 +177,7 @@ static void __check_poll_timers(uint64_t now) * arbitrarily 1us. */ if (t->running) { - if (proc_gen < proc_gen_p9) - p8_sbe_update_timer_expiry(now + usecs_to_tb(1)); - else - p9_sbe_update_timer_expiry(now + usecs_to_tb(1)); - + update_timer_expiry(now + usecs_to_tb(1)); break; } -- cgit v1.1