From 47e1ca7f3720c76fdc729e03034fa53c798b9318 Mon Sep 17 00:00:00 2001 From: Jean-Sébastien Pédron Date: Wed, 22 Apr 2026 18:21:40 +0200 Subject: linuxkpi: Move `GENMASK()` to ... from . This matches the location on Linux. is also included from . Therefore it will not break anything. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56584 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 4 ++-- sys/compat/linuxkpi/common/include/linux/bits.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 sys/compat/linuxkpi/common/include/linux/bits.h (limited to 'sys/compat/linuxkpi/common/include/linux') diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 125081ab5b74..0244c7d6f476 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -35,6 +35,8 @@ #include #include +#include + #define BIT(nr) (1UL << (nr)) #define BIT_ULL(nr) (1ULL << (nr)) #define BITS_PER_LONG (__SIZEOF_LONG__ * __CHAR_BIT__) @@ -45,8 +47,6 @@ #define BITS_TO_LONGS(n) howmany((n), BITS_PER_LONG) #define BIT_MASK(nr) (1UL << ((nr) & (BITS_PER_LONG - 1))) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) -#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l))) #define BITS_PER_BYTE 8 #define BITS_PER_TYPE(t) (sizeof(t) * BITS_PER_BYTE) #define BITS_TO_BYTES(n) howmany((n), BITS_PER_BYTE) diff --git a/sys/compat/linuxkpi/common/include/linux/bits.h b/sys/compat/linuxkpi/common/include/linux/bits.h new file mode 100644 index 000000000000..53deb7cbbe88 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/bits.h @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2016 Kip Macy + * Copyright (c) 2018 Johannes Lundberg + */ + +#ifndef _LINUXKPI_LINUX_BITS_H_ +#define _LINUXKPI_LINUX_BITS_H_ + +#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) +#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l))) + +#endif /* _LINUXKPI_LINUX_BITS_H_ */ -- cgit v1.3