[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260116195317.11c0978a@jic23-huawei>
Date: Fri, 16 Jan 2026 19:53:17 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, Francesco Lavra
<flavra@...libre.com>, 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 v2 3/3] iio: imu: st_lsm6dsx: Add support for rotation
sensor
On Thu, 15 Jan 2026 15:58:36 +0200
Andy Shevchenko <andriy.shevchenko@...el.com> wrote:
> On Thu, Jan 15, 2026 at 02:51:43PM +0100, Lorenzo Bianconi wrote:
> > On Jan 15, Andy Shevchenko wrote:
> > > On Thu, Jan 15, 2026 at 02:32:11PM +0100, Lorenzo Bianconi wrote:
>
> ...
>
> > > > > + settings = &sensor->hw->settings->sf_settings;
> > > > > + switch (mask) {
> > > > > + case IIO_CHAN_INFO_SAMP_FREQ: {
> > > > > + u32 odr_mHz;
> > > > > + u8 odr_val;
> > > > > +
> > > > > + odr_mHz = val * MILLI + val2 * MILLI / MICRO;
> > > > > + err = st_lsm6dsx_sf_get_odr_val(settings, odr_mHz, &odr_val);
> > > > > + if (err)
> > > > > + return err;
> > > > > +
> > > > > + sensor->hwfifo_odr_mHz = odr_mHz;
> > > > > + return 0;
> > > >
> > > > break;
> > > >
> > > > > + }
> > > > > + default:
> > > > > + return -EINVAL;
> > > >
> > > > break;
> > > >
> > > > > + }
> > > >
> > > > return err;
> > >
> > > Why?
> >
> > I guess it is more clear, but just a Nit, I can live with the current implementation.
>
> At least what you proposed is the opposite to the style that is accepted
> in IIO.
>
My preference is always to minimize flow I need to follow.
If there is a break, I expect to see something to do after the switch
statement and will scroll down to check what it is.
Whilst not the only use, it's one of the reasons cleanup.h stuff is
really handy as it often means there is nothing common to do by
hand before leaving a function.
Jonathan
Powered by blists - more mailing lists