mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	 linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	 linux-renesas-soc@vger.kernel.org,
	 Krzysztof Adamski <krzysztof.adamski@nokia.com>,
	 Florian Fainelli <florian.fainelli@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	 Scott Branden <sbranden@broadcom.com>,
	 Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Stefan Roese <sr@denx.de>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Gregory CLEMENT <gregory.clement@bootlin.com>,
	 Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Subject: Re: [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg()
Date: Wed, 12 Feb 2025 19:36:46 +0100	[thread overview]
Message-ID: <CAMuHMdW1wxQ0cddeE72D+Sii4HkT4bJfeTWX4-8FfHiFr+=3DA@mail.gmail.com> (raw)
In-Reply-To: <20250212163359.2407327-2-andriy.shevchenko@linux.intel.com>

Hi Andy,

On Wed, 12 Feb 2025 at 17:35, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> There are already a lot of drivers that have been using
> i2c_8bit_addr_from_msg() for 7-bit addresses, now it's time
> to have the similar for 10-bit addresses.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks for your patch!

> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -952,6 +952,16 @@ static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
>         return (msg->addr << 1) | (msg->flags & I2C_M_RD);
>  }
>
> +static inline u8 i2c_10bit_addr_from_msg(const struct i2c_msg *msg)

Having never used 10-bit addressing myself, or even looked into it,
it took me a while to understand what this helper really does...
So this returns the high byte of the artificial 16-bit address that
must be used to address a target that uses 10-bit addressing?
Hence I think this should be renamed, to better match its purpose.

> +{
> +       /*
> +        * 10-bit address
> +        *   addr_1: 5'b11110 | addr[9:8] | (R/nW)
> +        *   addr_2: addr[7:0]

I think the second comment line does not belong here, as this function
doesn't care about that part.

> +        */
> +       return 0xf0 | ((msg->addr & GENMASK(9, 8)) >> 7) | (msg->flags & I2C_M_RD);
> +}

Probably you also want to add a similar but much simpler helper to
return the low byte?

> +
>  u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
>  void i2c_put_dma_safe_msg_buf(u8 *buf, struct i2c_msg *msg, bool xferred);
>

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2025-02-12 18:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 16:32 [PATCH v1 0/8] i2c: busses: Introduce and use i2c_10bit_addr_from_msg() Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg() Andy Shevchenko
2025-02-12 17:06   ` Fabrizio Castro
2025-02-12 18:36   ` Geert Uytterhoeven [this message]
2025-02-12 19:04     ` Andy Shevchenko
2025-02-13 10:02       ` Wolfram Sang
2025-02-13 10:54         ` Andy Shevchenko
2025-02-13 13:04         ` Andy Shevchenko
2025-02-13 11:10       ` Geert Uytterhoeven
2025-02-13 22:41     ` Andi Shyti
2025-02-14  8:04       ` Geert Uytterhoeven
2025-02-14 13:55         ` Andy Shevchenko
2025-02-13 22:40   ` Andi Shyti
2025-02-12 16:32 ` [PATCH v1 2/8] i2c: axxia: Use i2c_10bit_addr_from_msg() helper Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 3/8] i2c: bcm-kona: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 4/8] i2c: eg20t: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 5/8] i2c: kempld: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 6/8] i2c: mt7621: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 7/8] i2c: mv64xxx: Use i2c_*bit_addr_from_msg() helpers Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 8/8] i2c: rzv2m: Use i2c_10bit_addr_from_msg() helper Andy Shevchenko
2025-02-12 17:08   ` Fabrizio Castro

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='CAMuHMdW1wxQ0cddeE72D+Sii4HkT4bJfeTWX4-8FfHiFr+=3DA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregory.clement@bootlin.com \
    --cc=krzysztof.adamski@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=sr@denx.de \
    --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

all inboxes | Powered by JetHome®