public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip: gic: correct gic_set_type trigger acceptance criteria
@ 2014-08-21 16:56 Feng Kan
  2014-08-22  8:23 ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Feng Kan @ 2014-08-21 16:56 UTC (permalink / raw)
  To: tglx, jason, marc.zyngier, linux-kernel, dann.frazier; +Cc: Feng Kan

GIC is designed to support two types of trigger mechanism. Either active level
high or edge rising.

static int gic_set_type(struct irq_data *d, unsigned int type)
{
	...
        if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
                return -EINVAL;

However, this cause problem with requesting driver uses combo selections to tie
down trigger mechanism. In below case gpio_keys_setup_key tries to use either
rising or falling edge trigger, but accidently cause a false positive in the
gic code.

static int gpio_keys_setup_key(struct platform_device *pdev,
{
                irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;

This patch fixes this problem by filter the selection type first.

Signed-off-by: Feng Kan <fkan@apm.com>
---
 drivers/irqchip/irq-gic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index c31eea4..bea167e 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -194,6 +194,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
 	if (gicirq < 16)
 		return -EINVAL;
 
+	type &= IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING;
 	if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
 		return -EINVAL;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-22  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 16:56 [PATCH] irqchip: gic: correct gic_set_type trigger acceptance criteria Feng Kan
2014-08-22  8:23 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox