Diff
1diff --git a/platforms/common.mk b/platforms/common.mk
2index 693bdc8cf0e35909123535b47faaa7dd1cf31f92..da0697e3b09761dc8eaddc79203c698138fc82f0 100644
3--- a/platforms/common.mk
4+++ b/platforms/common.mk
5@@ -2,6 +2,8 @@ PLATFORM_COMMON_DIR = $(PLATFORM_PATH)/$(PLATFORM_KEY)
6
7 TMK_COMMON_SRC += \
8 $(PLATFORM_PATH)/suspend.c \
9+ $(PLATFORM_PATH)/synchronization_util.c \
10+ $(PLATFORM_PATH)/timer.c \
11 $(PLATFORM_COMMON_DIR)/hardware_id.c \
12 $(PLATFORM_COMMON_DIR)/platform.c \
13 $(PLATFORM_COMMON_DIR)/suspend.c \
14diff --git a/platforms/synchronization_util.c b/platforms/synchronization_util.c
15new file mode 100644
16index 0000000000000000000000000000000000000000..26cf7dccf19eec2ea70e15154de06210e04600aa
17--- /dev/null
18+++ b/platforms/synchronization_util.c
19@@ -0,0 +1,17 @@
20+// Copyright 2023 Sergey Vlasov (@sigprof)
21+// SPDX-License-Identifier: GPL-2.0-or-later
22+
23+#include "synchronization_util.h"
24+
25+// Generate out-of-line copies for inline functions defined in synchronization_util.h.
26+
27+#if !defined(PLATFORM_SUPPORTS_SYNCHRONIZATION)
28+# if defined(SPLIT_KEYBOARD)
29+extern inline void split_shared_memory_lock(void);
30+extern inline void split_shared_memory_unlock(void);
31+# endif
32+#endif
33+
34+#if defined(SPLIT_KEYBOARD)
35+QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(split_shared_memory)
36+#endif
37diff --git a/platforms/synchronization_util.h b/platforms/synchronization_util.h
38index 59933945c3b25300b6c420e18e294916861d8e73..4969eff478ea042a93d8e10010c2f78c0c584f16 100644
39--- a/platforms/synchronization_util.h
40+++ b/platforms/synchronization_util.h
41@@ -29,6 +29,12 @@ inline void split_shared_memory_unlock(void){};
42 prefix##_unlock(); \
43 }
44
45+/* Generate an out-of-line implementation in case the inline functions defined
46+ * by the above macro don't actually get inlined. */
47+#define QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(prefix) \
48+ extern inline unsigned prefix##_autounlock_lock_helper(void); \
49+ extern inline void prefix##_autounlock_unlock_helper(unsigned* unused_guard);
50+
51 /* Convinience macro the automatically generate the correct RAII-style
52 * lock_autounlock function macro */
53 #define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper
54diff --git a/platforms/timer.c b/platforms/timer.c
55new file mode 100644
56index 0000000000000000000000000000000000000000..26038dcda329a888af07785cf80d397c7c232090
57--- /dev/null
58+++ b/platforms/timer.c
59@@ -0,0 +1,8 @@
60+// Copyright 2023 Sergey Vlasov (@sigprof)
61+// SPDX-License-Identifier: GPL-2.0-or-later
62+
63+#include "timer.h"
64+
65+// Generate out-of-line copies for inline functions defined in timer.h.
66+extern inline fast_timer_t timer_read_fast(void);
67+extern inline fast_timer_t timer_elapsed_fast(fast_timer_t last);
68diff --git a/quantum/mousekey.c b/quantum/mousekey.c
69index 703fb39fa6efd1b24735eca86f4b279f4790db37..df8aa613bea4d6d8161395ace3ba847df119d1d8 100644
70--- a/quantum/mousekey.c
71+++ b/quantum/mousekey.c
72@@ -24,7 +24,7 @@
73 #include "debug.h"
74 #include "mousekey.h"
75
76-inline int8_t times_inv_sqrt2(int8_t x) {
77+static inline int8_t times_inv_sqrt2(int8_t x) {
78 // 181/256 is pretty close to 1/sqrt(2)
79 // 0.70703125 0.707106781
80 // 1 too small for x=99 and x=198