public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org, Kevin Hilman <khilman@mvista.com>,
	Tony Lindgren <tony@atomide.com>
Subject: [PATCH 6/14] ARM: OMAP: use edge/level handlers from generic IRQ framework
Date: Mon, 17 Mar 2008 11:42:30 +0200	[thread overview]
Message-ID: <1205746958-11242-7-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1205746958-11242-6-git-send-email-tony@atomide.com>

From: Kevin Hilman <khilman@mvista.com>

Currently, the GPIO interrupt handling is duplicating some of the work
done by the generic IRQ handlers (handle_edge_irq, handle_level_irq)
such as detecting nesting, handling re-triggers etc.  Remove this
duplication and use generic hooks based on IRQ type.

Using generic IRQ handlers ensures correct behavior when using
threaded interrupts introduced by the -rt patch.

Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/gpio.c |   42 +++++++-----------------------------------
 1 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 4f104e4..1903a34 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -542,10 +542,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
 	bank->level_mask =
 		__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
 		__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
-	/*
-	 * FIXME: Possibly do 'set_irq_handler(j, handle_level_irq)' if only
-	 * level triggering requested.
-	 */
 }
 #endif
 
@@ -656,6 +652,12 @@ static int gpio_irq_type(unsigned irq, unsigned type)
 		irq_desc[irq].status |= type;
 	}
 	spin_unlock_irqrestore(&bank->lock, flags);
+
+	if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
+		__set_irq_handler_unlocked(irq, handle_level_irq);
+	else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
+		__set_irq_handler_unlocked(irq, handle_edge_irq);
+
 	return retval;
 }
 
@@ -1050,42 +1052,12 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 		gpio_irq = bank->virtual_irq_start;
 		for (; isr != 0; isr >>= 1, gpio_irq++) {
 			struct irq_desc *d;
-			int irq_mask;
+
 			if (!(isr & 1))
 				continue;
 			d = irq_desc + gpio_irq;
-			/* Don't run the handler if it's already running
-			 * or was disabled lazely.
-			 */
-			if (unlikely((d->depth ||
-				      (d->status & IRQ_INPROGRESS)))) {
-				irq_mask = 1 <<
-					(gpio_irq - bank->virtual_irq_start);
-				/* The unmasking will be done by
-				 * enable_irq in case it is disabled or
-				 * after returning from the handler if
-				 * it's already running.
-				 */
-				_enable_gpio_irqbank(bank, irq_mask, 0);
-				if (!d->depth) {
-					/* Level triggered interrupts
-					 * won't ever be reentered
-					 */
-					BUG_ON(level_mask & irq_mask);
-					d->status |= IRQ_PENDING;
-				}
-				continue;
-			}
 
 			desc_handle_irq(gpio_irq, d);
-
-			if (unlikely((d->status & IRQ_PENDING) && !d->depth)) {
-				irq_mask = 1 <<
-					(gpio_irq - bank->virtual_irq_start);
-				d->status &= ~IRQ_PENDING;
-				_enable_gpio_irqbank(bank, irq_mask, 1);
-				retrigger |= irq_mask;
-			}
 		}
 	}
 	/* if bank has any level sensitive GPIO pin interrupt
-- 
1.5.3.6


  reply	other threads:[~2008-03-17  9:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17  9:42 [PATCH 0/14] Omap patches for post 2.6.25 Tony Lindgren
2008-03-17  9:42 ` [PATCH 1/14] ARM: OMAP: Use gpiolib Tony Lindgren
2008-03-17  9:42   ` [PATCH 2/14] ARM: OMAP: 5912 OSK GPIO updates Tony Lindgren
2008-03-17  9:42     ` [PATCH 3/14] ARM: OMAP: I2C: tps65010 driver converts to gpiolib Tony Lindgren
2008-03-17  9:42       ` [PATCH 4/14] ARM: OMAP: Use gpiolib with tps65010 for OSK 5912 Tony Lindgren
2008-03-17  9:42         ` [PATCH 5/14] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook Tony Lindgren
2008-03-17  9:42           ` Tony Lindgren [this message]
2008-03-17  9:42             ` [PATCH 7/14] ARM: OMAP: Allow registering pin mux function Tony Lindgren
2008-03-17  9:42               ` [PATCH 8/14] ARM: OMAP: Split omap_cfg_reg() into omap processor specific functions Tony Lindgren
2008-03-17  9:42                 ` [PATCH 9/14] ARM: OMAP: Timer32K: Re-organize duplicated 32k-timer code Tony Lindgren
2008-03-17  9:42                   ` [PATCH 10/14] ARM: OMAP: Timer32K: Move 32k-based sched_clock() to common code Tony Lindgren
2008-03-17  9:42                     ` [PATCH 11/14] ARM: OMAP: Timer32K: Move timer32k to mach-omap1 Tony Lindgren
2008-03-17  9:42                       ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up Tony Lindgren
2008-03-17  9:42                         ` [PATCH 13/14] ARM: OMAP: TimerMPU: Remove unused cycles-to-nsec conversions Tony Lindgren
2008-03-17  9:42                           ` [PATCH 14/14] ARM: OMAP: TimerMPU: Remove MPU-timer based sched_clock() Tony Lindgren
2008-03-20 16:52                         ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up Russell King - ARM Linux
2008-03-20 18:25                           ` Kevin Hilman
2008-03-21 11:38                             ` Thomas Gleixner
2008-03-21 12:04                             ` Russell King - ARM Linux
2008-03-25 10:09                               ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up, take #2 Tony Lindgren
2008-03-25 22:16                                 ` Russell King - ARM Linux
2008-03-28 12:26                                   ` Tony Lindgren

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=1205746958-11242-7-git-send-email-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=khilman@mvista.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.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