Re: [PATCH v4 04/13] media: saa7115: Replace open-coded parity calculation with parity_odd()

Hans Verkuil <[email protected]>
Newsgroups dev.linux.lists.brcm80211,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-i3c,org.infradead.lists.linux-mtd,org.kernel.vger.bpf,org.kernel.vger.linux-hwmon,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 09/04/2025 17:43, Kuan-Wei Chiu wrote:
> Refactor parity calculations to use the standard parity_odd() 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]>

Reviewed-by: Hans Verkuil <[email protected]>

Regards,

	Hans

> ---
>  drivers/media/i2c/saa7115.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
> index a1c71187e773..a7886269dcfc 100644
> --- a/drivers/media/i2c/saa7115.c
> +++ b/drivers/media/i2c/saa7115.c
> @@ -25,6 +25,7 @@
>  
>  #include "saa711x_regs.h"
>  
> +#include <linux/bitops.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> @@ -664,15 +665,6 @@ static const unsigned char saa7115_init_misc[] = {
>  	0x00, 0x00
>  };
>  
> -static int saa711x_odd_parity(u8 c)
> -{
> -	c ^= (c >> 4);
> -	c ^= (c >> 2);
> -	c ^= (c >> 1);
> -
> -	return c & 1;
> -}
> -
>  static int saa711x_decode_vps(u8 *dst, u8 *p)
>  {
>  	static const u8 biphase_tbl[] = {
> @@ -1227,7 +1219,7 @@ static int saa711x_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vb
>  		vbi->type = V4L2_SLICED_TELETEXT_B;
>  		break;
>  	case 4:
> -		if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1]))
> +		if (!parity_odd(p[0]) || !parity_odd(p[1]))
>  			return 0;
>  		vbi->type = V4L2_SLICED_CAPTION_525;
>  		break;
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.