batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2
PATCH v2 1/1 batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2
Fixes 2c2fe0ba9ea5 ("batman-adv: ELP - creating neighbor structures")
Signed-off-by Sven Eckelmann <[email protected]>
---
v2:
- add missing include in average.h which is required to always defined BUILD_BUG_ON_NOT_POWER_OF_2 correctly
compat-include/linux/average.h | 2 ++ compat-include/linux/bug.h | 13 +++++++++++++ 2 files changed, 15 insertions(+)
compat-include/linux/average.h +2 -0
@@ -26,6 +26,8 @@#include_next <linux/average.h>#endif +#include <linux/bug.h> +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,3 ,0 )/* Exponentially weighted moving average (EWMA) */
compat-include/linux/bug.h +13 -0
@@ -24,6 +24,19 @@#include <linux/version.h> #include_next <linux/bug.h> +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,33 ) + +#undef BUILD_BUG_ON_NOT_POWER_OF_2 +#ifdef __CHECKER__ +#define BUILD_BUG_ON_NOT_POWER_OF_2 (n) (0) +#else +/* Force a compilation error if a constant expression is not a power of 2 */ +#define BUILD_BUG_ON_NOT_POWER_OF_2 (n) \ + BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) +#endif + +#endif /* < KERNEL_VERSION(2, 6, 33) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,0 ,0 )#undef BUILD_BUG_ON
Signature · 1 line
2.7.0.rc3
Marek Lindner
AppliedQuoted 10 lines · On Wednesday, January 20, 2016 19:00:15 Sven Eckelmann wrote:
Fixes 2c2fe0ba9ea5 ("batman-adv: ELP - creating neighbor structures")Signed-off-by Sven Eckelmann <[email protected]>---
v2:
- add missing include inaverage.hwhich is required to always definedBUILD_BUG_ON_NOT_POWER_OF_2correctlycompat-include/linux/average.h | 2 ++ compat-include/linux/bug.h | 13 +++++++++++++ 2 files changed, 15 insertions(+)
Applied in revision a23e9a9.
Thanks,
Marek