backport-include: fix abs definition in kernel.h
authorArend van Spriel <arend@broadcom.com>
Fri, 1 Apr 2016 20:35:27 +0000 (22:35 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 30 Apr 2016 16:00:26 +0000 (18:00 +0200)
The definition of abs should be within include protection to avoid
following build issue:

In file included from /tmp/bp-test/backport-include/linux/kernel.h:3:0,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:4,
                 from /tmp/bp-test/backport-include/linux/time.h:3,
                 from include/linux/stat.h:18,
                 from include/linux/module.h:10,
                 from /tmp/bp-test/backport-include/linux/module.h:3,
                 from /tmp/bp-test/net/wireless/nl80211.c:10:
include/linux/kernel.h:179:0: warning: "abs" redefined [enabled by default]
error, forbidden warning: kernel.h:179
make[6]: *** [/tmp/bp-test/net/wireless/nl80211.o] Error 1

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport/backport-include/linux/kernel.h

index 7d56f02bcde98fae87013c5a3b6ab8048131b7a3..54050aa5a35137ae534a0d574ac1c905aab973dd 100644 (file)
@@ -153,19 +153,6 @@ int __must_check hex2bin(u8 *dst, const char *src, size_t count);
 #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
 #endif /* < 3.18 */
 
-#endif /* __BACKPORT_KERNEL_H */
-
-/*
- * We have to do this outside the include guard, because
- * out own header (linux/export.h) has to include kernel.h
- * indirectly (through module.h) and then undef's pr_fmt.
- * Then, when the real kernel.h gets included again, it's
- * not defined and we get problems ...
- */
-#ifndef pr_fmt
-#define pr_fmt(msg) msg
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
 
 #undef abs
@@ -193,3 +180,16 @@ int __must_check hex2bin(u8 *dst, const char *src, size_t count);
        ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
 
 #endif
+
+#endif /* __BACKPORT_KERNEL_H */
+
+/*
+ * We have to do this outside the include guard, because
+ * out own header (linux/export.h) has to include kernel.h
+ * indirectly (through module.h) and then undef's pr_fmt.
+ * Then, when the real kernel.h gets included again, it's
+ * not defined and we get problems ...
+ */
+#ifndef pr_fmt
+#define pr_fmt(msg) msg
+#endif