diff mbox

[2/3] linux-geneirc: timer: remove ifdefs inside function from timer_cancel

Message ID 1426076147-10053-3-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov March 11, 2015, 12:15 p.m. UTC
Using ifdefs inside function make it hard to read. No functional changes.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/odp_timer.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 8b04bd2..33c2758 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -467,15 +467,16 @@  static bool timer_reset(uint32_t idx,
 	return success;
 }
 
+
+#ifdef ODP_ATOMIC_U128
 static odp_buffer_t timer_cancel(odp_timer_pool *tp,
 		uint32_t idx,
 		uint64_t new_state)
 {
 	tick_buf_t *tb = &tp->tick_buf[idx];
 	odp_buffer_t old_buf;
-
-#ifdef ODP_ATOMIC_U128
 	tick_buf_t new, old;
+
 	/* Update the timer state (e.g. cancel the current timeout) */
 	new.exp_tck.v = new_state;
 	/* Swap out the old buffer */
@@ -485,7 +486,18 @@  static odp_buffer_t timer_cancel(odp_timer_pool *tp,
 				 (_uint128_t *)&new, (_uint128_t *)&old,
 				 _ODP_MEMMODEL_RLX);
 	old_buf = old.tmo_buf;
+
+	/* Return the old buffer */
+	return old_buf;
+}
 #else
+static odp_buffer_t timer_cancel(odp_timer_pool *tp,
+		uint32_t idx,
+		uint64_t new_state)
+{
+	tick_buf_t *tb = &tp->tick_buf[idx];
+	odp_buffer_t old_buf;
+
 	/* Take a related lock */
 	while (_odp_atomic_flag_tas(IDX2LOCK(idx)))
 		/* While lock is taken, spin using relaxed loads */
@@ -501,10 +513,11 @@  static odp_buffer_t timer_cancel(odp_timer_pool *tp,
 
 	/* Release the lock */
 	_odp_atomic_flag_clear(IDX2LOCK(idx));
-#endif
+
 	/* Return the old buffer */
 	return old_buf;
 }
+#endif
 
 static int post_timeout_to_queue(odp_queue_t queue, odp_buffer_t tmo_buf,
 				 uint64_t exp_tck)