]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gpio: kempld: Simplify the bit level register accesses
authorAlban Bedel <alban.bedel@lht.dlh.de>
Wed, 11 Mar 2026 14:31:17 +0000 (15:31 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 16 Mar 2026 09:05:32 +0000 (10:05 +0100)
commit4071437cd2aac6b9d48f160d46cfb35ecbb11136
tree8d31dcb4496bf9fde5e31deaa6b7bfe76102ddd0
parent803e822b0089211367d8d368a163b1dea077159d
gpio: kempld: Simplify the bit level register accesses

The hardware uses 8 bit registers but supports configurations with up
to 16 GPIO, so all GPIO registers come in pairs. Most accesses to
single bits is done using the kempld_gpio_bitop() and
kempld_gpio_get_bit() functions, which take a register index and bit
offset as parameter. These functions apply a modulo on the bit offset
but leave the register index as is, so callers have to use an
additional macro to fix the register index before the call.

Simplify things by also handling the register index offsetting in the
bitop functions.

Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
Link: https://patch.msgid.link/20260311143120.2179347-2-alban.bedel@lht.dlh.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-kempld.c