Thread (11 messages) read the whole thread 11 messages, 4 authors, 2025-12-13

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

From: Andy Shevchenko <hidden>
Date: 2025-12-06 20:48:26
Also in: linux-iio, lkml

On Sat, Dec 06, 2025 at 07:03:32PM +0000, Jonathan Cameron wrote:
On Fri, 5 Dec 2025 16:40:41 +0200
Antoniu Miclaus [off-list ref] wrote:
...
quoted
+	/* 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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help