Blob Blame History Raw
From: Keith Busch <kbusch@kernel.org>
Date: Thu, 3 Mar 2022 12:13:08 -0800
Subject: linux/kernel: introduce lower_48_bits function
Patch-mainline: v5.18-rc1
Git-commit: 7ee8809df990d1de379002973baee1681e8d7dd3
References: jsc#PED-1183

Recent data integrity field enhancements allow reference tags to be up
to 48 bits. Introduce an inline helper function since this will be a
repeated operation.

Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220303201312.3255347-5-kbusch@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 include/linux/kernel.h |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -58,6 +58,15 @@
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
 
 /**
+ * lower_48_bits() - return bits 0-47 of a number
+ * @n: the number we're accessing
+ */
+static inline u64 lower_48_bits(u64 n)
+{
+	return n & ((1ull << 48) - 1);
+}
+
+/**
  * upper_32_bits - return bits 32-63 of a number
  * @n: the number we're accessing
  *