public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: carlo@caione.org (Carlo Caione)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: sun7i/sun6i: irqchip: Disable NMI before registering the handler
Date: Thu, 27 Mar 2014 18:02:39 +0100	[thread overview]
Message-ID: <1395939759-11135-3-git-send-email-carlo@caione.org> (raw)
In-Reply-To: <1395939759-11135-1-git-send-email-carlo@caione.org>

From: Hans de Goede <hdegoede@redhat.com>

It is advisable to disable the NMI before registering the IRQ handler as
registering the IRQ handler unmasks the IRQ on the GIC, so if U-Boot has
left the NMI enabled and the NMI pin is active we will immediately get
an interrupt before any driver has claimed the downstream interrupt of
the NMI.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Carlo Caione <carlo@caione.org>
---
 drivers/irqchip/irq-sunxi-nmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
index 1c8566c..12f547a 100644
--- a/drivers/irqchip/irq-sunxi-nmi.c
+++ b/drivers/irqchip/irq-sunxi-nmi.c
@@ -179,12 +179,12 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
 	gc->chip_types[1].regs.type		= reg_offs->ctrl;
 	gc->chip_types[1].handler		= handle_edge_irq;
 
-	irq_set_handler_data(irq, domain);
-	irq_set_chained_handler(irq, sunxi_sc_nmi_handle_irq);
-
 	sunxi_sc_nmi_write(gc, reg_offs->enable, 0);
 	sunxi_sc_nmi_write(gc, reg_offs->pend, 0x1);
 
+	irq_set_handler_data(irq, domain);
+	irq_set_chained_handler(irq, sunxi_sc_nmi_handle_irq);
+
 	return 0;
 
 fail_irqd_remove:
-- 
1.8.4.1

  parent reply	other threads:[~2014-03-27 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 17:02 [PATCH 0/2] ARM: sun7i/sun6i: Fix broken kernel on sun6i/A31 Carlo Caione
2014-03-27 17:02 ` [PATCH 1/2] ARM: sun7i/sun6i: dts: Fix IRQ number for sun6i NMI controller Carlo Caione
2014-03-31 11:02   ` Maxime Ripard
2014-03-27 17:02 ` Carlo Caione [this message]
2014-03-31 11:06   ` [PATCH 2/2] ARM: sun7i/sun6i: irqchip: Disable NMI before registering the handler Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395939759-11135-3-git-send-email-carlo@caione.org \
    --to=carlo@caione.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox