From: David Laight <david.laight.linux@gmail.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>,
Andi Shyti <andi.shyti@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH v3 4/8] i2c: riic: Use GENMASK() macro for bitmask definitions
Date: Wed, 1 Jan 2025 12:11:22 +0000 [thread overview]
Message-ID: <20250101121122.3c3a8e0a@dsl-u17-10> (raw)
In-Reply-To: <20241227115154.56154-5-prabhakar.mahadev-lad.rj@bp.renesas.com>
On Fri, 27 Dec 2024 11:51:50 +0000
Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Replace raw bitmask values with the `GENMASK()` macro in the `i2c-riic`
> driver to improve readability and maintain consistency.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
> v2->v3
> - Collected RB and tested tags
>
> v1->v2
> - Collected RB tag from Geert
> ---
> drivers/i2c/busses/i2c-riic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
> index 954e066d61a8..ddae4b74a86b 100644
> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -55,7 +55,7 @@
> #define ICCR2_RS BIT(2)
> #define ICCR2_ST BIT(1)
>
> -#define ICMR1_CKS_MASK 0x70
> +#define ICMR1_CKS_MASK GENMASK(6, 4)
> #define ICMR1_BCWP BIT(3)
> #define ICMR1_CKS(_x) ((((_x) << 4) & ICMR1_CKS_MASK) | ICMR1_BCWP)
I'm really not at all sure how this makes it 'more readable'.
Call me 'old fashioned' but I like hex constants - especially for bytes.
In this case it might be best to be consistent with the hardware datasheet.
Pretty much the only time I've actually used anything like BIT() was
for a spec that numbered the bits from 1 to 32 with bit 1 being the most
significant.
>
> @@ -73,7 +73,7 @@
>
> #define ICSR2_NACKF BIT(4)
>
> -#define ICBR_RESERVED 0xe0 /* Should be 1 on writes */
> +#define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */
'Should all be set on writes' ?
David
>
> #define RIIC_INIT_MSG -1
>
next prev parent reply other threads:[~2025-01-01 12:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-27 11:51 [PATCH v3 0/8] i2c: riic: driver cleanup and improvements Prabhakar
2024-12-27 11:51 ` [PATCH v3 1/8] i2c: riic: Use dev_err_probe in probe and riic_init_hw functions Prabhakar
2024-12-28 23:32 ` Andy Shevchenko
2024-12-31 14:20 ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 2/8] i2c: riic: Use local `dev` pointer in `dev_err_probe()` Prabhakar
2024-12-27 11:51 ` [PATCH v3 3/8] i2c: riic: Use BIT macro consistently Prabhakar
2024-12-28 23:34 ` Andy Shevchenko
2025-01-02 9:07 ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 4/8] i2c: riic: Use GENMASK() macro for bitmask definitions Prabhakar
2024-12-28 23:36 ` Andy Shevchenko
2025-01-02 9:09 ` Lad, Prabhakar
2025-01-01 12:11 ` David Laight [this message]
2025-01-02 8:53 ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 5/8] i2c: riic: Make use of devres helper to request deasserted reset line Prabhakar
2024-12-27 11:51 ` [PATCH v3 6/8] i2c: riic: Mark riic_irqs array as const Prabhakar
2024-12-27 11:51 ` [PATCH v3 7/8] i2c: riic: Use predefined macro and simplify clock tick calculation Prabhakar
2024-12-28 23:37 ` Andy Shevchenko
2025-01-02 10:05 ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 8/8] i2c: riic: Add `riic_bus_barrier()` to check bus availability Prabhakar
2024-12-28 23:40 ` Andy Shevchenko
2025-01-02 10:32 ` Lad, Prabhakar
2024-12-27 22:10 ` [PATCH v3 0/8] i2c: riic: driver cleanup and improvements Andi Shyti
2024-12-28 23:40 ` Andy Shevchenko
2024-12-29 23:42 ` Andi Shyti
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=20250101121122.3c3a8e0a@dsl-u17-10 \
--to=david.laight.linux@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=biju.das.jz@bp.renesas.com \
--cc=chris.brandt@renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--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.