]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: light: vcnl4035: fix scan buffer on big-endian
authorDavid Lechner <dlechner@baylibre.com>
Sat, 14 Mar 2026 22:18:10 +0000 (17:18 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 21 Mar 2026 20:59:50 +0000 (20:59 +0000)
commitfdc7aa54a5d44c05880a4aad7cfb41aacfd16d7b
tree4a5defa10d6ad87df4046a4ca49157a5bd9fc798
parent768461517a28d80fe81ea4d5d03a90cd184ea6ad
iio: light: vcnl4035: fix scan buffer on big-endian

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.

Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/vcnl4035.c