Skip to contentSkip to conversation

batman-adv: Convert kbuild version check to preprocessor check

PATCH Applied Sven Eckelmann 2 participants 2 messages Oct 23, 2010 – Oct 25, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: Convert kbuild version check to preprocessor check

Makefile.kbuild includes a relative unreadable check for a version number to decide if we should compile bat_printk.c to get out own print implementations. This can easily be replaced using a simpler preprocessor check as we know them from compat.h

---
 batman-adv/Makefile.kbuild |    6 +++++-
 batman-adv/bat_printk.c    |    6 ++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
batman-adv/Makefile.kbuild +5 -1
index 14e3daa..40ca316 100644
@@ -32,4 +32,8 @@ EXTRA_CFLAGS += -DREVISION_VERSION=\"$(REVISION)\"
 endif
 
 obj-m += batman-adv.o
-batman-adv-y := main.o bat_debugfs.o bat_sysfs.o send.o routing.o soft-interface.o icmp_socket.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o originator.o gateway_common.o gateway_client.o unicast.o $(shell [ "2" -eq "$(VERSION)" ] 2>&- && [ "6" -eq "$(PATCHLEVEL)" ] 2>&- && [ "$(SUBLEVEL)" -le "28" ] 2>&- && echo bat_printk.o)
+batman-adv-y := aggregation.o bat_debugfs.o bat_sysfs.o bitarray.o \
+				gateway_client.o gateway_common.o hard-interface.o hash.o \
+				icmp_socket.o main.o originator.o ring_buffer.o routing.o \
+				send.o soft-interface.o translation-table.o unicast.o vis.o
+batman-adv-y += bat_printk.o
batman-adv/bat_printk.c +6 -0
index 4fa3e18..6bbeb8b 100644
@@ -1,3 +1,7 @@
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+
 /*
  *  linux/lib/vsprintf.c
  *
@@ -935,3 +939,5 @@ int bat_snprintf(char *buf, size_t size, const char *fmt, ...)
 
 	return i;
 }
+
+#endif /* < KERNEL_VERSION(2, 6, 29) */
Signature · 1 line
1.7.1
#1 lore raw
Quoted 4 lines · On Sunday 24 October 2010 01:15:46 Sven Eckelmann wrote:

Makefile.kbuild includes a relative unreadable check for a version number to decide if we should compile bat_printk.c to get out own print implementations. This can easily be replaced using a simpler preprocessor check as we know them from compat

Applied in revision 1855.

Thanks,
Marek