Skip to content

Commit 7ee8809

Browse files
keithbuschaxboe
authored andcommitted
linux/kernel: introduce lower_48_bits function
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 <[email protected]> Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent c2ea5fc commit 7ee8809

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/linux/kernel.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@
6363
} \
6464
)
6565

66+
/**
67+
* lower_48_bits() - return bits 0-47 of a number
68+
* @n: the number we're accessing
69+
*/
70+
static inline u64 lower_48_bits(u64 n)
71+
{
72+
return n & ((1ull << 48) - 1);
73+
}
74+
6675
/**
6776
* upper_32_bits - return bits 32-63 of a number
6877
* @n: the number we're accessing

0 commit comments

Comments
 (0)