* [PATCH v5] serial: max3100: Replace open-coded parity calculation with parity8()
@ 2025-05-15 8:13 Kuan-Wei Chiu
0 siblings, 0 replies; only message in thread
From: Kuan-Wei Chiu @ 2025-05-15 8:13 UTC (permalink / raw)
To: gregkh, jirislaby
Cc: linux-kernel, linux-serial, jserv, Kuan-Wei Chiu, Yu-Chun Lin
Refactor parity calculations to use the standard parity8() helper.
This change eliminates redundant implementations.
Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com>
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
Changes in v5:
- Dropped changes to bitops.h
- Switched to using existing parity8()
- Split parity8() conversion patch out of the series
drivers/tty/serial/max3100.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index f2dd83692b2c..d28a2ebfa29f 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -16,6 +16,7 @@
/* 4 MAX3100s should be enough for everyone */
#define MAX_MAX3100 4
+#include <linux/bitops.h>
#include <linux/container_of.h>
#include <linux/delay.h>
#include <linux/device.h>
@@ -133,7 +134,7 @@ static int max3100_do_parity(struct max3100_port *s, u16 c)
else
c &= 0xff;
- parity = parity ^ (hweight8(c) & 1);
+ parity = parity ^ parity8(c);
return parity;
}
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-15 8:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15 8:13 [PATCH v5] serial: max3100: Replace open-coded parity calculation with parity8() Kuan-Wei Chiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox