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(a)narfation.org>
---
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 e8a44991..357b3a6a 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>
---
base-commit: 5fecd4a389cea1b9719e9ec480d7257887e0dfdf
change-id: 20231113-new-6-7-headers-2ac8803d5292
Best regards,
--
Sven Eckelmann <sven(a)narfation.org>