]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/staging-rtl8723bs-fix-build-error-with-clang-when-in.patch
Linux 4.14.105
[thirdparty/kernel/stable-queue.git] / queue-4.19 / staging-rtl8723bs-fix-build-error-with-clang-when-in.patch
1 From f980a4552c4677cacf7a1aeb5ead6941c2a82718 Mon Sep 17 00:00:00 2001
2 From: Nathan Chancellor <natechancellor@gmail.com>
3 Date: Wed, 16 Jan 2019 06:20:11 -0700
4 Subject: staging: rtl8723bs: Fix build error with Clang when inlining is
5 disabled
6
7 [ Upstream commit 97715058b70da1262fd07798c8b2e3e894f759dd ]
8
9 When CONFIG_NO_AUTO_INLINE was present in linux-next (which added
10 '-fno-inline-functions' to KBUILD_CFLAGS), an allyesconfig build with
11 Clang failed at the modpost stage:
12
13 ERROR: "is_broadcast_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
14 ERROR: "is_zero_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
15 ERROR: "is_multicast_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
16
17 These functions were marked as extern inline, meaning that if inlining
18 doesn't happen, the function will be undefined, as it is above.
19
20 This happens to work with GCC because the '-fno-inline-functions' option
21 respects the __inline attribute so all instances of these functions are
22 inlined as expected and the definition doesn't actually matter. However,
23 with Clang and '-fno-inline-functions', a function has to be marked with
24 the __always_inline attribute to be considered for inlining, which none
25 of these functions are. Clang tries to find the symbol definition
26 elsewhere as it was told and fails, which trickles down to modpost.
27
28 To make sure that this code compiles regardless of compiler and make the
29 intention of the code clearer, use 'static' to ensure these functions
30 are always defined, regardless of inlining. Additionally, silence a
31 checkpatch warning by switching from '__inline' to 'inline'.
32
33 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 Signed-off-by: Sasha Levin <sashal@kernel.org>
36 ---
37 drivers/staging/rtl8723bs/include/ieee80211.h | 6 +++---
38 1 file changed, 3 insertions(+), 3 deletions(-)
39
40 diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
41 index bcc8dfa8e6728..9efb4dcb9d3a8 100644
42 --- a/drivers/staging/rtl8723bs/include/ieee80211.h
43 +++ b/drivers/staging/rtl8723bs/include/ieee80211.h
44 @@ -850,18 +850,18 @@ enum ieee80211_state {
45 #define IP_FMT "%pI4"
46 #define IP_ARG(x) (x)
47
48 -extern __inline int is_multicast_mac_addr(const u8 *addr)
49 +static inline int is_multicast_mac_addr(const u8 *addr)
50 {
51 return ((addr[0] != 0xff) && (0x01 & addr[0]));
52 }
53
54 -extern __inline int is_broadcast_mac_addr(const u8 *addr)
55 +static inline int is_broadcast_mac_addr(const u8 *addr)
56 {
57 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
58 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
59 }
60
61 -extern __inline int is_zero_mac_addr(const u8 *addr)
62 +static inline int is_zero_mac_addr(const u8 *addr)
63 {
64 return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
65 (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
66 --
67 2.19.1
68