diff mbox series

[25/29] linux-gen: move several files under ODP_ABI_COMPAT condition

Message ID 20171023111057.6328-26-dmitry.ereminsolenikov@linaro.org
State Superseded
Headers show
Series restructure headers for ABI-compat/platform-optimized modes | expand

Commit Message

Dmitry Eremin-Solenikov Oct. 23, 2017, 11:10 a.m. UTC
Several files consist only (or mostly) of functions compiled only if
ODP is compiled in ABI compatibility mode. Instead of having an ifdef
inside, guard them with if ODP_ABI_COMPAT condition in Makefile.am

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
 platform/linux-generic/Makefile.am                          | 13 +++++++++----
 .../include/odp/api/plat/ticketlock_inlines_api.h           |  6 ++++++
 platform/linux-generic/odp_atomic.c                         |  4 ----
 platform/linux-generic/odp_atomic_api.c                     | 13 +++++++++++++
 platform/linux-generic/odp_byteorder.c                      |  6 +++---
 platform/linux-generic/odp_std_clib.c                       |  6 +++---
 platform/linux-generic/odp_sync.c                           |  6 +++---
 platform/linux-generic/odp_ticketlock.c                     | 10 +---------
 8 files changed, 38 insertions(+), 26 deletions(-)
 create mode 100644 platform/linux-generic/odp_atomic_api.c

-- 
2.14.2
diff mbox series

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index f2454ac51fff..078d154f8f15 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,7 +167,6 @@  __LIB__libodp_linux_la_SOURCES = \
 			   odp_barrier.c \
 			   odp_bitmap.c \
 			   odp_buffer.c \
-			   odp_byteorder.c \
 			   odp_chksum.c \
 			   odp_classification.c \
 			   odp_cpu.c \
@@ -215,12 +214,9 @@  __LIB__libodp_linux_la_SOURCES = \
 			   odp_sorted_list.c \
 			   odp_spinlock.c \
 			   odp_spinlock_recursive.c \
-			   odp_std_clib.c \
-			   odp_sync.c \
 			   odp_system_info.c \
 			   odp_thread.c \
 			   odp_thrmask.c \
-			   odp_ticketlock.c \
 			   odp_time.c \
 			   odp_timer.c \
 			   odp_timer_wheel.c \
@@ -233,6 +229,15 @@  __LIB__libodp_linux_la_SOURCES = \
 			   drv_shm.c \
 			   drv_spinlock.c
 
+if ODP_ABI_COMPAT
+__LIB__libodp_linux_la_SOURCES += \
+			   odp_atomic_api.c \
+			   odp_byteorder.c \
+			   odp_std_clib.c \
+			   odp_sync.c \
+			   odp_ticketlock.c
+endif
+
 if ARCH_IS_ARM
 __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
 				  arch/default/odp_cpu_cycles.c \
diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h
index 5efe696ff734..4f8509569228 100644
--- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h
+++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h
@@ -33,4 +33,10 @@  _ODP_INLINE int odp_ticketlock_is_locked(odp_ticketlock_t *lock)
 	return _odp_ticketlock_is_locked(lock);
 }
 
+_ODP_INLINE void odp_ticketlock_init(odp_ticketlock_t *ticketlock)
+{
+	odp_atomic_init_u32(&ticketlock->next_ticket, 0);
+	odp_atomic_init_u32(&ticketlock->cur_ticket, 0);
+}
+
 #endif
diff --git a/platform/linux-generic/odp_atomic.c b/platform/linux-generic/odp_atomic.c
index 1d76caf2b82f..8c46bb5bb11f 100644
--- a/platform/linux-generic/odp_atomic.c
+++ b/platform/linux-generic/odp_atomic.c
@@ -7,10 +7,6 @@ 
 #include "config.h"
 
 #include <odp/api/atomic.h>
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 1
-#include <odp/api/plat/atomic_inlines.h>
-#endif
 
 int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op)
 {
diff --git a/platform/linux-generic/odp_atomic_api.c b/platform/linux-generic/odp_atomic_api.c
new file mode 100644
index 000000000000..a1aabb07c692
--- /dev/null
+++ b/platform/linux-generic/odp_atomic_api.c
@@ -0,0 +1,13 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include "config.h"
+
+#include <odp/api/atomic.h>
+
+/* Include non-inlined versions of API functions */
+#define _ODP_INLINE
+#include <odp/api/plat/atomic_inlines.h>
diff --git a/platform/linux-generic/odp_byteorder.c b/platform/linux-generic/odp_byteorder.c
index faf1c5904bb4..ff0b74b233cf 100644
--- a/platform/linux-generic/odp_byteorder.c
+++ b/platform/linux-generic/odp_byteorder.c
@@ -7,7 +7,7 @@ 
 #include "config.h"
 
 #include <odp/api/byteorder.h>
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 1
+
+/* Include non-inlined versions of API functions */
+#define _ODP_INLINE
 #include <odp/api/plat/byteorder_inlines.h>
-#endif
diff --git a/platform/linux-generic/odp_std_clib.c b/platform/linux-generic/odp_std_clib.c
index 38406b86b3c4..b267ea654ee2 100644
--- a/platform/linux-generic/odp_std_clib.c
+++ b/platform/linux-generic/odp_std_clib.c
@@ -7,7 +7,7 @@ 
 #include "config.h"
 
 #include <odp/api/std_clib.h>
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 1
+
+/* Include non-inlined versions of API functions */
+#define _ODP_INLINE
 #include <odp/api/plat/std_clib_inlines.h>
-#endif
diff --git a/platform/linux-generic/odp_sync.c b/platform/linux-generic/odp_sync.c
index a9d2bbe24369..b9e85593bbbf 100644
--- a/platform/linux-generic/odp_sync.c
+++ b/platform/linux-generic/odp_sync.c
@@ -7,7 +7,7 @@ 
 #include "config.h"
 
 #include <odp/api/sync.h>
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 1
+
+/* Include non-inlined versions of API functions */
+#define _ODP_INLINE
 #include <odp/api/plat/sync_inlines.h>
-#endif
diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c
index 59431620f203..63381f44b456 100644
--- a/platform/linux-generic/odp_ticketlock.c
+++ b/platform/linux-generic/odp_ticketlock.c
@@ -10,14 +10,6 @@ 
 
 #include <odp/api/plat/ticketlock_inlines.h>
 
-void odp_ticketlock_init(odp_ticketlock_t *ticketlock)
-{
-	odp_atomic_init_u32(&ticketlock->next_ticket, 0);
-	odp_atomic_init_u32(&ticketlock->cur_ticket, 0);
-}
-
 /* Include non-inlined versions of API functions */
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 1
+#define _ODP_INLINE
 #include <odp/api/plat/ticketlock_inlines_api.h>
-#endif