[Skiboot] [PATCH 1/2] timer: Move update_timer_expiry call to separate function

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu May 3 23:21:25 AEST 2018


Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/timer.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/core/timer.c b/core/timer.c
index 8eefb74be..1c5395178 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;
 		}
 
-- 
2.14.3



More information about the Skiboot mailing list