public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH RFT v2 4/5] i3c: mipi-i3c-hci: use get_parity8 helper instead of open coding it
Date: Fri, 3 Jan 2025 13:49:35 +0000	[thread overview]
Message-ID: <20250103134935.2a341ce0@pumpkin> (raw)
In-Reply-To: <Z3e1tuAR5GsEhYLz@shikoro>

On Fri, 3 Jan 2025 11:02:30 +0100
Wolfram Sang <wsa+renesas@sang-engineering.com> wrote:

> > > > > -		  (dynaddr_parity(address) ? DAT_0_DYNADDR_PARITY : 0);
> > > > > +		  (parity8(address) ? 0 : DAT_0_DYNADDR_PARITY);    
> 
> ...
> 
> > 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.  
> 
> Right, this is why the arguments of the ternary operator above are
> exchanged. The old function was basically 'is_odd'.

Provided the high bit isn't already set - which it may not be.

> > 2) it uses addition not exclusive or.  
> 
> True, but it will work nonetheless because we are only interested in bit
> 0 of the result. For one bit, XOR and addition are interchangable. The
> overflow to other bits is not important.

add: 00010001 => xxxx0010 => xx10 => x1
xor: 00010001 => xxxx0000 => 00xx => x0

> 
> > So just not the same definition of 'parity'.  
> 
> I think it is. I mean, I3C wants odd parity, otherwise it will not work.
> And Jarkko kindly confirmed it still works.

I bet the target isn't checking...

So you might be fixing a bug.

	David



  reply	other threads:[~2025-01-03 13:49 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 [this message]
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
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=20250103134935.2a341ce0@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --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