]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: aggregator: Wrap access to gpiochip_fwd.tmp[]
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 4 Oct 2021 12:45:45 +0000 (14:45 +0200)
committerBartosz Golaszewski <brgl@bgdev.pl>
Wed, 13 Oct 2021 14:19:23 +0000 (16:19 +0200)
commite396a9068c7292d4b5fee88f791391143e5fe8a4
treee5cbe3a8f8a54d9f82d2ba3f7b1bdcab220a678c
parentad62cec69797b850abf442eb3780e0f6987b73a5
gpio: aggregator: Wrap access to gpiochip_fwd.tmp[]

The tmp[] member of the gpiochip_fwd structure is used to store both the
temporary values bitmap and the desc pointers for operations on multiple
GPIOs.  As both are arrays with sizes unknown at compile-time, accessing
them requires offset calculations, which are currently duplicated in
gpio_fwd_get_multiple() and gpio_fwd_set_multiple().

Introduce (a) accessors for both arrays and (b) a macro to calculate the
needed storage size.  This confines the layout of the tmp[] member into
a single spot, to ease maintenance.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpio-aggregator.c