(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

iio: light: veml3328: reshape scale array for readability

The veml3328_scale_vals array is declared as a flattened [4][8] array, so accessing a scale value requires calculating the offset of its (val, val2) pair using gain_inx * 2. Reshape the array as [4][4][2], with separate dimensions for integration time, gain and the scale value pair. This removes the manual stride calculation and makes the relationship between the indexes and values explicit. Add named integration-time indexes and use designated initializers for veml3328_it_times and veml3328_scale_vals so both tables use the same index definitions. Suggested-by: David Lechner <dlechner@baylibre.com> Suggested-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Giorgi Tchankvetadze <giorgi@tchankvetadze.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>


Author Giorgi Tchankvetadze Committer Jonathan Cameron Date Commit Parent 4c1836bb
+38 -15
1 changed file
+38 -15
1 changed file