On Fri, 7 Dec 2018, Linus Walleij wrote:
Sorry for answering late.
On Thu, Nov 29, 2018 at 2:31 PM Linus Walleij linus.walleij@linaro.org wrote:
This irqchip is in drivers/pinctrl/qcom/pinctrl-msm.c and known as TLMM.
TLMM == Totally Lost Manufacturer Mess?
However, the irqchip core helpers in GPIO assumes that the .irq_request_resources() callback is always called before .irq_enable(), and the latter is where module refcount and also gpiochip_lock_as_irq() is normally called.
When .irq_enable() is called without .irq_request_resources() having been called first, it seems like we are enabling an IRQ on a GPIO line that has not first been locked to be used as IRQ and we get the above warning. This happens since as of commit 461c1a7d4733d ("gpiolib: override irq_enable/disable") this is strictly assumed for all GPIO-based IRQs.
As it seems reasonable to assume that .irq_request_resources() is always strictly called before .irq_enable(), we add the irq_[request|release]_resources() functions to the internal API and call them also when adding a chained irqchip to an IRQ.
I am a bit uncertain about the call site for irq_released_resources() inside chip.c, but it appears this path is for uninstalling a chained handler.
You cannot invoke those callbacks from __irq_do_set_handler() as that is holding the irq descriptor lock with interrupts disabled.
The calling convention for irq_released_resources() is that it's called with the bus lock held (if the chip provides the bus lock callbacks), but definitely not with desc->lock held.
Needs more thought. Btw, the uninstall path does not invoke irq_deactive() either.... I so hate that chained handler mess....
Thanks,
tglx