]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: light: as73211: fix channel handling in only-color triggered buffer
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Sat, 14 Dec 2024 22:55:50 +0000 (23:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:30 +0000 (12:50 +0100)
commit1880c45ebe149a72c44d459b15d091b71c7f9bf1
treeebd08f5aae06abfcecd9ad1446b4592690128b3c
parent22d1dcd0b053430d5fb4b52ee85379ecd042e300
iio: light: as73211: fix channel handling in only-color triggered buffer

commit ab09c6cfe01b317f515bcd944668697241a54b9d upstream.

The channel index is off by one unit if AS73211_SCAN_MASK_ALL is not
set (optimized path for color channel readings), and it must be shifted
instead of leaving an empty channel for the temperature when it is off.

Once the channel index is fixed, the uninitialized channel must be set
to zero to avoid pushing uninitialized data.

Add available_scan_masks for all channels and only-color channels to let
the IIO core demux and repack the enabled channels.

Cc: stable@vger.kernel.org
Fixes: 403e5586b52e ("iio: light: as73211: New driver")
Tested-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241214-iio_memset_scan_holes-v4-1-260b395b8ed5@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/light/as73211.c