aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-24 23:48:30 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:06:37 +0200
commit8df81c4b11f19eae16b88d5da3ab85704d49e6b0 (patch)
tree27c1de1b3058772884b8a87e60ed6dd52e7f2032 /hw/core
parent71ffe1a01faa90fa08805e8030120b3be0efda25 (diff)
empty_slot: QOM cast cleanup
Introduce type constant and use QOM casts. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/empty_slot.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c
index e6249912c5..612b1093aa 100644
--- a/hw/core/empty_slot.c
+++ b/hw/core/empty_slot.c
@@ -22,8 +22,12 @@
#define DPRINTF(fmt, ...) do {} while (0)
#endif
+#define TYPE_EMPTY_SLOT "empty_slot"
+#define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT)
+
typedef struct EmptySlot {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
uint64_t size;
} EmptySlot;
@@ -55,9 +59,9 @@ void empty_slot_init(hwaddr addr, uint64_t slot_size)
SysBusDevice *s;
EmptySlot *e;
- dev = qdev_create(NULL, "empty_slot");
+ dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
s = SYS_BUS_DEVICE(dev);
- e = FROM_SYSBUS(EmptySlot, s);
+ e = EMPTY_SLOT(dev);
e->size = slot_size;
qdev_init_nofail(dev);
@@ -68,7 +72,7 @@ void empty_slot_init(hwaddr addr, uint64_t slot_size)
static int empty_slot_init1(SysBusDevice *dev)
{
- EmptySlot *s = FROM_SYSBUS(EmptySlot, dev);
+ EmptySlot *s = EMPTY_SLOT(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
"empty-slot", s->size);
@@ -84,7 +88,7 @@ static void empty_slot_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo empty_slot_info = {
- .name = "empty_slot",
+ .name = TYPE_EMPTY_SLOT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(EmptySlot),
.class_init = empty_slot_class_init,