From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuOHV-0000qp-1O for qemu-devel@nongnu.org; Thu, 05 Nov 2015 12:25:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuOHU-0006sZ-36 for qemu-devel@nongnu.org; Thu, 05 Nov 2015 12:25:01 -0500 From: Wei Huang Date: Thu, 5 Nov 2015 11:24:53 -0600 Message-Id: <1446744293-32365-1-git-send-email-wei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH Trivial V2] hw/intc/arm_gic: Remove the definition of NUM_CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-arm@nongnu.org Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, afaerber@suse.de, qemu-devel@nongnu.org arm_gic.c retrieves CPU number using either NUM_CPU(s) or s->num_cpu. Such mixed-uses make source code inconsistent. This patch removes NUM_CPU(s), which was defined for MPCore tweak long ago, and instead favors s->num_cpu. The source is more consistent after this small tweak. Reviewed-by: Andreas F=C3=A4rber Signed-off-by: Wei Huang --- hw/intc/arm_gic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 8bad132..d71aeb8 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -35,8 +35,6 @@ static const uint8_t gic_id[] =3D { 0x90, 0x13, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; =20 -#define NUM_CPU(s) ((s)->num_cpu) - static inline int gic_get_current_cpu(GICState *s) { if (s->num_cpu > 1) { @@ -64,7 +62,7 @@ void gic_update(GICState *s) int cpu; int cm; =20 - for (cpu =3D 0; cpu < NUM_CPU(s); cpu++) { + for (cpu =3D 0; cpu < s->num_cpu; cpu++) { cm =3D 1 << cpu; s->current_pending[cpu] =3D 1023; if (!(s->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1)) @@ -567,7 +565,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr o= ffset, MemTxAttrs attrs) if (offset =3D=3D 4) /* Interrupt Controller Type Register */ return ((s->num_irq / 32) - 1) - | ((NUM_CPU(s) - 1) << 5) + | ((s->num_cpu - 1) << 5) | (s->security_extn << 10); if (offset < 0x08) return 0; @@ -1284,7 +1282,7 @@ static void arm_gic_realize(DeviceState *dev, Error= **errp) * GIC v2 defines a larger memory region (0x1000) so this will need * to be extended when we implement A15. */ - for (i =3D 0; i < NUM_CPU(s); i++) { + for (i =3D 0; i < s->num_cpu; i++) { s->backref[i] =3D s; memory_region_init_io(&s->cpuiomem[i+1], OBJECT(s), &gic_cpu_ops= , &s->backref[i], "gic_cpu", 0x100); --=20 2.4.3