Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 4c7c9b34822b319f85fcfb0df2ddc386c6453f9e
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Dec 9 13:35:38 2019 +0100
batman-adv: Revert "Use sizeof_member() macro"
The code added in commit 8a54d0aaf9d3c674516eeb03e2768c5cc12c84e1 was
rejected by Linus Torvalds [1]:
> I _can_ see why we'd want to standardize on one of the tree versions we
> have, but I can't really see the problem with the existing #define that
> we have, and that is used (admittedly not all that much): sizeof_field().
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
4c7c9b34822b319f85fcfb0df2ddc386c6453f9e
compat-include/linux/stddef.h | 24 ------------------------
net/batman-adv/main.c | 2 +-
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/compat-include/linux/stddef.h b/compat-include/linux/stddef.h
deleted file mode 100644
index a09b4201..00000000
--- a/compat-include/linux/stddef.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2019 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_STDDEF_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_STDDEF_H_
-
-#include <linux/version.h>
-#include_next <linux/stddef.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
-
-#ifndef sizeof_member
-#define sizeof_member(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
-#endif
-
-#endif /* < KERNEL_VERSION(5, 5, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_STDDEF_H_ */
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 49cce458..4a89177d 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -548,7 +548,7 @@ static void batadv_recv_handler_init(void)
BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_change) != 12);
BUILD_BUG_ON(sizeof(struct batadv_tvlv_roam_adv) != 8);
- i = sizeof_member(struct sk_buff, cb);
+ i = FIELD_SIZEOF(struct sk_buff, cb);
BUILD_BUG_ON(sizeof(struct batadv_skb_cb) > i);
/* broadcast packet */