[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 01/16] cpu/a9mpcore: QOM casting cleanup
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH v2 01/16] cpu/a9mpcore: QOM casting cleanup |
Date: |
Tue, 23 Jul 2013 04:43:09 +0200 |
From: Andreas Färber <address@hidden>
Introduce type constant and cast macro and enforce its use by
renaming A9MPPrivState::busdev field to parent_obj.
Reviewed-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/cpu/a9mpcore.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
index 6c00a59..3e675e3 100644
--- a/hw/cpu/a9mpcore.c
+++ b/hw/cpu/a9mpcore.c
@@ -10,8 +10,15 @@
#include "hw/sysbus.h"
+#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
+#define A9MPCORE_PRIV(obj) \
+ OBJECT_CHECK(A9MPPrivState, (obj), TYPE_A9MPCORE_PRIV)
+
typedef struct A9MPPrivState {
- SysBusDevice busdev;
+ /*< private >*/
+ SysBusDevice parent_obj;
+ /*< public >*/
+
uint32_t num_cpu;
MemoryRegion container;
DeviceState *mptimer;
@@ -29,7 +36,7 @@ static void a9mp_priv_set_irq(void *opaque, int irq, int
level)
static int a9mp_priv_init(SysBusDevice *dev)
{
- A9MPPrivState *s = FROM_SYSBUS(A9MPPrivState, dev);
+ A9MPPrivState *s = A9MPCORE_PRIV(dev);
SysBusDevice *timerbusdev, *wdtbusdev, *gicbusdev, *scubusdev;
int i;
@@ -43,7 +50,7 @@ static int a9mp_priv_init(SysBusDevice *dev)
sysbus_pass_irq(dev, gicbusdev);
/* Pass through inbound GPIO lines to the GIC */
- qdev_init_gpio_in(&s->busdev.qdev, a9mp_priv_set_irq, s->num_irq - 32);
+ qdev_init_gpio_in(DEVICE(dev), a9mp_priv_set_irq, s->num_irq - 32);
s->scu = qdev_create(NULL, "a9-scu");
qdev_prop_set_uint32(s->scu, "num-cpu", s->num_cpu);
@@ -124,7 +131,7 @@ static void a9mp_priv_class_init(ObjectClass *klass, void
*data)
}
static const TypeInfo a9mp_priv_info = {
- .name = "a9mpcore_priv",
+ .name = TYPE_A9MPCORE_PRIV,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(A9MPPrivState),
.class_init = a9mp_priv_class_init,
--
1.8.1.4
- [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 02/16] cpu/a9mpcore: Split off instance_init, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 01/16] cpu/a9mpcore: QOM casting cleanup,
Andreas Färber <=
- [Qemu-devel] [PATCH v2 04/16] cpu/a9mpcore: Embed GICState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 08/16] timer/arm_mptimer: Convert to QOM realize, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 05/16] misc/a9scu: QOM cleanups, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 07/16] timer/arm_mptimer: QOM cast cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 06/16] cpu/a9mpcore: Embed A9SCUState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 03/16] intc/arm_gic: Extract public header hw/intc/arm_gic.h, Andreas Färber, 2013/07/22