]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: adc: ad4170: use lookup table for gpio mask selection
authorGuilherme Ivo Bozi <guilherme.bozi@usp.br>
Sun, 5 Apr 2026 21:37:26 +0000 (18:37 -0300)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Apr 2026 08:58:23 +0000 (09:58 +0100)
commit1ebc22b9b32fc4319538f95bd65f9dee5a5e6c38
treecafae10cf64ec24599320503ab9b4669952751d8
parent277a2d241c089fa885f734e6cf57f30883399571
iio: adc: ad4170: use lookup table for gpio mask selection

Both ad4170_gpio_direction_input() and
ad4170_gpio_direction_output() duplicate the same switch
statement to map a GPIO offset to its corresponding mask.

Replace the switch with a static lookup table, simplifying the code
and avoiding duplication. This also makes future extensions easier.

No functional change intended.

Signed-off-by: Guilherme Ivo Bozi <guilherme.bozi@usp.br>
Acked-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ad4170-4.c