public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@open-mesh.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@open-mesh.com>
Subject: [B.A.T.M.A.N.] [PATCH v2] batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2
Date: Wed, 20 Jan 2016 19:00:15 +0100	[thread overview]
Message-ID: <1453312815-20752-1-git-send-email-sven@open-mesh.com> (raw)

Fixes: 2c2fe0ba9ea5 ("batman-adv: ELP - creating neighbor structures")
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
---
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(+)

diff --git a/compat-include/linux/average.h b/compat-include/linux/average.h
index e5a2bf5..631df9b 100644
--- a/compat-include/linux/average.h
+++ b/compat-include/linux/average.h
@@ -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) */
diff --git a/compat-include/linux/bug.h b/compat-include/linux/bug.h
index 124fd28..0c46158 100644
--- a/compat-include/linux/bug.h
+++ b/compat-include/linux/bug.h
@@ -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
-- 
2.7.0.rc3


             reply	other threads:[~2016-01-20 18:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 18:00 Sven Eckelmann [this message]
2016-01-30  4:17 ` [B.A.T.M.A.N.] [PATCH v2] batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2 Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453312815-20752-1-git-send-email-sven@open-mesh.com \
    --to=sven@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox