From: <Marius.Cristea@microchip.com>
To: <conor@kernel.org>, <janani.sunil@analog.com>
Cc: <corbet@lwn.net>, <linux-doc@vger.kernel.org>, <robh@kernel.org>,
<andy@kernel.org>, <nedo80@gmail.com>, <kent@minoris.se>,
<Michael.Hennerich@analog.com>, <jan.sun97@gmail.com>,
<lars@metafoo.de>, <conor+dt@kernel.org>,
<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>, <skhan@linuxfoundation.org>,
<dlechner@baylibre.com>, <nuno.sa@analog.com>,
<p.zabel@pengutronix.de>, <jic23@kernel.org>,
<marcus.folkesson@gmail.com>, <krzk+dt@kernel.org>,
<linux-iio@vger.kernel.org>, <broonie@kernel.org>
Subject: Re: [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr
Date: Wed, 22 Jul 2026 17:18:03 +0000 [thread overview]
Message-ID: <4a20b00011ede38be75ae63db2cf9cf29dedf75e.camel@microchip.com> (raw)
In-Reply-To: <20260722-vintage-handwork-eaaa304ed0b4@spud>
On Wed, 2026-07-22 at 17:43 +0100, Conor Dooley wrote:
> 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@analog.com>
> > > ---
> > > 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@microchip.com>
> >
> > > */
> > > - 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?
Default hardware address is 0x00, unless a special order with custom
hardware address is made. I think is safe to try to communicate with
the default HW address, regardless of the return value.
>
> > > if (adc->dev_addr > 3) {
> > >
> > > --
> > > 2.43.0
> > >
>
next prev parent reply other threads:[~2026-07-22 17:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 7:54 [PATCH v7 0/7] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-22 7:54 ` [PATCH v7 1/7] spi: dt-bindings: Add spi-device-addr peripheral property Janani Sunil
2026-07-22 16:39 ` Conor Dooley
2026-07-22 7:54 ` [PATCH v7 2/7] dt-bindings: iio: adc: microchip,mcp3564: Add spi-device-addr Janani Sunil
2026-07-22 16:40 ` Conor Dooley
2026-07-22 7:54 ` [PATCH v7 3/7] iio: adc: mcp3564: Add support for spi-device-addr Janani Sunil
2026-07-22 16:45 ` Conor Dooley
2026-07-22 17:02 ` Marius.Cristea
2026-07-22 17:12 ` Conor Dooley
2026-07-22 17:06 ` Marius.Cristea
2026-07-22 7:54 ` [PATCH v7 4/7] dt-bindings: iio: adc: microchip,mcp3911: Add spi-device-addr Janani Sunil
2026-07-22 16:41 ` Conor Dooley
2026-07-22 7:54 ` [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr Janani Sunil
2026-07-22 16:41 ` Conor Dooley
2026-07-22 16:43 ` Conor Dooley
2026-07-22 17:18 ` Marius.Cristea [this message]
2026-07-22 17:19 ` Marius.Cristea
2026-07-22 7:54 ` [PATCH v7 6/7] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-22 16:39 ` Conor Dooley
2026-07-22 7:54 ` [PATCH v7 7/7] iio: dac: Add AD5529R DAC driver support Janani Sunil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a20b00011ede38be75ae63db2cf9cf29dedf75e.camel@microchip.com \
--to=marius.cristea@microchip.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jan.sun97@gmail.com \
--cc=janani.sunil@analog.com \
--cc=jic23@kernel.org \
--cc=kent@minoris.se \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=nedo80@gmail.com \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox