diff mbox series

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

Message ID 20180503132126.6830-1-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series [1/2] timer: Move update_timer_expiry call to separate function | expand

Commit Message

Vasant Hegde May 3, 2018, 1:21 p.m. UTC
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 core/timer.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Stewart Smith May 6, 2018, 5:25 p.m. UTC | #1
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>  core/timer.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)

I've taken patch 1/2 as of 3c574d8e718890ef31753a68b38104e0aac5467e.

From discussion on the second patch, I'll wait for a v2 there.
diff mbox series

Patch

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;
 		}