Re: [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr
From: Conor Dooley
Date: Wed Jul 22 2026 - 12:58:18 EST
On Wed, Jul 22, 2026 at 05:41:54PM +0100, Conor Dooley wrote:
> On Wed, Jul 22, 2026 at 09:54:17AM +0200, Janani Sunil wrote:
> > Read the generic spi-device-addr property when determining the hardware
> > device address. Fall back to the deprecated microchip,device-addr
> > property and then to the historical device-addr property to preserve
> > compatibility with existing devicetrees.
> >
> > The device address remains 0 when none of the properties are present.
> >
> > Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
> > ---
> > drivers/iio/adc/mcp3911.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> > index ddc3721f3f68..3919a326b4db 100644
> > --- a/drivers/iio/adc/mcp3911.c
> > +++ b/drivers/iio/adc/mcp3911.c
> > @@ -740,10 +740,13 @@ static int mcp3911_probe(struct spi_device *spi)
> > }
> >
> > /*
> > - * Fallback to "device-addr" due to historical mismatch between
> > - * dt-bindings and implementation.
> > + * Fall back to the vendor-specific property, then to "device-addr"
> > + * due to a historical mismatch between the binding and implementation.
>
> Jaysus, bit of a mess here.
> Reviewed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
>
> > */
> > - ret = device_property_read_u32(dev, "microchip,device-addr", &adc->dev_addr);
> > + ret = device_property_read_u32(dev, "spi-device-addr", &adc->dev_addr);
> > + if (ret)
> > + ret = device_property_read_u32(dev, "microchip,device-addr",
> > + &adc->dev_addr);
> > if (ret)
> > device_property_read_u32(dev, "device-addr", &adc->dev_addr);
Actually, this should check the return value, right?
> > if (adc->dev_addr > 3) {
> >
> > --
> > 2.43.0
> >
Attachment:
signature.asc
Description: PGP signature