* [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() @ 2007-12-11 22:54 Kevin Hilman 2007-12-12 10:24 ` Ingo Molnar 0 siblings, 1 reply; 4+ messages in thread From: Kevin Hilman @ 2007-12-11 22:54 UTC (permalink / raw) To: linux-kernel; +Cc: Thomas Gleixner, Ingo Molnar, Kevin Hilman Add unlocked version for use by irq_chip.set_type handlers which may wish to change handler to level or edge handler when IRQ type is changed. The normal set_irq_handler() call cannot be used because it tries to take irq_desc.lock which is already held when the irq_chip.set_type hook is called. Signed-off-by: Kevin Hilman <khilman@mvista.com> --- include/linux/irq.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index efc8853..4669be0 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -339,6 +339,13 @@ extern void __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, const char *name); +/* caller has locked the irq_desc and both params are valid */ +static inline void __set_irq_handler_unlocked(int irq, + irq_flow_handler_t handler) +{ + irq_desc[irq].handle_irq = handler; +} + /* * Set a highlevel flow handler for a given IRQ: */ -- 1.5.3.7 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() 2007-12-11 22:54 [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() Kevin Hilman @ 2007-12-12 10:24 ` Ingo Molnar 2007-12-12 15:14 ` Thomas Gleixner 0 siblings, 1 reply; 4+ messages in thread From: Ingo Molnar @ 2007-12-12 10:24 UTC (permalink / raw) To: Kevin Hilman; +Cc: linux-kernel, Thomas Gleixner * Kevin Hilman <khilman@mvista.com> wrote: > Add unlocked version for use by irq_chip.set_type handlers which may > wish to change handler to level or edge handler when IRQ type is > changed. > > The normal set_irq_handler() call cannot be used because it tries to > take irq_desc.lock which is already held when the irq_chip.set_type > hook is called. looks fine to me. Thomas? Ingo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() 2007-12-12 10:24 ` Ingo Molnar @ 2007-12-12 15:14 ` Thomas Gleixner 0 siblings, 0 replies; 4+ messages in thread From: Thomas Gleixner @ 2007-12-12 15:14 UTC (permalink / raw) To: Ingo Molnar; +Cc: Kevin Hilman, linux-kernel On Wed, 12 Dec 2007, Ingo Molnar wrote: > > * Kevin Hilman <khilman@mvista.com> wrote: > > > Add unlocked version for use by irq_chip.set_type handlers which may > > wish to change handler to level or edge handler when IRQ type is > > changed. > > > > The normal set_irq_handler() call cannot be used because it tries to > > take irq_desc.lock which is already held when the irq_chip.set_type > > hook is called. > > looks fine to me. Thomas? Acked-by: Thomas Gleixner <tglx@linutronix.de> ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH/RFC] OMAP GPIO IRQ rework for generic IRQ subsystem @ 2007-12-05 6:00 Kevin Hilman 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Fix GPIO IRQ unmask Kevin Hilman 0 siblings, 1 reply; 4+ messages in thread From: Kevin Hilman @ 2007-12-05 6:00 UTC (permalink / raw) To: linux-omap; +Cc: David Brownell, Russell King, Remy Bohmer, linux-rt-users This patchset aims to cleanup OMAP GPIO IRQ handling and use the generic IRQ framework where possible. In the process it fixes a couple bugs and enables correct behavior when GPIO IRQ handlers are threaded by the -rt patch. Tested on OMAP3430SDP and 2430SDP with and without -rt patch. Needs some testing on platforms using edge-triggered IRQs with and without IRQ patch. Comments welcome, Kevin ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: OMAP: Fix GPIO IRQ unmask 2007-12-05 6:00 [PATCH/RFC] OMAP GPIO IRQ rework for generic IRQ subsystem Kevin Hilman @ 2007-12-05 6:00 ` Kevin Hilman 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook Kevin Hilman 0 siblings, 1 reply; 4+ messages in thread From: Kevin Hilman @ 2007-12-05 6:00 UTC (permalink / raw) To: linux-omap Cc: David Brownell, Russell King, Remy Bohmer, linux-rt-users, Kevin Hilman GPIO IRQ unmask doesn't actually do anything useful. The problem is hidden by a separate explicit mass unmask at the end of the chained bank handler. Signed-off-by: Kevin Hilman <khilman@mvista.com> --- arch/arm/plat-omap/gpio.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 1640a37..f5a1ee5 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -1145,10 +1145,9 @@ static void gpio_mask_irq(unsigned int irq) static void gpio_unmask_irq(unsigned int irq) { unsigned int gpio = irq - IH_GPIO_BASE; - unsigned int gpio_idx = get_gpio_index(gpio); struct gpio_bank *bank = get_irq_chip_data(irq); - _set_gpio_irqenable(bank, gpio_idx, 1); + _set_gpio_irqenable(bank, gpio, 1); } static struct irq_chip gpio_irq_chip = { -- 1.5.3.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Fix GPIO IRQ unmask Kevin Hilman @ 2007-12-05 6:00 ` Kevin Hilman 2007-12-05 6:00 ` [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() Kevin Hilman 0 siblings, 1 reply; 4+ messages in thread From: Kevin Hilman @ 2007-12-05 6:00 UTC (permalink / raw) To: linux-omap Cc: David Brownell, Russell King, Remy Bohmer, linux-rt-users, Kevin Hilman The clearing was moved to the unmask hook because it is known to run after the interrupt handler has actually run. Before this patch, if interrupts were threaded, the clearing/unmasking of level triggered interrupts could be done before the threaded handler actually ran. Signed-off-by: Kevin Hilman <khilman@mvista.com> --- arch/arm/plat-omap/gpio.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index f5a1ee5..09fcd30 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -150,6 +150,7 @@ struct gpio_bank { u32 saved_fallingdetect; u32 saved_risingdetect; #endif + u32 level_mask; spinlock_t lock; }; @@ -519,6 +520,10 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, in else bank->enabled_non_wakeup_gpios &= ~gpio_bit; } + + 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. */ } @@ -1033,12 +1038,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) isr &= 0x0000ffff; if (cpu_class_is_omap2()) { - level_mask = - __raw_readl(bank->base + - OMAP24XX_GPIO_LEVELDETECT0) | - __raw_readl(bank->base + - OMAP24XX_GPIO_LEVELDETECT1); - level_mask &= enabled; + level_mask = bank->level_mask & enabled; } /* clear edge sensitive interrupts before handler(s) are @@ -1100,14 +1100,6 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) retrigger |= irq_mask; } } - - if (cpu_class_is_omap2()) { - /* clear level sensitive interrupts after handler(s) */ - _enable_gpio_irqbank(bank, isr_saved & level_mask, 0); - _clear_gpio_irqbank(bank, isr_saved & level_mask); - _enable_gpio_irqbank(bank, isr_saved & level_mask, 1); - } - } /* if bank has any level sensitive GPIO pin interrupt configured, we must unmask the bank interrupt only after @@ -1146,7 +1138,15 @@ static void gpio_unmask_irq(unsigned int irq) { unsigned int gpio = irq - IH_GPIO_BASE; struct gpio_bank *bank = get_irq_chip_data(irq); + unsigned int irq_mask = 1 << get_gpio_index(gpio); + /* For level-triggered GPIOs, the clearing must be done after + * the HW source is cleared, thus after the handler has run */ + if (bank->level_mask & irq_mask) { + _set_gpio_irqenable(bank, gpio, 0); + _clear_gpio_irqstatus(bank, gpio); + } + _set_gpio_irqenable(bank, gpio, 1); } -- 1.5.3.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook Kevin Hilman @ 2007-12-05 6:00 ` Kevin Hilman 0 siblings, 0 replies; 4+ messages in thread From: Kevin Hilman @ 2007-12-05 6:00 UTC (permalink / raw) To: linux-omap Cc: David Brownell, Russell King, Remy Bohmer, linux-rt-users, Kevin Hilman Add unlocked version for use by irq_chip.set_type handlers which may wish to change handler to level or edge handler when IRQ type is changed. The normal set_irq_handler() call cannot be used because it tries to take irq_desc.lock which is already held when the irq_chip.set_type hook is called. Signed-off-by: Kevin Hilman <khilman@mvista.com> --- include/linux/irq.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index 879ab83..2465709 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -347,6 +347,13 @@ extern void __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, const char *name); +/* caller has locked the irq_desc and both params are valid */ +static inline void __set_irq_handler_unlocked(int irq, + irq_flow_handler_t handler) +{ + irq_desc[irq].handle_irq = handler; +} + /* * Set a highlevel flow handler for a given IRQ: */ -- 1.5.3.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-12 15:15 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-11 22:54 [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() Kevin Hilman 2007-12-12 10:24 ` Ingo Molnar 2007-12-12 15:14 ` Thomas Gleixner -- strict thread matches above, loose matches on Subject: below -- 2007-12-05 6:00 [PATCH/RFC] OMAP GPIO IRQ rework for generic IRQ subsystem Kevin Hilman 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Fix GPIO IRQ unmask Kevin Hilman 2007-12-05 6:00 ` [PATCH] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook Kevin Hilman 2007-12-05 6:00 ` [PATCH] Generic IRQ: Add unlocked version of set_irq_handler() Kevin Hilman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.