@@ -94,6 +94,7 @@ odpapiplatinclude_HEADERS = \
$(srcdir)/include/odp/api/plat/thread_types.h \
$(srcdir)/include/odp/api/plat/thrmask_types.h \
$(srcdir)/include/odp/api/plat/ticketlock_inlines.h \
+ $(srcdir)/include/odp/api/plat/ticketlock_inlines_api.h \
$(srcdir)/include/odp/api/plat/ticketlock_types.h \
$(srcdir)/include/odp/api/plat/time_types.h \
$(srcdir)/include/odp/api/plat/timer_types.h \
@@ -13,11 +13,12 @@
#ifndef _ODP_PLAT_TICKETLOCK_INLINES_H_
#define _ODP_PLAT_TICKETLOCK_INLINES_H_
-#include <odp/api/ticketlock.h>
#include <odp/api/atomic.h>
#include <odp/api/sync.h>
#include <odp/api/cpu.h>
+#include <odp/api/plat/ticketlock_types.h>
+
/** @internal
* Acquire ticket lock.
*
@@ -110,4 +111,20 @@ static inline int _odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock)
odp_atomic_load_u32(&ticketlock->next_ticket);
}
+/* Include inlined versions of API functions */
+#include <odp/api/plat/static_inline.h>
+#if ODP_ABI_COMPAT == 0
+
+/** @ingroup odp_locks
+ * @{
+ */
+
+#include <odp/api/plat/ticketlock_inlines_api.h>
+
+/**
+ * @}
+ */
+
+#endif
+
#endif
new file mode 100644
@@ -0,0 +1,36 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * Ticketlock inline functions
+ */
+
+#ifndef _ODP_PLAT_TICKETLOCK_INLINES_API_H_
+#define _ODP_PLAT_TICKETLOCK_INLINES_API_H_
+
+_ODP_INLINE void odp_ticketlock_lock(odp_ticketlock_t *lock)
+{
+ return _odp_ticketlock_lock(lock);
+}
+
+_ODP_INLINE int odp_ticketlock_trylock(odp_ticketlock_t *lock)
+{
+ return _odp_ticketlock_trylock(lock);
+}
+
+_ODP_INLINE void odp_ticketlock_unlock(odp_ticketlock_t *lock)
+{
+ _odp_ticketlock_unlock(lock);
+}
+
+_ODP_INLINE int odp_ticketlock_is_locked(odp_ticketlock_t *lock)
+{
+ return _odp_ticketlock_is_locked(lock);
+}
+
+#endif
@@ -19,6 +19,10 @@ extern "C" {
#include <odp/api/plat/ticketlock_types.h>
+#if ODP_ABI_COMPAT == 0
+#include <odp/api/plat/ticketlock_inlines.h>
+#endif
+
#include <odp/api/spec/ticketlock.h>
#ifdef __cplusplus
@@ -5,6 +5,7 @@
*/
#include <odp/api/plat/ticketlock_inlines.h>
+#include <odp/api/spec/ticketlock.h>
void odp_ticketlock_init(odp_ticketlock_t *ticketlock)
{
@@ -12,22 +13,7 @@ void odp_ticketlock_init(odp_ticketlock_t *ticketlock)
odp_atomic_init_u32(&ticketlock->cur_ticket, 0);
}
-void odp_ticketlock_lock(odp_ticketlock_t *lock)
-{
- return _odp_ticketlock_lock(lock);
-}
-
-int odp_ticketlock_trylock(odp_ticketlock_t *lock)
-{
- return _odp_ticketlock_trylock(lock);
-}
-
-void odp_ticketlock_unlock(odp_ticketlock_t *lock)
-{
- _odp_ticketlock_unlock(lock);
-}
-
-int odp_ticketlock_is_locked(odp_ticketlock_t *lock)
-{
- return _odp_ticketlock_is_locked(lock);
-}
+/* Include non-inlined versions of API functions */
+#if ODP_ABI_COMPAT == 1
+#include <odp/api/plat/ticketlock_inlines_api.h>
+#endif
Enable ticketlock function inlining in applications when not building for ABI compatibility. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- platform/linux-generic/Makefile.am | 1 + .../include/odp/api/plat/ticketlock_inlines.h | 19 +++++++++++- .../include/odp/api/plat/ticketlock_inlines_api.h | 36 ++++++++++++++++++++++ .../linux-generic/include/odp/api/ticketlock.h | 4 +++ platform/linux-generic/odp_ticketlock.c | 24 +++------------ 5 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 platform/linux-generic/include/odp/api/plat/ticketlock_inlines_api.h -- 2.8.1