git: bb025df25738 - main - LinuxKPI: add FIELD_PREP_CONST()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 May 2024 23:28:02 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=bb025df257386c5d1087b652e8ed951bceb89862
commit bb025df257386c5d1087b652e8ed951bceb89862
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-05-13 17:40:26 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-05-21 23:27:10 +0000
LinuxKPI: add FIELD_PREP_CONST()
Add FIELD_PREP_CONST() like FIELD_PREP() without any extra checks likely
expected on this version in Linux. This is called by an updated wireless
driver.
Sposnored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45180
---
sys/compat/linuxkpi/common/include/linux/bitfield.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/bitfield.h b/sys/compat/linuxkpi/common/include/linux/bitfield.h
index a2020d247489..8a91b0663f37 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitfield.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitfield.h
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2020 The FreeBSD Foundation
+ * Copyright (c) 2020-2024 The FreeBSD Foundation
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -131,6 +131,10 @@ _uX_replace_bits(8)
#define FIELD_PREP(_mask, _value) \
(((typeof(_mask))(_value) << __bf_shf(_mask)) & (_mask))
+/* Likely would need extra sanity checks compared to FIELD_PREP()? */
+#define FIELD_PREP_CONST(_mask, _value) \
+ (((typeof(_mask))(_value) << __bf_shf(_mask)) & (_mask))
+
#define FIELD_GET(_mask, _value) \
((typeof(_mask))(((_value) & (_mask)) >> __bf_shf(_mask)))