From: Gonglei <arei.gong...@huawei.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> --- hw/isa/piix4.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d9522b1..2c59e91 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -34,6 +34,10 @@ typedef struct PIIX4State { PCIDevice dev; } PIIX4State; +#define TYPE_PIIX4_PCI_DEVICE "PIIX4" +#define PIIX4_PCI_DEVICE(obj) \ + OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) + static void piix4_reset(void *opaque) { PIIX4State *d = opaque; @@ -84,7 +88,7 @@ static const VMStateDescription vmstate_piix4 = { static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev); + PIIX4State *d = PIIX4_PCI_DEVICE(dev); isa_bus_new(DEVICE(d), pci_address_space(dev), pci_address_space_io(dev)); @@ -121,7 +125,7 @@ static void piix4_class_init(ObjectClass *klass, void *data) } static const TypeInfo piix4_info = { - .name = "PIIX4", + .name = TYPE_PIIX4_PCI_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIX4State), .class_init = piix4_class_init, -- 1.7.12.4