devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
Date: Sun, 7 Dec 2025 12:52:13 +0000	[thread overview]
Message-ID: <20251207125213.1f413e6b@jic23-huawei> (raw)
In-Reply-To: <aTSWk_p62hJBKCtN@smile.fi.intel.com>

On Sat, 6 Dec 2025 22:48:19 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> 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@analog.com> 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.

That's my standard 1st build choice now because it seems to be fussiest ;)
I haven't tried this one however.

Googling came up with a link saying GCC gives warnings on cases where
not all structure elements are set.  I think they always should be here
though which may make this fine (and act as a correct warning if they aren't).
That only works if the two uninitialized structure elements are dropped
obviously!

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

Fair enough.  Original is better than the i++ in only the second in my view.

Jonathan

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


  reply	other threads:[~2025-12-07 12:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 14:40 [PATCH v6 0/2] iio: amplifiers: add support for ADL8113 Low Noise Amplifier Antoniu Miclaus
2025-12-05 14:40 ` [PATCH v6 1/2] dt-bindings: iio: amplifiers: add adl8113 Antoniu Miclaus
2025-12-06 18:50   ` Jonathan Cameron
2025-12-09 20:51   ` Rob Herring (Arm)
2025-12-05 14:40 ` [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support Antoniu Miclaus
2025-12-05 15:10   ` Andy Shevchenko
2025-12-06 19:03   ` Jonathan Cameron
2025-12-06 20:48     ` Andy Shevchenko
2025-12-07 12:52       ` Jonathan Cameron [this message]
2025-12-12 10:41     ` Miclaus, Antoniu
2025-12-13 16:26       ` Jonathan Cameron

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=20251207125213.1f413e6b@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).