linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
@ 2020-06-18 11:49 Andy Shevchenko
  2020-06-18 11:57 ` Mika Westerberg
  2020-06-20 21:31 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-06-18 11:49 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Andy Shevchenko, Mika Westerberg

When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
missed GPIO resource release. We can safely do this in the same quirk, since
IRQ will be locked by GPIO framework when requested and unlocked on freeing.

Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpio-pca953x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index cea22fcc2a24..9c90cf3aac5a 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -177,7 +177,12 @@ static int pca953x_acpi_get_irq(struct device *dev)
 	if (ret)
 		return ret;
 
-	return gpio_to_irq(pin);
+	ret = gpio_to_irq(pin);
+
+	/* When pin is used as an IRQ, no need to keep it requested */
+	gpio_free(pin);
+
+	return ret;
 }
 #endif
 
-- 
2.27.0.rc2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
  2020-06-18 11:49 [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2 Andy Shevchenko
@ 2020-06-18 11:57 ` Mika Westerberg
  2020-06-20 21:31 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2020-06-18 11:57 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio

On Thu, Jun 18, 2020 at 02:49:06PM +0300, Andy Shevchenko wrote:
> When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
> ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> missed GPIO resource release. We can safely do this in the same quirk, since
> IRQ will be locked by GPIO framework when requested and unlocked on freeing.
> 
> Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
  2020-06-18 11:49 [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2 Andy Shevchenko
  2020-06-18 11:57 ` Mika Westerberg
@ 2020-06-20 21:31 ` Linus Walleij
  2020-06-21  8:23   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2020-06-20 21:31 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, Mika Westerberg

On Thu, Jun 18, 2020 at 1:49 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
> ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> missed GPIO resource release. We can safely do this in the same quirk, since
> IRQ will be locked by GPIO framework when requested and unlocked on freeing.
>
> Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

This seems to go on top of what Bartosz applied so I expect him to pick
it up!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
  2020-06-20 21:31 ` Linus Walleij
@ 2020-06-21  8:23   ` Andy Shevchenko
  2020-06-22 16:52     ` Bartosz Golaszewski
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2020-06-21  8:23 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Bartosz Golaszewski, open list:GPIO SUBSYSTEM,
	Mika Westerberg

On Sun, Jun 21, 2020 at 12:33 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Thu, Jun 18, 2020 at 1:49 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
> > ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> > missed GPIO resource release. We can safely do this in the same quirk, since
> > IRQ will be locked by GPIO framework when requested and unlocked on freeing.
> >
> > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
>
> This seems to go on top of what Bartosz applied so I expect him to pick
> it up!

Yes, that's what is expected.

> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
  2020-06-21  8:23   ` Andy Shevchenko
@ 2020-06-22 16:52     ` Bartosz Golaszewski
  0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2020-06-22 16:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Andy Shevchenko, open list:GPIO SUBSYSTEM,
	Mika Westerberg

niedz., 21 cze 2020 o 10:23 Andy Shevchenko
<andy.shevchenko@gmail.com> napisał(a):
>
> On Sun, Jun 21, 2020 at 12:33 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Thu, Jun 18, 2020 at 1:49 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
> > > ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> > > missed GPIO resource release. We can safely do this in the same quirk, since
> > > IRQ will be locked by GPIO framework when requested and unlocked on freeing.
> > >
> > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> >
> > This seems to go on top of what Bartosz applied so I expect him to pick
> > it up!
>
> Yes, that's what is expected.
>
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Thanks!
>
> --
> With Best Regards,
> Andy Shevchenko

Applied for fixes. I'll send a PR to Linus later this week.

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-22 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 11:49 [PATCH v1] gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2 Andy Shevchenko
2020-06-18 11:57 ` Mika Westerberg
2020-06-20 21:31 ` Linus Walleij
2020-06-21  8:23   ` Andy Shevchenko
2020-06-22 16:52     ` 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).