Skip to content

Commit 063a896

Browse files
visitorckwgregkh
authored andcommitted
serial: max3100: Replace open-coded parity calculation with parity8()
Refactor parity calculations to use the standard parity8() helper. This change eliminates redundant implementations. Co-developed-by: Yu-Chun Lin <[email protected]> Signed-off-by: Yu-Chun Lin <[email protected]> Signed-off-by: Kuan-Wei Chiu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 857eec4 commit 063a896

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/tty/serial/max3100.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/* 4 MAX3100s should be enough for everyone */
1717
#define MAX_MAX3100 4
1818

19+
#include <linux/bitops.h>
1920
#include <linux/container_of.h>
2021
#include <linux/delay.h>
2122
#include <linux/device.h>
@@ -133,7 +134,7 @@ static int max3100_do_parity(struct max3100_port *s, u16 c)
133134
else
134135
c &= 0xff;
135136

136-
parity = parity ^ (hweight8(c) & 1);
137+
parity = parity ^ parity8(c);
137138
return parity;
138139
}
139140

0 commit comments

Comments
 (0)