mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	<linux-gpio@vger.kernel.org>, <nsekhar@ti.com>
Cc: <prabhakar.csengg@gmail.com>, <linux-kernel@vger.kernel.org>,
	<davinci-linux-open-source@linux.davincidsp.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>
Subject: [RFC v1 3/9] gpio: davinci: use chained_irq_enter/chained_irq_exit API
Date: Tue, 26 Nov 2013 21:40:09 +0200	[thread overview]
Message-ID: <1385494815-15740-4-git-send-email-grygorii.strashko@ti.com> (raw)
In-Reply-To: <1385494815-15740-1-git-send-email-grygorii.strashko@ti.com>

It's unsafe to call IRQ chip callbacks (.irq_mask/irq_unmask/irq_ack)
from chained IRQ handler directly. Because, Davinci GPIO block is used
by different SoCs, which, in turn, have different Main IRQ controllers
(Davinci - aintc, cp-intc; Keystone - arm-gic) which may introduce
diffrent set of IRQ chip callbacks. As result, call of
gpio_irq_handler() on Keysone will simply cause crash the system,
because ARM-GIC implements .irq_eoi() instead of .irq_ack().

Hence, fix it by using Kernel chained_irq_enter/chained_irq_exit APIs as
they are intended to handle exact such cases.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/gpio/gpio-davinci.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 70b5f2f..ee7a2df 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -22,6 +22,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/gpio-davinci.h>
+#include <linux/irqchip/chained_irq.h>
 
 struct davinci_gpio_regs {
 	u32	dir;
@@ -321,8 +322,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 		mask <<= 16;
 
 	/* temporarily mask (level sensitive) parent IRQ */
-	desc->irq_data.chip->irq_mask(&desc->irq_data);
-	desc->irq_data.chip->irq_ack(&desc->irq_data);
+	chained_irq_enter(irq_desc_get_chip(desc), desc);
 	while (1) {
 		u32		status;
 		int		bit;
@@ -343,7 +343,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 						 d->chip.base + bit));
 		}
 	}
-	desc->irq_data.chip->irq_unmask(&desc->irq_data);
+	chained_irq_exit(irq_desc_get_chip(desc), desc);
 	/* now it may re-trigger */
 }
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-11-26 19:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 19:40 [RFC v1 0/9] gpio: davinci: reuse for keystone arch Grygorii Strashko
2013-11-26 19:40 ` [RFC v1 1/9] gpio: davinci: get rid of DAVINCI_N_GPIO Grygorii Strashko
2013-11-29 15:48   ` Santosh Shilimkar
2013-11-26 19:40 ` [RFC v1 2/9] gpio: introduce GPIO_DAVINCI kconfig option Grygorii Strashko
2013-11-29 15:48   ` Santosh Shilimkar
2013-11-26 19:40 ` Grygorii Strashko [this message]
2013-11-29  8:39   ` [RFC v1 3/9] gpio: davinci: use chained_irq_enter/chained_irq_exit API Linus Walleij
2013-11-29 15:49   ` Santosh Shilimkar
2013-12-15 13:25   ` Sekhar Nori
2013-11-26 19:40 ` [RFC v1 4/9] gpio: davinci: make IRQ initialization soc specific Grygorii Strashko
2013-11-29  9:21   ` Linus Walleij
2013-11-29 16:20     ` Santosh Shilimkar
2013-11-26 19:40 ` [RFC v1 5/9] gpio: davinci: reuse for Keystone SoC Grygorii Strashko
2013-11-29  9:25   ` Linus Walleij
2013-11-29 16:28     ` Santosh Shilimkar
2013-11-26 19:40 ` [RFC v1 6/9] arm: dts: keystone: add GPIO device entry Grygorii Strashko
2013-11-29 16:40   ` Santosh Shilimkar
2013-11-26 19:40 ` [RFC v1 7/9] ARM: keystone_defconfig: enable gpio support Grygorii Strashko
2013-11-26 19:40 ` [RFC v1 8/9] arm: dts: keystone-evm: add LEDs supports Grygorii Strashko
2013-11-26 19:40 ` [RFC v1 9/9] ARM: keystone_defconfig: enable LED support Grygorii Strashko
2013-11-29  8:37 ` [RFC v1 0/9] gpio: davinci: reuse for keystone arch Linus Walleij
2013-12-02 10:41   ` Grygorii Strashko
2013-12-09 16:20   ` Santosh Shilimkar
2013-12-11 17:55 ` Prabhakar Lad

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=1385494815-15740-4-git-send-email-grygorii.strashko@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=santosh.shilimkar@ti.com \
    /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

all inboxes | Powered by JetHome®