git: d3584f92835a - main - linuxkpi: Define `typeof_member()` in <linux/kernel.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 17:57:48 UTC
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=d3584f92835a07d76bc579168ac5fdc3e020d5f0

commit d3584f92835a07d76bc579168ac5fdc3e020d5f0
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:41:36 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2022-11-11 17:41:36 +0000

    linuxkpi: Define `typeof_member()` in <linux/kernel.h>
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36964
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 2c40b2f33c41..3ae8f31832fd 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -577,6 +577,8 @@ kstrtou8_from_user(const char __user *s, size_t count, unsigned int base,
 #define offsetofend(t, m)	\
         (offsetof(t, m) + sizeof((((t *)0)->m)))
 
+#define	typeof_member(s, e)	typeof(((s *)0)->e)
+
 #define clamp_t(type, _x, min, max)	min_t(type, max_t(type, _x, min), max)
 #define clamp(x, lo, hi)		min( max(x,lo), hi)
 #define	clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)