[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251102112252.24138fce@jic23-huawei>
Date: Sun, 2 Nov 2025 11:22:52 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Francesco Lavra <flavra@...libre.com>
Cc: Lorenzo Bianconi <lorenzo@...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 4/9] iio: imu: st_lsm6dsx: dynamically allocate
iio_event_spec structs
On Thu, 30 Oct 2025 08:27:47 +0100
Francesco Lavra <flavra@...libre.com> wrote:
> In preparation for adding support for more event types, drop the
> static declaration of a single struct iio_event_spec variable, in
> favor of allocating and initializing the iio_event_spec array
> dynamically, so that it can contain more than one entry if a given
> sensor supports more than one event source.
>
> Signed-off-by: Francesco Lavra <flavra@...libre.com>
Similar comment for this to the dynamic channel creation.
Unless it is really quite a large number of combinations I'd normally go
for separate iio_chan_spec structures with pointers to separate iio_event_spec
structures. Whilst this adds a fair bit of data it is easy to review
as set of such structures for each device against the datasheet.
The code to do it dynamically often gets really fiddly as it has to translate
between different representations of the same thing.
You tend to get a device model specific iio_chan_spec structure array (or a set
of related devices share one).
Jonathan
Powered by blists - more mailing lists