[PATCH] bitfield: suggest using bitwise OR when combining bitfields

From: Peter Rosin
Date: Tue May 23 2023 - 08:16:52 EST


Logical OR fails to deliver the desired result. Most of the time.

Fixes: 3e9b3112ec74 ("add basic register-field manipulation macros")
Fixes: e2192de59e45 ("bitfield: add FIELD_PREP_CONST()")
Signed-off-by: Peter Rosin <peda@xxxxxxxxxx>
---
include/linux/bitfield.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index ebfa12f69501..d70fc96585e2 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -107,7 +107,7 @@
* @_val: value to put in the field
*
* FIELD_PREP() masks and shifts up the value. The result should
- * be combined with other fields of the bitfield using logical OR.
+ * be combined with other fields of the bitfield using bitwise OR.
*/
#define FIELD_PREP(_mask, _val) \
({ \
@@ -123,7 +123,7 @@
* @_val: value to put in the field
*
* FIELD_PREP_CONST() masks and shifts up the value. The result should
- * be combined with other fields of the bitfield using logical OR.
+ * be combined with other fields of the bitfield using bitwise OR.
*
* Unlike FIELD_PREP() this is a constant expression and can therefore
* be used in initializers. Error checking is less comfortable for this
--
2.20.1