[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250102185109.0862cae6@dsl-u17-10>
Date: Thu, 2 Jan 2025 18:51:09 +0000
From: David Laight <david.laight.linux@...il.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-i3c@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, Rasmus Villemoes
<linux@...musvillemoes.dk>, Alexandre Belloni
<alexandre.belloni@...tlin.com>
Subject: Re: [PATCH RFT v2 4/5] i3c: mipi-i3c-hci: use get_parity8 helper
instead of open coding it
On Thu, 2 Jan 2025 10:01:48 +0100
Wolfram Sang <wsa+renesas@...g-engineering.com> wrote:
> > > @@ -123,7 +114,7 @@ static void hci_dat_v1_set_dynamic_addr(struct i3c_hci *hci,
> > > dat_w0 = dat_w0_read(dat_idx);
> > > dat_w0 &= ~(DAT_0_DYNAMIC_ADDRESS | DAT_0_DYNADDR_PARITY);
> > > dat_w0 |= FIELD_PREP(DAT_0_DYNAMIC_ADDRESS, address) |
> > > - (dynaddr_parity(address) ? DAT_0_DYNADDR_PARITY : 0);
> > > + (parity8(address) ? 0 : DAT_0_DYNADDR_PARITY);
> >
> > NAK - that isn't the same code at all.
>
> But the same algorithm? Please elaborate where you think the new code
> will fail compared to the old one. And frankly, are you aware of
> different parity calculations? Have you read the link which was in the
> kdocs of my new function?
>
The old code is:
> -static inline bool dynaddr_parity(unsigned int addr)
> -{
> - addr |= 1 << 7;
> - addr += addr >> 4;
> - addr += addr >> 2;
> - addr += addr >> 1;
> - return (addr & 1);
> -}
So:
1) it always sets 0x80.
2) it uses addition not exclusive or.
So just not the same definition of 'parity'.
David
Powered by blists - more mailing lists