[lkml]   [2021]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: gpiochip_lock_as_irq on pins without FLAG_REQUESTED: bug or feature ?
On Fri, 2 Jul 2021 02:09:17 +0200, Linus Walleij <> wrote:
> The basic reason is that gpiochips and irqchips are orthogonal.
> You can request an IRQ on a GPIO line without requesting the
> GPIO line for anything else.
> This is also used when drivers want to inspect the state of a GPIO
> line (read the value) while the same line triggers IRQs. This is
> perfectly legal. An extreme example is:
> drivers/media/cec/platform/cec-gpio/cec-gpio.c

Interesting, thank you very much.

> On Mon, Jun 28, 2021 at 5:37 AM Vincent Pelletier <> wrote:
> > Also, I notice that both gpiochip_hierarchy_add_domain and
> > gpiochip_reqres_irq call gpiochip_lock_as_irq, and I am surprised I do not
> > get any error about this: in my understanding only the first call on a given pin
> > should succeed, but with my WARN_ON I am seeing both stack traces and
> > no other warning.
> Hm that may be a subtle bug.
> The state is just a bool so the first to leave will turn out the lights
> for whoever is left in the room :P

Actually my question came from yet another misunderstanding on my side:
I expected this function to act as an exclusive access control (because
of the "lock" in the name), but I then realised my assumption is wrong.

So while this could be a subtle bug indeed (irq_disable without
irq_shutdown is not the exact same state as right after irq_startup),
it's likely not the one I'm chasing - if it leads to any actual issue
at all.

Vincent Pelletier
GPG fingerprint 983A E8B7 3B91 1598 7A92 3845 CAC9 3691 4257 B0C1

 \ /
  Last update: 2021-07-02 12:49    [W:0.402 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site