[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250306162541.2633025-2-visitorckw@gmail.com>
Date: Fri, 7 Mar 2025 00:25:26 +0800
From: Kuan-Wei Chiu <visitorckw@...il.com>
To: tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
x86@...nel.org,
jk@...abs.org,
joel@....id.au,
eajames@...ux.ibm.com,
andrzej.hajda@...el.com,
neil.armstrong@...aro.org,
rfoss@...nel.org,
maarten.lankhorst@...ux.intel.com,
mripard@...nel.org,
tzimmermann@...e.de,
airlied@...il.com,
simona@...ll.ch,
dmitry.torokhov@...il.com,
mchehab@...nel.org,
awalls@...metrocast.net,
hverkuil@...all.nl,
miquel.raynal@...tlin.com,
richard@....at,
vigneshr@...com,
louis.peens@...igine.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
pabeni@...hat.com,
parthiban.veerasooran@...rochip.com,
arend.vanspriel@...adcom.com,
johannes@...solutions.net,
gregkh@...uxfoundation.org,
jirislaby@...nel.org,
yury.norov@...il.com,
akpm@...ux-foundation.org
Cc: hpa@...or.com,
alistair@...ple.id.au,
linux@...musvillemoes.dk,
Laurent.pinchart@...asonboard.com,
jonas@...boo.se,
jernej.skrabec@...il.com,
kuba@...nel.org,
linux-kernel@...r.kernel.org,
linux-fsi@...ts.ozlabs.org,
dri-devel@...ts.freedesktop.org,
linux-input@...r.kernel.org,
linux-media@...r.kernel.org,
linux-mtd@...ts.infradead.org,
oss-drivers@...igine.com,
netdev@...r.kernel.org,
linux-wireless@...r.kernel.org,
brcm80211@...ts.linux.dev,
brcm80211-dev-list.pdl@...adcom.com,
linux-serial@...r.kernel.org,
bpf@...r.kernel.org,
jserv@...s.ncku.edu.tw,
Kuan-Wei Chiu <visitorckw@...il.com>,
Yu-Chun Lin <eleanor15x@...il.com>
Subject: [PATCH v3 01/16] bitops: Change parity8() return type to bool
Change return type to bool for better clarity. Update the kernel doc
comment accordingly, including fixing "@value" to "@val" and adjusting
examples. Also mark the function with __attribute_const__ to allow
potential compiler optimizations.
Co-developed-by: Yu-Chun Lin <eleanor15x@...il.com>
Signed-off-by: Yu-Chun Lin <eleanor15x@...il.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@...il.com>
---
include/linux/bitops.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index c1cb53cf2f0f..44e5765b8bec 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -231,26 +231,26 @@ static inline int get_count_order_long(unsigned long l)
/**
* parity8 - get the parity of an u8 value
- * @value: the value to be examined
+ * @val: the value to be examined
*
* Determine the parity of the u8 argument.
*
* Returns:
- * 0 for even parity, 1 for odd parity
+ * false for even parity, true for odd parity
*
* Note: This function informs you about the current parity. Example to bail
* out when parity is odd:
*
- * if (parity8(val) == 1)
+ * if (parity8(val) == true)
* return -EBADMSG;
*
* If you need to calculate a parity bit, you need to draw the conclusion from
* this result yourself. Example to enforce odd parity, parity bit is bit 7:
*
- * if (parity8(val) == 0)
+ * if (parity8(val) == false)
* val ^= BIT(7);
*/
-static inline int parity8(u8 val)
+static inline __attribute_const__ bool parity8(u8 val)
{
/*
* One explanation of this algorithm:
--
2.34.1
Powered by blists - more mailing lists