Re: [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr
Conor Dooley <[email protected]> Wed, 22 Jul 2026 17:41:54 +0100
| Newsgroups | org.kernel.vger.linux-spi,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-doc,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260722-quickly-drone-6a2a3b79249d@spud> |
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 <[email protected]> > --- > 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 <[email protected]> > */ > - 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); > if (adc->dev_addr > 3) { > > -- > 2.43.0 >
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCamDy0gAKCRB4tDGHoIJi 0gcIAP9p7QLrvHULCTbp+m0KiZDoToCng0aN92F3tZx/h7w8GgD8DixzPtqRL0vZ Irm6CNsO+BVkqtgN/ejURNmrQhnorA0= =AKHs -----END PGP SIGNATURE-----