Re: [PATCH v4 03/10] iio: adc: add helpers for parsing ADC nodes

Jonathan Cameron
2025-03-04T23:59:52Z

On Sun, 2 Mar 2025 14:54:16 +0200
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> On 02/03/2025 05:20, Jonathan Cameron wrote:
> > On Thu, 27 Feb 2025 09:46:06 +0200
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >
> >> On 26/02/2025 18:10, David Lechner wrote:
> >>> On 2/26/25 12:28 AM, Matti Vaittinen wrote:
>
> ...
>
> > So today the situation is we have all the options in tree and we aren't
> > really in a position to drop any of them:
>
> Sure. I am only really interested whether we want to prefer some
> approach for (majority of) new drivers. Furthermore, I believe there
> will always be corner cases and oddities which won't fit to the 'de
> facto' model. That doesn't mean we shouldn't help those which don't have
> such 'oddities' to work with some generic code.
Absolutely but we also can't apply this to existing drivers that don't
work quite that way. So if we want to make more use of it we end up
providing variants long term.

>
> > Hindsight is a wonderful thing. I'm not sure on what policy we should have
> > gone for, but now we are kind of stuck with this slightly messy situation.
>
> Sorry if my comments came out as criticism.

No problem - that was just me being wistful about wanting a crystal ball :)

> It was not intention, I just
> try to justify the helpers by trying to think what new drivers should
> prefer.
>
> > Helper wise if it expands usefulness we may want a bool parameter to say
> > if we skip the missing or not + make sure a max expected channel is provided
> > (might already be - I didn't check!)
>
> This far it only had (optional) maximum channel ID for sanity checking
> (useful for callers which use the ID to index an array). The bool
> parameter would also require a parameter specifying the number of
> expected channels. That'd make 3 parameters which may be used or unused.
>
> I don't think I saw existing code which would have used these
> parameters. It might be cleaner to add new APIs when we get such
> use-cases. That should simplify the use for current cases.
That's fair enough. Ultimately my guess is we'll end up with a complex
internal function and a bunch of wrappers that elide the majority of
the parameters. We can get there once it's needed though!

Jonathan

>
> Thank You for the long explanation of current system + the history :) I
> appreciate your guidance!
>
> Yours,
> -- Matti
>