public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Przemysław Gaj" <pgaj@cadence.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH RFT v2 5/5] i3c: cdns: use get_parity8 helper instead of open coding it
Date: Sun, 29 Dec 2024 11:33:11 +0000	[thread overview]
Message-ID: <20241229113311.3b8f70d6@dsl-u17-10> (raw)
In-Reply-To: <CAMuHMdWSQvyLwHyci+WVtTj4rGeR-hkjw1ap52=5X29ZzVchSA@mail.gmail.com>

On Sun, 29 Dec 2024 11:49:55 +0100
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Hi Wolfram,
> 
> On Sun, Dec 29, 2024 at 11:13 AM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > The kernel has now a generic helper for getting parity with easier to
> > understand semantics. Make use of it.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>  
> 
> Thanks for your patch!
> 
> > --- a/drivers/i3c/master/i3c-master-cdns.c
> > +++ b/drivers/i3c/master/i3c-master-cdns.c
> > @@ -889,8 +889,7 @@ static u32 prepare_rr0_dev_address(u32 addr)
> >         ret |= (addr & GENMASK(9, 7)) << 6;
> >
> >         /* RR0[0] = ~XOR(addr[6:0]) */
> > -       if (!(hweight8(addr & 0x7f) & 1))
> > -               ret |= 1;
> > +       ret |= parity8(addr & 0x7f) ? 0 : BIT(0);  
> 
> Perhaps keep the if()-construct, to better match the example in the
> documentation in 1/5?

That line is hard to read, with parity8() returning 1 for 'odd' it could be:
	ret |= parity8(addr & 0x7f) ^ 1;
But:
	if (!parity8(addr & 0x7f))
		ret |= 1;
is probably easier to read.
But I'd change the name to parity8_odd() for clarity.
(or _even and return 0x80 for even)

	David

> 
> >
> >         return ret;
> >  }  
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2025-01-10 11:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-29 10:12 [PATCH RFT v2 0/5] i3c: introduce and use generic parity helper Wolfram Sang
2024-12-29 10:12 ` [PATCH RFT v2 1/5] bitops: add generic parity calculation for u8 Wolfram Sang
2024-12-29 11:11   ` David Laight
2025-01-02  8:55     ` Wolfram Sang
2024-12-29 10:12 ` [PATCH RFT v2 2/5] hwmon: (spd5118) Use generic parity calculation Wolfram Sang
2024-12-29 10:12 ` [PATCH RFT v2 3/5] i3c: dw: use get_parity8 helper instead of open coding it Wolfram Sang
2024-12-29 10:12 ` [PATCH RFT v2 4/5] i3c: mipi-i3c-hci: " Wolfram Sang
2025-01-01 12:14   ` David Laight
2025-01-02  9:01     ` Wolfram Sang
2025-01-02 18:51       ` David Laight
2025-01-03 10:02         ` Wolfram Sang
2025-01-03 13:49           ` David Laight
2025-01-03 21:17             ` Wolfram Sang
2025-01-02 14:19   ` Jarkko Nikula
2025-01-02 14:46     ` Wolfram Sang
2024-12-29 10:12 ` [PATCH RFT v2 5/5] i3c: cdns: " Wolfram Sang
2024-12-29 10:49   ` Geert Uytterhoeven
2024-12-29 11:33     ` David Laight [this message]
2025-01-02  9:04     ` Wolfram Sang
2025-01-02  9:28       ` Geert Uytterhoeven
2025-01-02  9:34         ` Wolfram Sang
2025-01-03 22:08           ` Alexandre Belloni
2025-01-03 22:11 ` [PATCH RFT v2 0/5] i3c: introduce and use generic parity helper Alexandre Belloni
2025-01-03 22:16   ` Wolfram Sang
2025-01-05  3:38     ` Yury Norov
2025-01-05  9:35       ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241229113311.3b8f70d6@dsl-u17-10 \
    --to=david.laight.linux@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pgaj@cadence.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox