linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jon-hunter@ti.com (Jon Hunter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] gpio/omap: warn if bank is not enabled on setting irq type
Date: Fri, 1 Mar 2013 11:22:48 -0600	[thread overview]
Message-ID: <1362158568-1624-3-git-send-email-jon-hunter@ti.com> (raw)
In-Reply-To: <1362158568-1624-1-git-send-email-jon-hunter@ti.com>

For OMAP devices, if a gpio is being used as an interrupt source but has
not been requested by calling gpio_request(), a call to request_irq()
may cause the kernel hang because the gpio bank may be disabled and
hence the register access will fail. To prevent such hangs, test for
this case and warn if this is detected.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 drivers/gpio/gpio-omap.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index c3598d1..0d30c7a 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -427,6 +427,9 @@ static int gpio_irq_type(struct irq_data *d, unsigned type)
 	int retval;
 	unsigned long flags;
 
+	if (WARN_ON(!bank->mod_usage))
+		return -EINVAL;
+
 #ifdef CONFIG_ARCH_OMAP1
 	if (d->irq > IH_MPUIO_BASE)
 		gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-01 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 17:22 [PATCH 0/2] gpio/omap: updates for v3.10 Jon Hunter
2013-03-01 17:22 ` [PATCH 1/2] gpio/omap: convert gpio irq domain to linear mapping Jon Hunter
2013-03-02  5:24   ` Santosh Shilimkar
2013-03-02 11:48   ` Felipe Balbi
2013-03-04 17:06     ` Jon Hunter
2013-03-04 17:11       ` Felipe Balbi
2013-03-04 17:58         ` Jon Hunter
2013-03-04 18:47           ` Felipe Balbi
2013-03-02 19:39   ` Grant Likely
2013-03-01 17:22 ` Jon Hunter [this message]
2013-03-02  5:27   ` [PATCH 2/2] gpio/omap: warn if bank is not enabled on setting irq type Santosh Shilimkar
2013-03-02 11:49   ` Felipe Balbi
2013-03-02 19:40   ` Grant Likely
2013-03-01 17:39 ` [PATCH 0/2] gpio/omap: updates for v3.10 Kevin Hilman
2013-03-01 22:52 ` Javier Martinez Canillas

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=1362158568-1624-3-git-send-email-jon-hunter@ti.com \
    --to=jon-hunter@ti.com \
    --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;
as well as URLs for NNTP newsgroup(s).