All of lore.kernel.org
 help / color / mirror / Atom feed
From: jamie.iles@picochip.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] ARM: pmu: register IRQs at runtime
Date: Thu, 25 Mar 2010 15:36:52 +0000	[thread overview]
Message-ID: <20100325153652.GL8118@wear.picochip.com> (raw)
In-Reply-To: <1269530198-19572-2-git-send-email-will.deacon@arm.com>

On Thu, Mar 25, 2010 at 03:16:33PM +0000, Will Deacon wrote:
> The current PMU infrastructure for ARM requires that the IRQs for the PMU
> device are fixed at compile time and are selected based on the ARCH_ or MACH_
> flags. This has the disadvantage of tying the Kernel down to a particular board
> as far as profiling is concerned.
> 
> This patch replaces the compile-time IRQ registration with a runtime mechanism
> which allows the IRQs to be registered with the framework as a platform_device.
> 
> A further advantage of this change is that there is scope for registering
> different types of performance counters in the future by changing the id of
> the platform_device and attaching different resources to it.
> 
> Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> Cc: Jamie Iles <jamie.iles@picochip.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
[snip]
> -	for (i = 0; i < pmu_irqs->num_irqs; ++i) {
> -		err = request_irq(pmu_irqs->irqs[i], armpmu->handle_irq,
> +	for (i = 0; i < pmu_device->num_resources; ++i) {
> +		err = request_irq(platform_get_irq(pmu_device, i),
> +				  armpmu->handle_irq,
>  				  IRQF_DISABLED | IRQF_NOBALANCING,
>  				  "armpmu", NULL);
[snip]
> @@ -356,12 +358,12 @@ armpmu_release_hardware(void)
>  {
>  	int i;
>  
> -	for (i = pmu_irqs->num_irqs - 1; i >= 0; --i)
> -		free_irq(pmu_irqs->irqs[i], NULL);
> +	for (i = pmu_device->num_resources - 1; i >= 0; --i)
> +		free_irq(platform_get_irq(pmu_device, i), NULL);
Hi Will,

This looks fine at the moment as all PMU's only have IRQ resources but if we
ever have any with memory resources then we'll need to check the return value
of platform_get_irq() to make sure that the resource is a valid IRQ. Apologies
for not spotting it before! If we had:

	int irq = platform_get_irq(pmu_device, i);
	if (irq < 0)
		continue;

or something similar to be a bit future proof then I'm happy with that and:

Acked-by: Jamie Iles <jamie.iles@picochip.com>

Jamie

  parent reply	other threads:[~2010-03-25 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 15:16 [PATCH 0/6] ARM: pmu: provide a registration mechanism for IRQs [v3] Will Deacon
2010-03-25 15:16 ` [PATCH 1/6] ARM: pmu: register IRQs at runtime Will Deacon
2010-03-25 15:16   ` [PATCH 2/6] ARM: Realview: register PMU IRQs during board initialisation Will Deacon
2010-03-25 15:16     ` [PATCH 3/6] ARM: OMAP: " Will Deacon
2010-03-25 15:16       ` [PATCH 4/6] ARM: BCMRING: register PMU IRQ " Will Deacon
2010-03-25 15:16         ` [PATCH 5/6] ARM: iop3xx: register PMU IRQs " Will Deacon
2010-03-25 15:16           ` [PATCH 6/6] ARM: pxa: " Will Deacon
2010-03-25 17:35         ` [PATCH 4/6] ARM: BCMRING: register PMU IRQ " Leo (Hao) Chen
2010-03-25 15:36   ` Jamie Iles [this message]
2010-04-28 21:36 ` [PATCH 0/6] ARM: pmu: provide a registration mechanism for IRQs [v3] Russell King - ARM Linux
2010-04-29 16:04   ` Will Deacon
2010-04-29 16:05     ` Russell King - ARM Linux
2010-04-29 16:15       ` Will Deacon

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=20100325153652.GL8118@wear.picochip.com \
    --to=jamie.iles@picochip.com \
    --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 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.