All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Rodrigo Alencar" <455.rodrigo.alencar@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux@analog.com, devicetree@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-doc@vger.kernel.org,
	"Jonathan Cameron" <jonathan.cameron@oss.qualcomm.com>,
	"Olivier Moysan" <olivier.moysan@foss.st.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>
Subject: Re: [PATCH 02/10] iio: backend: add devm_iio_backend_get_optional()
Date: Fri, 16 Oct 2026 15:07:02 +0100	[thread overview]
Message-ID: <atIt3eXNeTT7cqxH@nsa> (raw)
In-Reply-To: <atIkZa0noHjcl13X@ashevche-desk.local>

On Fri, Oct 16, 2026 at 04:19:33PM +0300, Andy Shevchenko wrote:
> On Fri, Oct 16, 2026 at 08:18:08AM -0300, Rodrigo Alencar wrote:
> > On 16/10/26 09:45, Nuno Sá wrote:
> > > On Thu, Oct 15, 2026 at 09:41:40PM +0300, Andy Shevchenko wrote:
> > > > On Thu, Oct 15, 2026 at 01:49:42PM -0300, Rodrigo Alencar via B4 Relay wrote:
> > > > 
> > > > > Frontend devices might not need a backend driver to rely on. An IIO device
> > > > > that supports backends can behave differently when they are not available
> > > > > and that should be acceptable. Such parts may provide basic functionality
> > > > > solely using the control interface (SPI for instance), being able to have
> > > > > extended features when a backend is present.
> > > > > 
> > > > > Add devm_iio_backend_get_optional(), which returns NULL when the backend
> > > > > is not described in firmware, i.e., when the io-backends property is not
> > > > > present or, for a named lookup, when the name is not listed in the
> > > > > io-backend-names property. Other errors, such as probe deferral, are
> > > > > still returned.
> > > > > 
> > > > > To make that possible, a named lookup that does not match any entry of
> > > > > io-backend-names now fails with -ENOENT, the same error returned when the
> > > > > io-backends reference is missing. Also, the missing reference is no longer
> > > > > logged as an error, leaving that to the caller.
> 
> ...
> 
> > > > >  		ret = device_property_match_string(dev, "io-backend-names", name);
> > > > > +		if (ret == -EINVAL || ret == -ENODATA)
> > > > > +			return ERR_PTR(-ENOENT);
> > > > 
> > > > No. Please, use device_property_present() instead.
> > > 
> > > Oh right! Totally forgot about that internally :). And it fits into my
> > > internal point where I don't agree much in treating -ENODATA the same
> > > way as property does not exist.
> 
> +1
> 
> > Say a frontend consumes multiple backends, but some of them are optional.
> > If we care only about the presence of the property we would fail when
> > trying to acquire the optional ones when the required ones are defined.
> > am I thinking correctly?
> 
> If there is an empty property for names, shouldn't we simply fail? I rather
> would consider the firmware table to be broken in such a case.

What Rodrigo is saying is that an IIO frontend driver can have multiple
backends. So in practice:

io-backend-names = "foo", "bar";

But we might want to have foo as optional while bar is mandatory so that

io-backend-names = "bar"

So if we treat all errors (after checking for presence) the same we will fail
in the optional one. Note -ENODATA also means match_string() failed.

As of now there's no such usecase in tree or oeven out of tree (that I'm
aware of) but to support it is also fairly simple that I don't mind to
have it now.

- Nuno Sá

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

  parent reply	other threads:[~2026-10-16 14:06 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 16:49 [PATCH 00/10] iio: frequency: ad9910: add IIO backend support Rodrigo Alencar via B4 Relay
2026-10-15 16:49 ` Rodrigo Alencar
2026-10-15 16:49 ` [PATCH 01/10] iio: frequency: ad9910: powerdown fix Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 02/10] iio: backend: add devm_iio_backend_get_optional() Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 18:41   ` Andy Shevchenko
2026-10-16  8:45     ` Nuno Sá
2026-10-16 11:18       ` Rodrigo Alencar
2026-10-16 13:01         ` Nuno Sá
2026-10-16 13:21           ` Andy Shevchenko
2026-10-16 13:19         ` Andy Shevchenko
2026-10-16 13:32           ` Rodrigo Alencar
2026-10-16 14:07           ` Nuno Sá [this message]
2026-10-16  8:46   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 03/10] dt-bindings: iio: frequency: add adi,ad9910-axi-backend Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 18:59   ` Conor Dooley
2026-10-15 16:49 ` [PATCH 04/10] dt-bindings: iio: frequency: ad9910: add io-backends property Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 19:00   ` Conor Dooley
2026-10-15 16:49 ` [PATCH 05/10] iio: frequency: ad9910: move channel indexes into a shared header Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 06/10] iio: frequency: ad9910: add axi backend driver Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 16:59   ` sashiko-bot
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 07/10] iio: frequency: ad9910: support drctl control Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 16:58   ` sashiko-bot
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 08/10] iio: frequency: ad9910: support iio backend Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 17:04   ` sashiko-bot
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 09/10] iio: ABI: add integration_time for output channels Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar
2026-10-15 18:38   ` Andy Shevchenko
2026-10-16  9:22   ` Nuno Sá
2026-10-15 16:49 ` [PATCH 10/10] docs: iio: ad9910: document DRCTL pin control Rodrigo Alencar via B4 Relay
2026-10-15 16:49   ` Rodrigo Alencar

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=atIt3eXNeTT7cqxH@nsa \
    --to=nuno.sa@analog.com \
    --cc=455.rodrigo.alencar@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=ukleinek@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.