]> git.itanic.dy.fi Git - linux-stable/commit
gpiolib: convert 'devprop_gpiochip_set_names' to support multiple gpiochip banks...
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Wed, 28 Jul 2021 04:12:51 +0000 (06:12 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 29 Jul 2021 17:41:12 +0000 (19:41 +0200)
commit4e804c39f1be4498d80f379e5b7bc6d4f80f813c
tree72e10eb773bab7fd42fe2da829082f7b8033b3ec
parentf3f1017a98f91355671feb0e741391999a43b55d
gpiolib: convert 'devprop_gpiochip_set_names' to support multiple gpiochip banks per device

The default gpiolib-of implementation does not work with the multiple
gpiochip banks per device structure used for example by the gpio-mt7621
and gpio-brcmstb drivers. To fix these kind of situations driver code
is forced to fill the names to avoid the gpiolib code to set names
repeated along the banks. Instead of continue with that antipattern
fix the gpiolib core function to get expected behaviour for every
single situation adding a field 'offset' in the gpiochip structure.
Doing in this way, we can assume this offset will be zero for normal
driver code where only one gpiochip bank per device is used but
can be set explicitly in those drivers that really need more than
one gpiochip.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpiolib.c
include/linux/gpio/driver.h