* [PATCH v1 0/1] gpiolib: Don't free if pin ranges are not defined
@ 2020-11-30 22:47 Will McVicker
2020-11-30 22:47 ` [PATCH v1 1/1] " Will McVicker
0 siblings, 1 reply; 3+ messages in thread
From: Will McVicker @ 2020-11-30 22:47 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Thierry Reding
Cc: Edmond Chung, Andrew Chant, linux-gpio, linux-kernel,
kernel-team, Will McVicker
This patch fixes commit 2ab73c6d8323 ("gpio: Support GPIO controllers
without pin-ranges") where an imbalance of requests and frees to the
pinctrl driver were introduced.
Edmond Chung (1):
gpiolib: Don't free if pin ranges are not defined
drivers/gpio/gpiolib.c | 5 +++++
1 file changed, 5 insertions(+)
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1 1/1] gpiolib: Don't free if pin ranges are not defined
2020-11-30 22:47 [PATCH v1 0/1] gpiolib: Don't free if pin ranges are not defined Will McVicker
@ 2020-11-30 22:47 ` Will McVicker
2020-12-01 14:41 ` Bartosz Golaszewski
0 siblings, 1 reply; 3+ messages in thread
From: Will McVicker @ 2020-11-30 22:47 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Thierry Reding
Cc: Edmond Chung, Andrew Chant, linux-gpio, linux-kernel,
kernel-team, Will McVicker
From: Edmond Chung <edmondchung@google.com>
A similar check was added in gpiochip_generic_request, but not in free.
This has caused an imbalance count of request vs. free calls to the
pinctrl driver. This patch is targeted to fix that issue.
Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges")
Signed-off-by: Edmond Chung <edmondchung@google.com>
Signed-off-by: Andrew Chant <achant@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
---
drivers/gpio/gpiolib.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 089ddcaa9bc6..6e3c4d7a7d14 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
*/
void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
{
+#ifdef CONFIG_PINCTRL
+ if (list_empty(&gc->gpiodev->pin_ranges))
+ return;
+#endif
+
pinctrl_gpio_free(gc->gpiodev->base + offset);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_free);
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] gpiolib: Don't free if pin ranges are not defined
2020-11-30 22:47 ` [PATCH v1 1/1] " Will McVicker
@ 2020-12-01 14:41 ` Bartosz Golaszewski
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-12-01 14:41 UTC (permalink / raw)
To: Will McVicker
Cc: Linus Walleij, Thierry Reding, Edmond Chung, Andrew Chant,
linux-gpio, LKML, kernel-team
On Mon, Nov 30, 2020 at 11:48 PM Will McVicker <willmcvicker@google.com> wrote:
>
> From: Edmond Chung <edmondchung@google.com>
>
> A similar check was added in gpiochip_generic_request, but not in free.
> This has caused an imbalance count of request vs. free calls to the
> pinctrl driver. This patch is targeted to fix that issue.
>
> Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges")
> Signed-off-by: Edmond Chung <edmondchung@google.com>
> Signed-off-by: Andrew Chant <achant@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> ---
> drivers/gpio/gpiolib.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 089ddcaa9bc6..6e3c4d7a7d14 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
> */
> void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
> {
> +#ifdef CONFIG_PINCTRL
> + if (list_empty(&gc->gpiodev->pin_ranges))
> + return;
> +#endif
> +
> pinctrl_gpio_free(gc->gpiodev->base + offset);
> }
> EXPORT_SYMBOL_GPL(gpiochip_generic_free);
> --
> 2.29.2.454.gaff20da3a2-goog
>
Applied, thanks!
Bartosz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-01 14:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 22:47 [PATCH v1 0/1] gpiolib: Don't free if pin ranges are not defined Will McVicker
2020-11-30 22:47 ` [PATCH v1 1/1] " Will McVicker
2020-12-01 14:41 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).