Date: Wed, 22 Apr 2026 20:47:29 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 47e1ca7f3720 - main - linuxkpi: Move `GENMASK()` to <linux/bits.h> Message-ID: <69e933e1.23df0.2e69ad5@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=47e1ca7f3720c76fdc729e03034fa53c798b9318 commit 47e1ca7f3720c76fdc729e03034fa53c798b9318 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-22 16:21:40 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-22 20:46:58 +0000 linuxkpi: Move `GENMASK()` to <linux/bits.h> ... from <linux/bitops.h>. This matches the location on Linux. <linux/bits.h> is also included from <linux/bitops.h>. 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(-) 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 <sys/errno.h> #include <sys/libkern.h> +#include <linux/bits.h> + #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_ */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e933e1.23df0.2e69ad5>
