From 74db12ca99a176d71187cccec9799a1b6a1bd60d Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 23 Feb 2015 12:54:46 +0000 Subject: [PATCH] Macro fixes: - Add missing "order_base_2()" macro. - Fix BUILD_BUG_ON() macro. MFC after: 1 month Sponsored by: Mellanox Technologies --- sys/ofed/include/linux/kernel.h | 2 +- sys/ofed/include/linux/log2.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ofed/include/linux/kernel.h b/sys/ofed/include/linux/kernel.h index 2f665c6663b..d07b3eb2cf0 100644 --- a/sys/ofed/include/linux/kernel.h +++ b/sys/ofed/include/linux/kernel.h @@ -59,7 +59,7 @@ #define KERN_INFO "<6>" #define KERN_DEBUG "<7>" -#define BUILD_BUG_ON(x) CTASSERT(x) +#define BUILD_BUG_ON(x) CTASSERT(!(x)) #define BUG() panic("BUG") #define BUG_ON(condition) do { if (condition) BUG(); } while(0) diff --git a/sys/ofed/include/linux/log2.h b/sys/ofed/include/linux/log2.h index ffc1fdb64cf..77a29248658 100644 --- a/sys/ofed/include/linux/log2.h +++ b/sys/ofed/include/linux/log2.h @@ -167,4 +167,6 @@ int __ilog2_u64(u64 n) __ilog2_u64(n) \ ) +#define order_base_2(x) ilog2(roundup_pow_of_two(x)) + #endif /* _LINUX_LOG2_H_ */