Re: [PATCH 07/17] serial: max3100: Replace open-coded parity calculation with parity8()

Jiri Slaby <[email protected]>
Newsgroups dev.linux.lists.brcm80211,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-mtd,org.kernel.vger.bpf,org.kernel.vger.linux-input,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media,org.kernel.vger.linux-serial,org.kernel.vger.linux-wireless,org.kernel.vger.netdev
Message-ID <[email protected]>
On 23. 02. 25, 17:42, Kuan-Wei Chiu wrote:
> --- 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;

So all this should be simply:
return parity ^ parity8(c);

>   }
>   

thanks,
-- 
js
suse labs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.