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,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v3 4/5] i3c: mipi-i3c-hci: use parity8 helper instead of open coding it
Date: Mon, 6 Jan 2025 13:06:53 +0000 [thread overview]
Message-ID: <20250106130653.7fe81eae@pumpkin> (raw)
In-Reply-To: <20250106092725.22869-5-wsa+renesas@sang-engineering.com>
On Mon, 6 Jan 2025 10:27:22 +0100
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.
This need to explain that although the algorithm has changed the existing
code is wrong.
David
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
> drivers/i3c/master/mipi-i3c-hci/dat_v1.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> index 47b9b4d4ed3f..85c4916972e4 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> @@ -40,15 +40,6 @@
> #define dat_w0_write(i, v) writel(v, hci->DAT_regs + (i) * 8)
> #define dat_w1_write(i, v) writel(v, hci->DAT_regs + (i) * 8 + 4)
>
> -static inline bool dynaddr_parity(unsigned int addr)
> -{
> - addr |= 1 << 7;
> - addr += addr >> 4;
> - addr += addr >> 2;
> - addr += addr >> 1;
> - return (addr & 1);
> -}
> -
> static int hci_dat_v1_init(struct i3c_hci *hci)
> {
> unsigned int dat_idx;
> @@ -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);
> dat_w0_write(dat_idx, dat_w0);
> }
>
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
WARNING: multiple messages have this Message-ID (diff)
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,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v3 4/5] i3c: mipi-i3c-hci: use parity8 helper instead of open coding it
Date: Mon, 6 Jan 2025 13:06:53 +0000 [thread overview]
Message-ID: <20250106130653.7fe81eae@pumpkin> (raw)
In-Reply-To: <20250106092725.22869-5-wsa+renesas@sang-engineering.com>
On Mon, 6 Jan 2025 10:27:22 +0100
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.
This need to explain that although the algorithm has changed the existing
code is wrong.
David
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
> drivers/i3c/master/mipi-i3c-hci/dat_v1.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> index 47b9b4d4ed3f..85c4916972e4 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
> @@ -40,15 +40,6 @@
> #define dat_w0_write(i, v) writel(v, hci->DAT_regs + (i) * 8)
> #define dat_w1_write(i, v) writel(v, hci->DAT_regs + (i) * 8 + 4)
>
> -static inline bool dynaddr_parity(unsigned int addr)
> -{
> - addr |= 1 << 7;
> - addr += addr >> 4;
> - addr += addr >> 2;
> - addr += addr >> 1;
> - return (addr & 1);
> -}
> -
> static int hci_dat_v1_init(struct i3c_hci *hci)
> {
> unsigned int dat_idx;
> @@ -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);
> dat_w0_write(dat_idx, dat_w0);
> }
>
next prev parent reply other threads:[~2025-01-10 11:19 UTC|newest]
Thread overview: 14+ 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 ` 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 ` Wolfram Sang
2025-01-06 9:27 ` [PATCH v3 2/5] hwmon: (spd5118) Use generic parity calculation Wolfram Sang
2025-01-06 9:27 ` 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 ` Wolfram Sang
2025-01-06 9:27 ` [PATCH v3 4/5] i3c: mipi-i3c-hci: " Wolfram Sang
2025-01-06 9:27 ` Wolfram Sang
2025-01-06 13:06 ` David Laight [this message]
2025-01-06 13:06 ` David Laight
2025-01-06 9:27 ` [PATCH v3 5/5] i3c: cdns: " Wolfram Sang
2025-01-06 9:27 ` 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=20250106130653.7fe81eae@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.