lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1c7222b35a0a7bcddc5d88c92f64d2f2a75fdfd.camel@baylibre.com>
Date: Thu, 30 Oct 2025 12:23:19 +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 8/9] iio: imu: st_lsm6dsx: add event configurability on
 a per axis basis

On Thu, 2025-10-30 at 10:24 +0200, Andy Shevchenko wrote:
> On Thu, Oct 30, 2025 at 08:27:51AM +0100, Francesco Lavra wrote:
> > In order to be able to configure event detection on a per axis
> > basis (for either setting an event threshold/sensitivity value, or
> > enabling/disabling event detection), add new axis-specific fields
> > to struct st_lsm6dsx_event_src, and modify the logic that handles
> > event configuration to properly handle axis-specific settings when
> > supported by a given event source.
> > A future commit will add actual event sources with per-axis
> > configurability.
> 
> ...
> 
> > +       old_enable = hw->enable_event[event];
> > +       new_enable = state ? (old_enable | BIT(axis)) : (old_enable &
> > ~BIT(axis));
> > +       if (!!old_enable == !!new_enable)
> 
> This is an interesting check. So, old_enable and new_enable are _not_
> booleans, right?
> So, this means the check test if _any_ of the bit was set and kept set or
> none were set
> and non is going to be set. Correct? I think a short comment would be
> good to have.

old_enable and new_enable are bit masks, but we are only interested in
whether any bit is set, to catch the cases where the bit mask goes from
zero to non-zero and vice versa. Will add a comment.

> 
> > +               return 0;
> 
> ...
> 
> > +static const struct st_lsm6dsx_reg *st_lsm6dsx_get_event_reg(struct
> > st_lsm6dsx_hw *hw,
> > +                                                            enum
> > st_lsm6dsx_event_id event,
> > +                                                            const
> > struct iio_chan_spec *chan)
> > +{
> > +       const struct st_lsm6dsx_event_src *src = &hw->settings-
> > >event_settings.sources[event];
> > +       const struct st_lsm6dsx_reg *reg;
> > +
> > +       switch (chan->channel2) {
> > +       case IIO_MOD_X:
> > +               reg = &src->x_value;
> > +               break;
> > +       case IIO_MOD_Y:
> > +               reg = &src->y_value;
> > +               break;
> > +       case IIO_MOD_Z:
> > +               reg = &src->z_value;
> > +               break;
> > +       default:
> > +               return NULL;
> > +       }
> 
> > +       if (!reg->addr)
> > +               reg = &src->value;
> > +       return reg;
> 
>         if (reg->addr)
>                 return reg;
> 
>         /* Perhaps a comment here to explain the choice */
>         return &src->value;
> > 
Will do.
> 


Download attachment "signature.asc" of type "application/pgp-signature" (660 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ