Repository : ssh://git@diktynna/batman-adv On branches: main,main
commit f33d7f724675544a36b24c77f8d4b95d41252ae2 Author: Sven Eckelmann sven@narfation.org Date: Mon Nov 13 18:41:19 2023 +0100
batman-adv: Switch to linux/array_size.h
The commit 3cd39bc3b11b ("kernel.h: Move ARRAY_SIZE() to a separate header") introduced a new header for the ARRAY_SIZE macro which was previously exposed via linux/kernel.h.
Signed-off-by: Sven Eckelmann sven@narfation.org
f33d7f724675544a36b24c77f8d4b95d41252ae2 compat-include/linux/array_size.h | 20 ++++++++++++++++++++ net/batman-adv/main.c | 2 +- net/batman-adv/netlink.c | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/compat-include/linux/array_size.h b/compat-include/linux/array_size.h new file mode 100644 index 00000000..824ad011 --- /dev/null +++ b/compat-include/linux/array_size.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This file contains macros for maintaining compatibility with older versions + * of the Linux kernel. + */ + +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ + +#include <linux/version.h> +#if LINUX_VERSION_IS_GEQ(6, 7, 0) +#include_next <linux/array_size.h> +#else +#include <linux/kernel.h> +#endif + +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ */ diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index e8c25583..5fc754b0 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -6,6 +6,7 @@
#include "main.h"
+#include <linux/array_size.h> #include <linux/atomic.h> #include <linux/build_bug.h> #include <linux/byteorder/generic.h> @@ -20,7 +21,6 @@ #include <linux/init.h> #include <linux/ip.h> #include <linux/ipv6.h> -#include <linux/kernel.h> #include <linux/kobject.h> #include <linux/kref.h> #include <linux/list.h> diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 2b3da616..cda99753 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -7,6 +7,7 @@ #include "netlink.h" #include "main.h"
+#include <linux/array_size.h> #include <linux/atomic.h> #include <linux/bitops.h> #include <linux/bug.h> @@ -20,7 +21,6 @@ #include <linux/if_ether.h> #include <linux/if_vlan.h> #include <linux/init.h> -#include <linux/kernel.h> #include <linux/limits.h> #include <linux/list.h> #include <linux/minmax.h>