Re: [PATCH 1/1] pinctrl: iproc: Set irq handler based on trig type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2019-12-12 2:09 p.m., Hamish Martin wrote:
Rather than always using handle_simple_irq() as the gpio_irq_chip
handler, set a more appropriate handler based on the IRQ trigger type
requested.
This is important for level triggered interrupts which need to be
masked during handling.

Signed-off-by: Hamish Martin <hamish.martin@xxxxxxxxxxxxxxxxxxx>
---
  drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index 831a9318c384..c79e91eb1a47 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -288,6 +288,11 @@ static int iproc_gpio_irq_set_type(struct irq_data *d, unsigned int type)
  		       rising_or_high);
  	raw_spin_unlock_irqrestore(&chip->lock, flags);
+ if (type & IRQ_TYPE_EDGE_BOTH)
+		irq_set_handler_locked(d, handle_edge_irq);
+	else
+		irq_set_handler_locked(d, handle_level_irq);
+

I think it would make more sense to put them under the above spinlock protection, right?

In addition, with this, can the default assignment in 'iproc_gpio_probe' be removed?

girq->handler = handle_simple_irq;

Thanks,

Ray

  	dev_dbg(chip->dev,
  		"gpio:%u level_triggered:%d dual_edge:%d rising_or_high:%d\n",
  		gpio, level_triggered, dual_edge, rising_or_high);




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux