mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Kan <fkan@apm.com>
To: tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com,
	linux-kernel@vger.kernel.org, dann.frazier@canonical.com
Cc: Feng Kan <fkan@apm.com>
Subject: [PATCH] irqchip: gic: correct gic_set_type trigger acceptance criteria
Date: Thu, 21 Aug 2014 09:56:23 -0700	[thread overview]
Message-ID: <1408640183-8804-1-git-send-email-fkan@apm.com> (raw)

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


             reply	other threads:[~2014-08-21 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 16:56 Feng Kan [this message]
2014-08-22  8:23 ` Marc Zyngier

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=1408640183-8804-1-git-send-email-fkan@apm.com \
    --to=fkan@apm.com \
    --cc=dann.frazier@canonical.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    /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®