Re: [PATCH] iio: light: vcnl4035: fix scan buffer on big-endian

From: David Lechner

Date: Mon Mar 16 2026 - 10:38:59 EST


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.