Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq
From: Linus Walleij <hidden>
Date: 2016-10-26 14:32:33
Also in:
linux-amlogic, linux-arm-kernel, linux-gpio, lkml
From: Linus Walleij <hidden>
Date: 2016-10-26 14:32:33
Also in:
linux-amlogic, linux-arm-kernel, linux-gpio, lkml
On Wed, Oct 26, 2016 at 4:22 PM, Jerome Brunet [off-list ref] wrote:
On Tue, 2016-10-25 at 20:20 +0200, Linus Walleij wrote:
quoted
However the semantic is such, that it is not necessary to call to_irq() before using an IRQ: the irqchip and gpiochip abstractions should be orthogonal.Linus, They are orthogonal. You can request an irq from the irqchip controller without the gpiochip, like any other irq controller.
OK good, sorry if I'm stating the obvious.
irq_create_mapping (and irq_create_fwspec_mapping) internally calls irq_find_mapping. So if the mapping already exist (the irq is already used before calling to_irq), the existing mapping will be returned. The mapping will be actually created only if needed. It seems to be in line with your explanation, no ?
Yes, but you want to call irq_create_mapping() in slowpath (irq setup) and irq_find_mapping() in fastpath (irq handler). Else the first IRQ may result in unwelcomed surprises.
There is really a *lot* of gpio drivers which use irq_create_mapping in the to_irq callback, are these all wrong ?
Yes they are all wrong. They should all be using irq_find_mapping().
If this should not be used, what should we all do instead ?
Call irq_create_mapping() in some other place. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html