git: 680731566e68 - stable/13 - linuxkpi: Define `typeof_member()` in <linux/kernel.h>

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 08:54:01 UTC
The branch stable/13 has been updated by manu:

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

commit 680731566e6848c92fa8f6f567d98f67cb5e0fbe
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:41:36 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-01-24 09:08:00 +0000

    linuxkpi: Define `typeof_member()` in <linux/kernel.h>
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36964
    
    (cherry picked from commit d3584f92835a07d76bc579168ac5fdc3e020d5f0)
---
 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 f3078d94b2b5..54b558d0bea2 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -574,6 +574,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)