mbox series

[0/3] Check for IRQ trigger type mismatch in __setup_irq()

Message ID 20220530080842.37024-1-manivannan.sadhasivam@linaro.org
Headers show
Series Check for IRQ trigger type mismatch in __setup_irq() | expand

Message

Manivannan Sadhasivam May 30, 2022, 8:08 a.m. UTC
Hi,

This series adds a check for detecting the IRQ trigger type mismatch between the
platform (DT) and a device driver. Currently, if there is a mismatch, there
is no error thrown but the driver requested trigger gets set silently. Then
during the second time probe of a driver (due to probe defer or rmmod/insmod),
platform_get_irq() throws a warning similar to below and fails.

irq: type mismatch, failed to map hwirq-9 for interrupt-controller@b220000!

But ideally, during the first time itself, request_irq() should've failed as
the flag mismatch is a hard error. So let's add a check in __setup_irq(), such
that the request_irq() would fail if a mismatch has been detected.

NOTE: This might break platforms those has the flag set incorrectly in DT. One
of such case is SDX55, where the UART node has the trigger set incorrectly.
I fixed it in a couple of places I happen to know. But there could be many...

Thanks,
Mani

Manivannan Sadhasivam (3):
  ARM: dts: qcom: sdx55: Fix the IRQ trigger type for UART
  arm64: dts: qcom: sm8450: Fix the IRQ trigger type for remoteproc
    nodes
  genirq: Check for trigger type mismatch in __setup_irq()

 arch/arm/boot/dts/qcom-sdx55.dtsi    |  2 +-
 arch/arm64/boot/dts/qcom/sm8450.dtsi |  8 ++++----
 kernel/irq/manage.c                  | 14 ++++++++++++--
 3 files changed, 17 insertions(+), 7 deletions(-)