openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ
@ 2020-12-10  6:50 Troy Lee
  2020-12-10 14:14 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Troy Lee @ 2020-12-10  6:50 UTC (permalink / raw)
  To: openbmc, Linus Walleij, Bartosz Golaszewski, Joel Stanley,
	Andrew Jeffery, open list:GPIO SUBSYSTEM,
	moderated list:ARM/ASPEED MACHINE SUPPORT,
	moderated list:ARM/ASPEED MACHINE SUPPORT, open list
  Cc: leetroy, troy_lee, ryan_chen, chiawei_wang

GPIO pins can be used as IRQ indicators. When they do,
those pins should be flaged with locks to avoid kernel
warning message.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Signed-off-by: Troy Lee <troy_lee@aspeedtech.com>
---
 drivers/gpio/gpio-aspeed.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index b966f5e28ebf..f5b3e1d89fbf 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -651,6 +651,13 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)
 		aspeed_gpio_copro_release(gpio, offset);
 	spin_unlock_irqrestore(&gpio->lock, flags);
 
+	rc = gpiochip_lock_as_irq(&gpio->chip, d->hwirq);
+	if (rc) {
+		dev_err(gpio->chip.parent, "unable to lock GPIO %lu as IRQ\n",
+			d->hwirq);
+		return rc;
+	}
+
 	irq_set_handler_locked(d, handler);
 
 	return 0;
-- 
2.17.1


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

* Re: [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ
  2020-12-10  6:50 [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ Troy Lee
@ 2020-12-10 14:14 ` Andy Shevchenko
  2020-12-13 23:38   ` Andrew Jeffery
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2020-12-10 14:14 UTC (permalink / raw)
  To: Troy Lee
  Cc: chiawei_wang, ryan_chen,
	moderated list:ARM/ASPEED MACHINE SUPPORT,
	open list:GPIO SUBSYSTEM, Andrew Jeffery, OpenBMC Maillist,
	open list, Bartosz Golaszewski, leetroy, Linus Walleij,
	moderated list:ARM/ASPEED MACHINE SUPPORT

On Thu, Dec 10, 2020 at 9:36 AM Troy Lee <troy_lee@aspeedtech.com> wrote:
>
> GPIO pins can be used as IRQ indicators. When they do,
> those pins should be flaged with locks to avoid kernel

flagged

> warning message.

...

> @@ -651,6 +651,13 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)

> +       rc = gpiochip_lock_as_irq(&gpio->chip, d->hwirq);
> +       if (rc) {
> +               dev_err(gpio->chip.parent, "unable to lock GPIO %lu as IRQ\n",
> +                       d->hwirq);
> +               return rc;
> +       }

It's a copy'n'paste of generic code. Why do you need it in an unusual
place, i.e. ->irq_set_type() IIUC?
Can you elaborate about an issue, because this seems to be a hack?

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ
  2020-12-10 14:14 ` Andy Shevchenko
@ 2020-12-13 23:38   ` Andrew Jeffery
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Jeffery @ 2020-12-13 23:38 UTC (permalink / raw)
  To: Andy Shevchenko, Troy Lee
  Cc: Chia-Wei, Wang, Ryan Chen,
	moderated list:ARM/ASPEED MACHINE SUPPORT,
	open list:GPIO SUBSYSTEM, OpenBMC Maillist, open list,
	Bartosz Golaszewski, Troy Lee, Linus Walleij,
	moderated list:ARM/ASPEED MACHINE SUPPORT



On Fri, 11 Dec 2020, at 00:44, Andy Shevchenko wrote:
> On Thu, Dec 10, 2020 at 9:36 AM Troy Lee <troy_lee@aspeedtech.com> wrote:
> >
> > GPIO pins can be used as IRQ indicators. When they do,
> > those pins should be flaged with locks to avoid kernel
> 
> flagged
> 
> > warning message.
> 
> ...
> 
> > @@ -651,6 +651,13 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)
> 
> > +       rc = gpiochip_lock_as_irq(&gpio->chip, d->hwirq);
> > +       if (rc) {
> > +               dev_err(gpio->chip.parent, "unable to lock GPIO %lu as IRQ\n",
> > +                       d->hwirq);
> > +               return rc;
> > +       }
> 
> It's a copy'n'paste of generic code. Why do you need it in an unusual
> place, i.e. ->irq_set_type() IIUC?
> Can you elaborate about an issue, because this seems to be a hack?

Yep - Troy please provide more information. What was the warning you saw? How
were the GPIOs allocated on the system that triggered the warning? What did you
do to trigger the warning?

Andrew

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

end of thread, other threads:[~2020-12-13 23:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10  6:50 [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ Troy Lee
2020-12-10 14:14 ` Andy Shevchenko
2020-12-13 23:38   ` Andrew Jeffery

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).