linux-i3c.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-i3c@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Przemysław Gaj" <pgaj@cadence.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: [PATCH v3 5/5] i3c: cdns: use parity8 helper instead of open coding it
Date: Mon,  6 Jan 2025 10:27:23 +0100	[thread overview]
Message-ID: <20250106092725.22869-6-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20250106092725.22869-1-wsa+renesas@sang-engineering.com>

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>
---
 drivers/i3c/master/i3c-master-cdns.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index 06c0592487d3..fedbe6624a1c 100644
--- 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);
 
 	return ret;
 }
-- 
2.45.2


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

      parent reply	other threads:[~2025-01-06  9:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06  9:27 [PATCH v3 0/5] i3c: introduce and use generic parity helper Wolfram Sang
2025-01-06  9:27 ` [PATCH v3 1/5] bitops: add generic parity calculation for u8 Wolfram Sang
2025-01-06  9:27 ` [PATCH v3 2/5] hwmon: (spd5118) Use generic parity calculation Wolfram Sang
2025-01-06  9:27 ` [PATCH v3 3/5] i3c: dw: use parity8 helper instead of open coding it Wolfram Sang
2025-01-06  9:27 ` [PATCH v3 4/5] i3c: mipi-i3c-hci: " Wolfram Sang
2025-01-06 13:06   ` David Laight
2025-01-06  9:27 ` Wolfram Sang [this message]

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=20250106092725.22869-6-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.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=pgaj@cadence.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;
as well as URLs for NNTP newsgroup(s).