Commit 50ed17cd authored by Beatriz Viana Costa's avatar Beatriz Viana Costa Committed by Jonathan Cameron
Browse files

iio: light: zopt2201: Remove code duplication in scale write functions



Consolidate duplicated logic from zopt2201_write_scale_als_by_idx() and
zopt2201_write_scale_uvb_by_idx() into a new generic helper function
zopt2201_write_scale_by_idx(). This function takes an additional
parameter: a pointer to a zopt2201_scale array.

To support this, the previously anonymous and duplicated struct used in
the scale arrays was promoted to a named struct: zopt2201_scale.

This change also corrects an incorrect array access that existed in
zopt2201_write_scale_uvb_by_idx().

Signed-off-by: default avatarBeatriz Viana Costa <beatrizvianacosta16@gmail.com>
Co-developed-by: default avatarGabriela Victor <gabevictor333@gmail.com>
Signed-off-by: default avatarGabriela Victor <gabevictor333@gmail.com>
Link: https://patch.msgid.link/20250424002144.23260-1-beatrizvianacosta16@gmail.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 52c43d80
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment