linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ming.lei@canonical.com (ming.lei at canonical.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 3/7] arm: perf: support device with other non-irq resources
Date: Mon, 24 Oct 2011 22:45:55 +0800	[thread overview]
Message-ID: <1319467559-5518-4-git-send-email-ming.lei@canonical.com> (raw)
In-Reply-To: <1319467559-5518-1-git-send-email-ming.lei@canonical.com>

From: Ming Lei <ming.lei@canonical.com>

omap4 may create device via hwmod, which can create resources
automatically, so may include some non-irq resources.

This patch supports device with other non-irq resources.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 arch/arm/kernel/perf_event.c |    5 +++--
 arch/arm/kernel/pmu.c        |   12 ++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index f367780..d91dba2 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -19,6 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/uaccess.h>
+#include <linux/cpumask.h>
 
 #include <asm/cputype.h>
 #include <asm/irq.h>
@@ -414,7 +415,7 @@ armpmu_reserve_hardware(void)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < pmu_device->num_resources; ++i) {
+	for (i = 0; i < nr_cpu_ids; ++i) {
 		irq = platform_get_irq(pmu_device, i);
 		if (irq < 0)
 			continue;
@@ -453,7 +454,7 @@ armpmu_release_hardware(void)
 	struct arm_pmu_platdata *plat =
 		dev_get_platdata(&pmu_device->dev);
 
-	for (i = pmu_device->num_resources - 1; i >= 0; --i) {
+	for (i = nr_cpu_ids - 1; i >= 0; --i) {
 		irq = platform_get_irq(pmu_device, i);
 		if (irq >= 0) {
 			if (plat && plat->disable_irq)
diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c
index c53474f..0e9c908 100644
--- a/arch/arm/kernel/pmu.c
+++ b/arch/arm/kernel/pmu.c
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/cpumask.h>
 
 #include <asm/pmu.h>
 
@@ -172,8 +173,15 @@ init_cpu_pmu(void)
 	if (irqs == 1 && !irq_can_set_affinity(platform_get_irq(pdev, 0)))
 		return 0;
 
-	for (i = 0; i < irqs; ++i) {
-		err = set_irq_affinity(platform_get_irq(pdev, i), i);
+	for (i = 0; i < nr_cpu_ids; ++i) {
+		int irq;
+
+		irq = platform_get_irq(pdev, i);
+
+		if (irq < 0)
+			continue;
+
+		err = set_irq_affinity(irq, i);
 		if (err)
 			break;
 	}
-- 
1.7.5.4

  parent reply	other threads:[~2011-10-24 14:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 14:45 [PATCH v5 0/7] arm: pmu: support pmu/perf on OMAP4 ming.lei at canonical.com
2011-10-24 14:45 ` [PATCH v5 1/7] arm: introduce cross trigger interface helpers ming.lei at canonical.com
2011-10-24 14:45 ` [PATCH v5 2/7] arm: pmu: allow platform specific irq enable/disable handling ming.lei at canonical.com
2011-11-01  3:26   ` Ming Lei
2011-11-01 12:52     ` Will Deacon
2011-10-24 14:45 ` ming.lei at canonical.com [this message]
2011-10-24 15:08   ` [PATCH v5 3/7] arm: perf: support device with other non-irq resources Will Deacon
2011-10-25  1:09     ` Ming Lei
2011-10-25  8:34       ` Will Deacon
2011-10-25  8:44         ` Paul Walmsley
2011-10-25 10:23           ` Ming Lei
2011-10-25 11:00             ` Paul Walmsley
2011-11-08  9:25               ` Ming Lei
2011-11-08 12:17                 ` Will Deacon
2011-10-24 14:45 ` [PATCH v5 4/7] arm: omap4: hwmod: introduce emu hwmod ming.lei at canonical.com
2011-11-08 15:26   ` Paul Walmsley
2011-11-09  9:56     ` Ming Lei
2011-11-10  9:02       ` Paul Walmsley
2011-11-11 11:41         ` Will Deacon
2011-11-11 11:47           ` Jamie Iles
2011-11-11 11:59             ` Will Deacon
2011-11-11 14:56             ` Cousson, Benoit
2011-11-11 14:58               ` Will Deacon
2011-11-11 15:12                 ` Cousson, Benoit
2011-11-11 15:22                   ` Will Deacon
2011-11-18 12:58         ` Cousson, Benoit
2011-11-18 14:56           ` Will Deacon
2011-11-19 14:42             ` Ming Lei
2011-11-20  3:27               ` Paul Walmsley
2011-11-21 13:58                 ` Will Deacon
2011-11-21 14:53                   ` Ming Lei
2011-11-21 15:16                     ` Will Deacon
2011-11-21 15:30                       ` Ming Lei
2011-11-19 14:37           ` Ming Lei
2011-11-27  1:58           ` Paul Walmsley
2011-11-27  2:07             ` Paul Walmsley
2011-11-29 16:19               ` Cousson, Benoit
2011-11-29 18:11                 ` Paul Walmsley
2011-11-30 16:20                   ` Cousson, Benoit
2011-11-08 15:42   ` Paul Walmsley
2011-11-09 11:33     ` Ming Lei
2011-10-24 14:45 ` [PATCH v5 5/7] arm: omap4: create pmu device via hwmod ming.lei at canonical.com
2011-10-24 14:45 ` [PATCH v5 6/7] arm: omap4: support pmu ming.lei at canonical.com
2011-11-23 17:47   ` Rabin Vincent
2011-11-25  0:37     ` Ming Lei
2011-10-24 14:45 ` [PATCH v5 7/7] arm: omap4: pmu: support runtime pm ming.lei at canonical.com

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=1319467559-5518-4-git-send-email-ming.lei@canonical.com \
    --to=ming.lei@canonical.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 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).