summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2025-09-22 14:29:22 +0200
committerTom Rini <[email protected]>2025-10-03 16:55:18 -0600
commit70ae44f3713427be5368d0829b97cafbd01ef1f5 (patch)
tree0df0214263f95fd952d55f3243d196fd73f6451e /include/linux
parent8fd3768ca1683b45aeb5662094de6bcffdb7735b (diff)
linux/kernel.h: Update upper_NN_bits() and lower_NN_bits() macros
Synchronize upper_NN_bits() and lower_NN_bits() macros with Linux 6.16 commit 118d777c4cb4 ("wordpart.h: Add REPEAT_BYTE_U32()"). This fixes the lower_32_bits() macros and assures it works with 64bit systems correctly. This also adds 16bit variants of these macros, which will be used by the Airoha PHY driver. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kernel.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e0443ecac84..44a639a5e4e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -111,7 +111,19 @@
* lower_32_bits - return bits 0-31 of a number
* @n: the number we're accessing
*/
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
+
+/**
+ * upper_16_bits - return bits 16-31 of a number
+ * @n: the number we're accessing
+ */
+#define upper_16_bits(n) ((u16)((n) >> 16))
+
+/**
+ * lower_16_bits - return bits 0-15 of a number
+ * @n: the number we're accessing
+ */
+#define lower_16_bits(n) ((u16)((n) & 0xffff))
/*
* abs() handles unsigned and signed longs, ints, shorts and chars. For all