Re: [PATCH v7 3/7] iio: adc: mcp3564: Add support for spi-device-addr
Conor Dooley <[email protected]> Wed, 22 Jul 2026 18:12:31 +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-trickery-unglazed-f51a23dc3842@spud> |
On Wed, Jul 22, 2026 at 05:02:28PM +0000, [email protected] wrote: > On Wed, 2026-07-22 at 17:45 +0100, Conor Dooley wrote: > > On Wed, Jul 22, 2026 at 09:54:15AM +0200, Janani Sunil wrote: > > > Read the generic spi-device-addr property when determining the > > > hardware > > > device address. Fall back to the deprecated microchip,hw-device- > > > address > > > property to preserve compatibility with existing device trees. > > > > > > The device address remains 1 when neither property is present. > > > > > > Signed-off-by: Janani Sunil <[email protected]> > > > --- > > > drivers/iio/adc/mcp3564.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c > > > index 36675563829e..71deb05e878e 100644 > > > --- a/drivers/iio/adc/mcp3564.c > > > +++ b/drivers/iio/adc/mcp3564.c > > > @@ -1122,7 +1122,9 @@ static int mcp3564_config(struct iio_dev > > > *indio_dev, bool *use_internal_vref_att > > > * addresses are available when multiple devices are > > > present on the same > > > * SPI bus with only one Chip Select line for all devices. > > > */ > > > - device_property_read_u32(dev, "microchip,hw-device- > > > address", &tmp); > > > + ret = device_property_read_u32(dev, "spi-device-addr", > > > &tmp); > > > + if (ret) > > > + device_property_read_u32(dev, "microchip,hw- > > > device-address", &tmp); > > > > Same on this one, shouldn't it check the return value so that the > > below > > check of temp > 3 doesn't just pass with the default value of tmp? > > > > Default hardware address is 0x01, unless a special order with custom > hardware address is made. I think is safe to try to communicate with > the default HW address. Ah, sounds good so. Reviewed-by: Conor Dooley <[email protected]>
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCamD5/wAKCRB4tDGHoIJi 0vzqAP4mqLpKsej/7q1V53o44jxEt6lJSZRQlb13CZQK729KJgEAzPUI+HXMAdL1 VrktYU8w5nNZDFJsfRDeT5vtANt79Qk= =DSAg -----END PGP SIGNATURE-----