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>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [PATCH v4 3/5] i3c: dw: use parity8 helper instead of open coding it
Date: Tue, 7 Jan 2025 10:02:01 +0100 [thread overview]
Message-ID: <20250107090204.6593-4-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20250107090204.6593-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/dw-i3c-master.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index d4b80eb8cecd..0d4d44458c11 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -251,14 +251,6 @@ struct dw_i3c_i2c_dev_data {
struct i3c_generic_ibi_pool *ibi_pool;
};
-static u8 even_parity(u8 p)
-{
- p ^= p >> 4;
- p &= 0xf;
-
- return (0x9669 >> p) & 1;
-}
-
static bool dw_i3c_master_supports_ccc_cmd(struct i3c_master_controller *m,
const struct i3c_ccc_cmd *cmd)
{
@@ -848,7 +840,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
struct dw_i3c_xfer *xfer;
struct dw_i3c_cmd *cmd;
u32 olddevs, newdevs;
- u8 p, last_addr = 0;
+ u8 last_addr = 0;
int ret, pos;
ret = pm_runtime_resume_and_get(master->dev);
@@ -873,9 +865,9 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
}
master->devs[pos].addr = ret;
- p = even_parity(ret);
last_addr = ret;
- ret |= (p << 7);
+
+ ret |= parity8(ret) ? 0 : BIT(7);
writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(ret),
master->regs +
--
2.45.2
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2025-01-07 9:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 9:01 [PATCH v4 0/5] i3c: introduce and use generic parity helper Wolfram Sang
2025-01-07 9:01 ` [PATCH v4 1/5] bitops: add generic parity calculation for u8 Wolfram Sang
2025-01-07 9:02 ` [PATCH v4 2/5] hwmon: (spd5118) Use generic parity calculation Wolfram Sang
2025-01-07 9:02 ` Wolfram Sang [this message]
2025-01-07 9:02 ` [PATCH v4 4/5] i3c: mipi-i3c-hci: use parity8 helper instead of open coding it Wolfram Sang
2025-01-08 12:09 ` Jarkko Nikula
2025-01-08 12:56 ` Wolfram Sang
2025-01-08 15:32 ` Jarkko Nikula
2025-01-07 9:02 ` [PATCH v4 5/5] i3c: cdns: " Wolfram Sang
2025-01-08 7:23 ` [PATCH v4 0/5] i3c: introduce and use generic parity helper Wolfram Sang
2025-01-12 23:05 ` Alexandre Belloni
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=20250107090204.6593-4-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 \
/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).