1
0
Fork 0
alistair23-linux/drivers/staging/rtl8723bs
Nathan Chancellor 97715058b7 staging: rtl8723bs: Fix build error with Clang when inlining is disabled
When CONFIG_NO_AUTO_INLINE was present in linux-next (which added
'-fno-inline-functions' to KBUILD_CFLAGS), an allyesconfig build with
Clang failed at the modpost stage:

ERROR: "is_broadcast_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
ERROR: "is_zero_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
ERROR: "is_multicast_mac_addr" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!

These functions were marked as extern inline, meaning that if inlining
doesn't happen, the function will be undefined, as it is above.

This happens to work with GCC because the '-fno-inline-functions' option
respects the __inline attribute so all instances of these functions are
inlined as expected and the definition doesn't actually matter. However,
with Clang and '-fno-inline-functions', a function has to be marked with
the __always_inline attribute to be considered for inlining, which none
of these functions are. Clang tries to find the symbol definition
elsewhere as it was told and fails, which trickles down to modpost.

To make sure that this code compiles regardless of compiler and make the
intention of the code clearer, use 'static' to ensure these functions
are always defined, regardless of inlining. Additionally, silence a
checkpatch warning by switching from '__inline' to 'inline'.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-18 10:28:44 +01:00
..
core Staging: rtl8723bs: Fix code style issue in rtl8723bs driver 2018-12-17 14:26:10 +01:00
hal Staging: rtl8723bs: Fix code style issue in rtl8723bs driver 2018-12-17 14:26:10 +01:00
include staging: rtl8723bs: Fix build error with Clang when inlining is disabled 2019-01-18 10:28:44 +01:00
os_dep Revert "staging: rtl8723bs: Mark ACPI table declaration as used" 2019-01-11 10:40:13 +01:00
Kconfig
Makefile staging: rtl8723bs: Rename 'Hal8723BPwrSeq.{c, h}' to 'hal_pwr_seq.*'. 2018-05-25 18:47:22 +02:00
TODO staging: rtl8723bs: fix typo in the TODO file 2018-12-12 11:37:58 +01:00