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

Matti Vaittinen
2025-03-02T12:54:20Z

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.

> 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. 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.

Thank You for the long explanation of current system + the history :) I
appreciate your guidance!

Yours,
-- Matti