From: Wei Huang <wei@redhat.com>
To: qemu-arm@nongnu.org
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, afaerber@suse.de
Subject: [Qemu-trivial] [PATCH Trivial] hw/intc/arm_gic: Use pre-defined macro for cpu_num in code
Date: Thu, 5 Nov 2015 09:12:37 -0600 [thread overview]
Message-ID: <1446736357-17610-1-git-send-email-wei@redhat.com> (raw)
Given that there is a macro, NUM_CPU(s), defined for CPU number in
arm_gic.c, it is better to use it instead of using s->num_cpu in
this file. Code is more consistent after this change.
Signed-off-by: Wei Huang <wei@redhat.com>
---
hw/intc/arm_gic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 8bad132..4e7733c 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -39,7 +39,7 @@ static const uint8_t gic_id[] = {
static inline int gic_get_current_cpu(GICState *s)
{
- if (s->num_cpu > 1) {
+ if (NUM_CPU(s) > 1) {
return current_cpu->cpu_index;
}
return 0;
@@ -643,7 +643,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs)
res = gic_get_priority(s, cpu, irq, attrs);
} else if (offset < 0xc00) {
/* Interrupt CPU Target. */
- if (s->num_cpu == 1 && s->revision != REV_11MPCORE) {
+ if (NUM_CPU(s) == 1 && s->revision != REV_11MPCORE) {
/* For uniprocessor GICs these RAZ/WI */
res = 0;
} else {
@@ -863,7 +863,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
/* Interrupt CPU Target. RAZ/WI on uniprocessor GICs, with the
* annoying exception of the 11MPCore's GIC.
*/
- if (s->num_cpu != 1 || s->revision == REV_11MPCORE) {
+ if (NUM_CPU(s) != 1 || s->revision == REV_11MPCORE) {
irq = (offset - 0x800) + GIC_BASE_IRQ;
if (irq >= s->num_irq) {
goto bad_reg;
--
2.4.3
WARNING: multiple messages have this Message-ID (diff)
From: Wei Huang <wei@redhat.com>
To: qemu-arm@nongnu.org
Cc: qemu-trivial@nongnu.org, afaerber@suse.de
Subject: [Qemu-arm] [PATCH Trivial] hw/intc/arm_gic: Use pre-defined macro for cpu_num in code
Date: Thu, 5 Nov 2015 09:12:37 -0600 [thread overview]
Message-ID: <1446736357-17610-1-git-send-email-wei@redhat.com> (raw)
Given that there is a macro, NUM_CPU(s), defined for CPU number in
arm_gic.c, it is better to use it instead of using s->num_cpu in
this file. Code is more consistent after this change.
Signed-off-by: Wei Huang <wei@redhat.com>
---
hw/intc/arm_gic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 8bad132..4e7733c 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -39,7 +39,7 @@ static const uint8_t gic_id[] = {
static inline int gic_get_current_cpu(GICState *s)
{
- if (s->num_cpu > 1) {
+ if (NUM_CPU(s) > 1) {
return current_cpu->cpu_index;
}
return 0;
@@ -643,7 +643,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs)
res = gic_get_priority(s, cpu, irq, attrs);
} else if (offset < 0xc00) {
/* Interrupt CPU Target. */
- if (s->num_cpu == 1 && s->revision != REV_11MPCORE) {
+ if (NUM_CPU(s) == 1 && s->revision != REV_11MPCORE) {
/* For uniprocessor GICs these RAZ/WI */
res = 0;
} else {
@@ -863,7 +863,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
/* Interrupt CPU Target. RAZ/WI on uniprocessor GICs, with the
* annoying exception of the 11MPCore's GIC.
*/
- if (s->num_cpu != 1 || s->revision == REV_11MPCORE) {
+ if (NUM_CPU(s) != 1 || s->revision == REV_11MPCORE) {
irq = (offset - 0x800) + GIC_BASE_IRQ;
if (irq >= s->num_irq) {
goto bad_reg;
--
2.4.3
next reply other threads:[~2015-11-05 15:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-05 15:12 Wei Huang [this message]
2015-11-05 15:12 ` [Qemu-arm] [PATCH Trivial] hw/intc/arm_gic: Use pre-defined macro for cpu_num in code Wei Huang
2015-11-05 15:31 ` [Qemu-trivial] " Peter Maydell
2015-11-05 15:31 ` [Qemu-devel] " Peter Maydell
2015-11-05 16:55 ` [Qemu-trivial] " Wei Huang
2015-11-05 16:55 ` [Qemu-devel] " Wei Huang
2015-11-05 16:55 ` [Qemu-arm] " Wei Huang
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=1446736357-17610-1-git-send-email-wei@redhat.com \
--to=wei@redhat.com \
--cc=afaerber@suse.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-trivial@nongnu.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.