[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdX_iojuf1+K=fWJaC2N9v+DkYEQHNpD8X5=2YG11aoAVA@mail.gmail.com>
Date: Thu, 13 Feb 2025 12:10:09 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Andi Shyti <andi.shyti@...nel.org>, Wolfram Sang <wsa+renesas@...g-engineering.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org,
Krzysztof Adamski <krzysztof.adamski@...ia.com>,
Florian Fainelli <florian.fainelli@...adcom.com>, Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>, Stefan Roese <sr@...x.de>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Gregory CLEMENT <gregory.clement@...tlin.com>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>
Subject: Re: [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg()
Hi Andy,
On Wed, 12 Feb 2025 at 20:04, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> On Wed, Feb 12, 2025 at 07:36:46PM +0100, Geert Uytterhoeven wrote:
> > On Wed, 12 Feb 2025 at 17:35, Andy Shevchenko
> > <andriy.shevchenko@...ux.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.
>
> ...
>
> > > +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.
>
> Since you are giving a constructive feedback, please, propose the name.
i2c_10bit_addr_hi_from_msg()?
> > > +{
> > > + /*
> > > + * 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.
>
> I think the comment is okay to stay. It explains the full picture which is
> helpful. It may be extended to say that the function returns only addr_1.
Or it could be moved outside this function, i.e. at the start of the
section listing all 10-bit address helpers?
>
> > > + */
> > > + 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?
>
> Wouldn't it be too much?
I (my OCD ;-) love symmetry...
i2c_10bit_addr_lo_from_msg()?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-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
Powered by blists - more mailing lists