mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Janakiram Sistla <janakiram.sistla@gmail.com>
To: Rodolfo Giometti <giometti@linux.it>
Cc: linux-kernel@vger.kernel.org,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	raffaele.recalcati@bticino.it
Subject: Re: [PATCH] gpio: show IRQ settings even if GPIO direction is  "output"
Date: Tue, 17 Nov 2009 17:15:49 +0530	[thread overview]
Message-ID: <4fb5db50911170345m687ea1fcmff1444250d341240@mail.gmail.com> (raw)
In-Reply-To: <1258457469-16145-1-git-send-email-giometti@linux.it>

On Tue, Nov 17, 2009 at 5:01 PM, Rodolfo Giometti <giometti@linux.it> wrote:> Some architectures (as PXA 27x for example) may define GPIO IRQ lines> as outputs since internal circuitry supports such configuration.>> This patch simply detects if a GPIO is a IRQ line or not just looking> for IRQ line number, "desc" and "desc->action" fields.>> Signed-off-by: Rodolfo Giometti <giometti@linux.it>> Cc: raffaele.recalcati@bticino.it> --->  drivers/gpio/gpiolib.c |   82 ++++++++++++++++++++++++------------------------>  1 files changed, 41 insertions(+), 41 deletions(-)>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c> index 50de0f5..298b66f 100644> --- a/drivers/gpio/gpiolib.c> +++ b/drivers/gpio/gpiolib.c> @@ -1381,6 +1381,8 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)>        unsigned                gpio = chip->base;>        struct gpio_desc        *gdesc = &gpio_desc[gpio];>        int                     is_out;> +       int                     irq;> +       struct irq_desc         *desc;>>        for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) {>                if (!test_bit(FLAG_REQUESTED, &gdesc->flags))> @@ -1394,48 +1396,46 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)>                                ? (chip->get(chip, i) ? "hi" : "lo")>                                : "?  ");>> -               if (!is_out) {> -                       int             irq = gpio_to_irq(gpio);> -                       struct irq_desc *desc = irq_to_desc(irq);> -> -                       /* This races with request_irq(), set_irq_type(),> -                        * and set_irq_wake() ... but those are "rare".> -                        *> -                        * More significantly, trigger type flags aren't> -                        * currently maintained by genirq.> -                        */> -                       if (irq >= 0 && desc->action) {> -                               char *trigger;> -> -                               switch (desc->status & IRQ_TYPE_SENSE_MASK) {> -                               case IRQ_TYPE_NONE:> -                                       trigger = "(default)";> -                                       break;> -                               case IRQ_TYPE_EDGE_FALLING:> -                                       trigger = "edge-falling";> -                                       break;> -                               case IRQ_TYPE_EDGE_RISING:> -                                       trigger = "edge-rising";> -                                       break;> -                               case IRQ_TYPE_EDGE_BOTH:> -                                       trigger = "edge-both";> -                                       break;> -                               case IRQ_TYPE_LEVEL_HIGH:> -                                       trigger = "level-high";> -                                       break;> -                               case IRQ_TYPE_LEVEL_LOW:> -                                       trigger = "level-low";> -                                       break;> -                               default:> -                                       trigger = "?trigger?";> -                                       break;> -                               }> -> -                               seq_printf(s, " irq-%d %s%s",> -                                       irq, trigger,> -                                       (desc->status & IRQ_WAKEUP)> -                                               ? " wakeup" : "");> +               irq = gpio_to_irq(gpio);> +               desc = irq_to_desc(irq);> +> +               /* This races with request_irq(), set_irq_type(),> +                * and set_irq_wake() ... but those are "rare".> +                *> +                * More significantly, trigger type flags aren't> +                * currently maintained by genirq.> +                */> +               if (irq >= 0 && desc && desc->action) {> +                       char *trigger;> +> +                       switch (desc->status & IRQ_TYPE_SENSE_MASK) {> +                       case IRQ_TYPE_NONE:> +                               trigger = "(default)";> +                               break;> +                       case IRQ_TYPE_EDGE_FALLING:> +                               trigger = "edge-falling";> +                               break;> +                       case IRQ_TYPE_EDGE_RISING:> +                               trigger = "edge-rising";> +                               break;> +                       case IRQ_TYPE_EDGE_BOTH:> +                               trigger = "edge-both";> +                               break;> +                       case IRQ_TYPE_LEVEL_HIGH:> +                               trigger = "level-high";> +                               break;> +                       case IRQ_TYPE_LEVEL_LOW:> +                               trigger = "level-low";> +                               break;> +                       default:> +                               trigger = "?trigger?";> +                               break;>                        }> +> +                       seq_printf(s, " irq-%d %s%s",> +                               irq, trigger,> +                               (desc->status & IRQ_WAKEUP)> +                                       ? " wakeup" : "");>                }>>                seq_printf(s, "\n");> --> 1.6.3.3
Is there any valid test scenario that makes use of thispatch???Detecting GPIO if it is IRQ in kernel what is the advantage?

Regards,Ram.ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2009-11-17 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17 11:31 Rodolfo Giometti
2009-11-17 11:45 ` Janakiram Sistla [this message]
2009-11-17 12:10   ` Rodolfo Giometti

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=4fb5db50911170345m687ea1fcmff1444250d341240@mail.gmail.com \
    --to=janakiram.sistla@gmail.com \
    --cc=giometti@linux.it \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raffaele.recalcati@bticino.it \
    /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®