[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e82fc48fadc89014764ad3c0c5f07d0075cf6748.camel@baylibre.com>
Date: Fri, 31 Oct 2025 12:43:39 +0100
From: Francesco Lavra <flavra@...libre.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, Jonathan Cameron
<jic23@...nel.org>, David Lechner <dlechner@...libre.com>, Nuno
Sá <nuno.sa@...log.com>, Andy Shevchenko
<andy@...nel.org>, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] iio: imu: st_lsm6dsx: dynamically initialize
iio_chan_spec data
On Fri, 2025-10-31 at 10:32 +0200, Andy Shevchenko wrote:
> On Fri, Oct 31, 2025 at 09:26:19AM +0100, Francesco Lavra wrote:
> > On Thu, 2025-10-30 at 17:42 +0100, Lorenzo Bianconi wrote:
>
> > > > + chan->ext_info = st_lsm6dsx_ext_info;
> > > > + if (id == ST_LSM6DSX_ID_ACC) {
> > > > + if (hw->settings->event_settings.wakeup_reg.addr) {
> > >
> > > if (id == ST_LSM6DSX_ID_ACC &&
> > > hw->settings->event_settings.wakeup_reg.addr) {
> > > ...
> > > }
> >
> > In patch 4/9, the inner conditional will be replaced by more generic
> > code,
> > so we would revert to if (id == ST_LSM6DSX_ID_ACC) [...]
>
> Hmm... The obvious follow up question is why can't we stick with the
> original
> conditional to begin with?
There is no original conditional, this is new code.
So the code here is `if (cond1) {if (cond2) {}}`; in patch 4/9 it will
become `if (cond1) {something else}`.
Or, better yet, as you suggested earlier, in the next revision the code
here will be `if (cond1) helper()`, and in the patch 4/9 this will stay the
same and only the code inside the helper will change.
Download attachment "signature.asc" of type "application/pgp-signature" (660 bytes)
Powered by blists - more mailing lists