Re: [PATCH] iio: light: vcnl4035: fix scan buffer on big-endian
From: Jonathan Cameron
Date: Sat Mar 21 2026 - 17:01:22 EST
On Mon, 16 Mar 2026 09:37:53 -0500
David Lechner <dlechner@xxxxxxxxxxxx> wrote:
> On 3/16/26 5:15 AM, Andy Shevchenko wrote:
> > On Sat, Mar 14, 2026 at 05:18:10PM -0500, David Lechner wrote:
> >> Rework vcnl4035_trigger_consumer_handler() so that we are not passing
> >> what should be a u16 value as an int * to regmap_read(). This won't
> >> work on bit endian systems.
> >>
> >> Instead, add a new unsigned int variable to pass to regmap_read(). Then
> >> copy that value into the buffer struct.
> >>
> >> The buffer array is replaced with a struct since there is only one value
> >> being read. This allows us to use the correct u16 data type and has a
> >> side-effect of simplifying the alignment specification.
> >>
> >> Also fix the endianness of the scan format from little-endian to CPU
> >> endianness. Since we are using regmap to read the value, it will be
> >> CPU-endian.
> >
> > ...
> >
> >> - iio_push_to_buffers_with_timestamp(indio_dev, buffer,
> >> - iio_get_time_ns(indio_dev));
> >> +
> >> + buffer.als_data = val;
> >> + iio_push_to_buffers_with_timestamp(indio_dev, &buffer,
> >> + iio_get_time_ns(indio_dev));
> >
> > Do you have plans to drop this old API as well?
> >
>
> Eventually, yes. My plan is to wait for fixes to go through first.
Agreed. Given the need for backports, better to do it in two steps.
Sooner or later we'll end up backporting the new _ts() variant
(if it hasn't already happened!) but lets not rush it.
Applied and marked for stable
Thanks,
Jonathan