git: 0a2f3b8ef167 - main - linuxkpi: Move {lower,upper}_32_bits macros to <linux/wordpart.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 22 Apr 2026 20:47:22 UTC
The branch main has been updated by dumbbell:

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

commit 0a2f3b8ef16786a44fc88afd8862920df4527a3c
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-04-11 15:21:53 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-22 20:46:52 +0000

    linuxkpi: Move {lower,upper}_32_bits macros to <linux/wordpart.h>
    
    ... from <linux/compiler.h>.
    
    <linux/wordpart.h> is the header defining them on Linux 6.12 (I didn't
    check older versions).
    
    <linux/wordpart.h> is also included from <linux/kernel.h>.
    
    The DRM generic code started to depend on <linux/wordpart.h> in Linux
    6.12.
    
    Reviewed by:    bz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D56441
---
 sys/compat/linuxkpi/common/include/linux/compiler.h |  3 ---
 sys/compat/linuxkpi/common/include/linux/kernel.h   |  1 +
 sys/compat/linuxkpi/common/include/linux/wordpart.h | 13 +++++++++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 90d907dd4d45..4fcd1f9f342b 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -66,9 +66,6 @@
 
 #define	barrier()			__asm__ __volatile__("": : :"memory")
 
-#define	lower_32_bits(n)		((u32)(n))
-#define	upper_32_bits(n)		((u32)(((n) >> 16) >> 16))
-
 #define	WRITE_ONCE(x,v) do {		\
 	barrier();			\
 	(*(volatile __typeof(x) *)(uintptr_t)&(x)) = (v); \
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 5e94a5cee28c..8caaf520fd3e 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -57,6 +57,7 @@
 #include <linux/kconfig.h>
 #include <linux/instruction_pointer.h>
 #include <linux/hex.h>
+#include <linux/wordpart.h>
 
 #include <asm/byteorder.h>
 #include <asm/cpufeature.h>
diff --git a/sys/compat/linuxkpi/common/include/linux/wordpart.h b/sys/compat/linuxkpi/common/include/linux/wordpart.h
new file mode 100644
index 000000000000..ce697bbef3b3
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/wordpart.h
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Jean-Sébastien Pédron
+ */
+
+#ifndef	_LINUXKPI_LINUX_WORDPART_H_
+#define	_LINUXKPI_LINUX_WORDPART_H_
+
+#define	lower_32_bits(n)		((u32)(n))
+#define	upper_32_bits(n)		((u32)(((n) >> 16) >> 16))
+
+#endif	/* _LINUXKPI_LINUX_WORDPART_H_ */