Re: [PATCH v1 1/3] i2c: mux: gpio: Replace custom acpi_get_local_address()

From: Andy Shevchenko
Date: Thu Nov 18 2021 - 05:34:17 EST


+Cc: Rafael

On Thu, Nov 18, 2021 at 12:24 PM Peter Rosin <peda@xxxxxxxxxx> wrote:
> On 2021-11-15 16:41, Andy Shevchenko wrote:

...

> > - *adr = adr64;
> > - if (*adr != adr64) {
> > - dev_err(dev, "Address out of range\n");
> > - return -ERANGE;
> > - }
>
> In the conversion, I read it as if we lose this overflow check.

It depends from which angle you look at this. We relaxed requirements.

> Why is that
> not a problem?

The idea behind the acpi_get_local_address() is to provide a unified
way between DT and ACPI for the same value. In either case we take
only a 32-bit value. We might nevertheless add that check to the API.
Rafael, what do you think?

P.S. Just realized that in ACPI the higher part of the address may be
used as flags by some interfaces (SoundWire is one of them), this is
not applicable to I²C muxes right now, but who knows... So I prefer a
relaxed version and, if necessary, documentation should be
amended/updated.


--
With Best Regards,
Andy Shevchenko