summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-02-23 09:01:35 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2024-02-23 09:01:35 -0800
commit9cd42be825fa15609bf0616d70032d90e844282e (patch)
treec178b3c716bcf3db3673dd161fe072298a1b58d7
parent76d885a1e5450d16252fcfc07d51ecdaaf712fa4 (diff)
parentae366ba8576da0135d7d3db2dfa6304f3338d0c2 (diff)
Merge tag 'gpio-fixes-for-v6.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fix from Bartosz Golaszewski: - fix a use-case where no pins are mapped to GPIOs in gpiochip_generic_config() * tag 'gpio-fixes-for-v6.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpiolib: Handle no pin_ranges in gpiochip_generic_config()
-rw-r--r--drivers/gpio/gpiolib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8b3a0f45b574..e434e8cc1229 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2042,6 +2042,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
unsigned long config)
{
+#ifdef CONFIG_PINCTRL
+ if (list_empty(&gc->gpiodev->pin_ranges))
+ return -ENOTSUPP;
+#endif
+
return pinctrl_gpio_set_config(gc, offset, config);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_config);