linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler
Date: Wed, 28 Sep 2011 15:39:05 -0500	[thread overview]
Message-ID: <20110928203905.GB2838@ponder.secretlab.ca> (raw)
In-Reply-To: <1317206507-18867-3-git-send-email-jamie@jamieiles.com>

On Wed, Sep 28, 2011 at 11:41:39AM +0100, Jamie Iles wrote:
> Add a handler for the VIC that is suitable for MULTI_IRQ_HANDLER
> platforms.  This can replace the ASM entry macros for platforms that use
> the VIC.
> 
> v2:	- allow the handler be used for !CONFIG_OF
> 	- use irq_domain_to_irq()
> 
> Cc: Rob Herring <robherring2@gmail.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> ---
>  arch/arm/common/vic.c               |   29 +++++++++++++++++++++++++++++
>  arch/arm/include/asm/hardware/vic.h |    4 ++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
> index 3f9c8f2..71adced 100644
> --- a/arch/arm/common/vic.c
> +++ b/arch/arm/common/vic.c
> @@ -427,3 +427,32 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
>  	return -EIO;
>  }
>  #endif /* CONFIG OF */
> +
> +#ifdef CONFIG_MULTI_IRQ_HANDLER
> +static void vic_single_handle_irq(struct vic_device *vic, struct pt_regs *regs)
> +{
> +	u32 stat, irq;
> +	bool handled = false;
> +
> +	while (!handled) {
> +		stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> +		if (!stat)
> +			break;
> +
> +		while (stat) {
> +			irq = fls(stat) - 1;
> +			handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
> +			stat &= ~(1 << irq);
> +			handled = true;
> +		}
> +	}

I don't follow why this is written this way.  The way I see it, there
are two conditions:
1) first read will show no irqs pending (!stat), which will break out
   of the outer while() loop.

2) or there will be irqs pending, it will enter the second while()
   loop, which unconditionally sets the handled flag, and causes the
   outer loop to exit immediately after the inner loop exits.

Why isn't it simply written this way:

	stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
	while (stat) {
		irq = fls(stat) - 1;
		handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
		stat &= ~(1 << irq);
	}

g.

  parent reply	other threads:[~2011-09-28 20:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28 10:41 [PATCHv2 00/10] VIC DT binding and MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 10:41 ` [PATCHv2 01/10] ARM: vic: device tree binding Jamie Iles
2011-09-28 20:11   ` Grant Likely
2011-09-29  4:00   ` Rob Herring
2011-09-28 10:41 ` [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler Jamie Iles
2011-09-28 11:09   ` Linus Walleij
2011-09-28 12:08     ` Jamie Iles
2011-09-28 20:39   ` Grant Likely [this message]
2011-09-29  6:55     ` Linus Walleij
2011-09-29  9:30       ` Jamie Iles
2011-09-29 16:55         ` Grant Likely
2011-11-02 13:40         ` Russell King - ARM Linux
2011-11-02 14:08           ` Jamie Iles
2011-11-03 12:29             ` Linus Walleij
2011-11-03 12:51               ` Russell King - ARM Linux
2011-11-03 13:00                 ` Linus Walleij
2011-11-03 13:04                   ` Jamie Iles
2011-11-03 13:31                   ` Russell King - ARM Linux
2011-11-03 15:03                     ` Jamie Iles
2011-11-03 15:11                       ` Russell King - ARM Linux
2011-11-03 13:49                 ` Nicolas Pitre
2011-09-29 15:03   ` Zoltan Devai
2011-09-29 15:13     ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 03/10] ARM: ep93xx: convert to MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 11:15   ` Linus Walleij
2011-09-28 10:41 ` [PATCHv2 04/10] ARM: netx: " Jamie Iles
2011-09-28 10:41 ` [PATCHv2 05/10] ARM: nomadik: " Jamie Iles
2011-09-28 11:12   ` Linus Walleij
2011-09-28 10:41 ` [PATCHv2 06/10] ARM: s3c64xx: " Jamie Iles
2011-09-28 10:41 ` [PATCHv2 07/10] ARM: spear: " Jamie Iles
2011-09-28 10:41 ` [PATCHv2 08/10] ARM: u300: " Jamie Iles
2011-09-28 11:03   ` Linus Walleij
2011-09-28 12:03     ` Jamie Iles
2011-09-28 12:18       ` Linus Walleij
2011-09-28 12:29         ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 09/10] ARM: versatile: " Jamie Iles
2011-09-28 10:41 ` [PATCHv2 10/10] ARM: samsung: " Jamie Iles

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=20110928203905.GB2838@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).