From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC/RFT 3/6] ARM: vexpress: DCSCB: tighten CPU validity assertion
Date: Wed, 18 Mar 2015 14:04:50 -0400 [thread overview]
Message-ID: <1426701893-25589-4-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1426701893-25589-1-git-send-email-nicolas.pitre@linaro.org>
Currently the cpu argument validity check uses a hardcoded limit of 4.
The DCSCB configuration data provides the actual number of CPUs and
we already use it elsewhere. Let's improve the cpu argument validity
check by using that information instead.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
arch/arm/mach-vexpress/dcscb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c
index 30b993399e..12c74734cd 100644
--- a/arch/arm/mach-vexpress/dcscb.c
+++ b/arch/arm/mach-vexpress/dcscb.c
@@ -54,7 +54,7 @@ static int dcscb_power_up(unsigned int cpu, unsigned int cluster)
unsigned int all_mask;
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
- if (cpu >= 4 || cluster >= 2)
+ if (cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster]))
return -EINVAL;
all_mask = dcscb_allcpus_mask[cluster];
@@ -105,7 +105,7 @@ static void dcscb_power_down(void)
cpumask = (1 << cpu);
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
- BUG_ON(cpu >= 4 || cluster >= 2);
+ BUG_ON(cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster]));
all_mask = dcscb_allcpus_mask[cluster];
@@ -189,7 +189,7 @@ static void __init dcscb_usage_count_init(void)
cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
- BUG_ON(cpu >= 4 || cluster >= 2);
+ BUG_ON(cluster >= 2 || !((1 << cpu) & dcscb_allcpus_mask[cluster]));
dcscb_use_count[cpu][cluster] = 1;
}
--
2.1.0
next prev parent reply other threads:[~2015-03-18 18:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 18:04 [PATCH RFC/RFT 0/6] MCPM refactoring and major backend simplification Nicolas Pitre
2015-03-18 18:04 ` [PATCH RFC/RFT 1/6] MCPM: move the algorithmic complexity to the core code Nicolas Pitre
2015-03-18 18:04 ` [PATCH RFC/RFT 2/6] ARM: vexpress: migrate TC2 to the new MCPM backend abstraction Nicolas Pitre
2015-03-18 18:04 ` Nicolas Pitre [this message]
2015-03-18 18:04 ` [PATCH RFC/RFT 4/6] ARM: vexpress: migrate DCSCB " Nicolas Pitre
2015-03-18 18:04 ` [PATCH RFC/RFT 5/6] ARM: Exynos: " Nicolas Pitre
2015-03-24 23:24 ` Nicolas Pitre
2015-03-25 9:40 ` Daniel Lezcano
2015-03-25 16:02 ` Nicolas Pitre
2015-03-18 18:04 ` [PATCH RFC/RFT 6/6] ARM: hisi/hip04: remove the MCPM overhead Nicolas Pitre
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=1426701893-25589-4-git-send-email-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--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).