Re: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support

From: Andy Shevchenko

Date: Sat Dec 06 2025 - 15:48:26 EST


On Sat, Dec 06, 2025 at 07:03:32PM +0000, Jonathan Cameron wrote:
> On Fri, 5 Dec 2025 16:40:41 +0200
> Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> wrote:

...

> > + /* Always include internal amplifier (14dB) */
> > + st->gain_configs[i].path = ADL8113_INTERNAL_AMP;
> > + st->gain_configs[i].gain_db = 14;
>
> Could do this as something like:

I remember a discussion where it was against this approach due to compiler
warnings or so. However, IIRC, there was slightly different pattern, i.e.

foo[i].bar = ...
foo[i++].baz = ...

That said, I have no objection to your proposal, but we need to use it with
a good compile test coverage (clang with `make W=1` for a starter.

OTOH, the original code is robust enough...

> st->gain_configs[i++] = (struct adl8113_gain_config) {
> .path = ADL8113_INTERNAL_AMP,
> .gain_db = 14,
> };

...and doesn't require a good understanding of differences between designated
initialisers and compound literals.

> st->gain_configs[i++] = (struct adl8113_gain_config) {
> .path = ADL8113_INTERNAL_BYPASS,
> .gain_db = -2,
> };


--
With Best Regards,
Andy Shevchenko