Revision 51a3fe99 hw/xen/xen_platform.c

b/hw/xen/xen_platform.c
62 62
    int log_buffer_off;
63 63
} PCIXenPlatformState;
64 64

  
65
#define TYPE_XEN_PLATFORM "xen-platform"
66
#define XEN_PLATFORM(obj) \
67
    OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM)
68

  
65 69
#define XEN_PLATFORM_IOPORT 0x10
66 70

  
67 71
/* Send bytes to syslog */
......
88 92
    if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
89 93
            PCI_CLASS_NETWORK_ETHERNET
90 94
            && strcmp(d->name, "xen-pci-passthrough") != 0) {
91
        qdev_free(&d->qdev);
95
        qdev_free(DEVICE(d));
92 96
    }
93 97
}
94 98

  
......
103 107
    if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
104 108
            PCI_CLASS_STORAGE_IDE
105 109
            && strcmp(d->name, "xen-pci-passthrough") != 0) {
106
        qdev_unplug(&(d->qdev), NULL);
110
        qdev_unplug(DEVICE(d), NULL);
107 111
    }
108 112
}
109 113

  
......
376 380

  
377 381
static int xen_platform_initfn(PCIDevice *dev)
378 382
{
379
    PCIXenPlatformState *d = DO_UPCAST(PCIXenPlatformState, pci_dev, dev);
383
    PCIXenPlatformState *d = XEN_PLATFORM(dev);
380 384
    uint8_t *pci_conf;
381 385

  
382 386
    pci_conf = d->pci_dev.config;
......
402 406

  
403 407
static void platform_reset(DeviceState *dev)
404 408
{
405
    PCIXenPlatformState *s = DO_UPCAST(PCIXenPlatformState, pci_dev.qdev, dev);
409
    PCIXenPlatformState *s = XEN_PLATFORM(dev);
406 410

  
407 411
    platform_fixed_ioport_reset(s);
408 412
}
......
425 429
}
426 430

  
427 431
static const TypeInfo xen_platform_info = {
428
    .name          = "xen-platform",
432
    .name          = TYPE_XEN_PLATFORM,
429 433
    .parent        = TYPE_PCI_DEVICE,
430 434
    .instance_size = sizeof(PCIXenPlatformState),
431 435
    .class_init    = xen_platform_class_init,

Also available in: Unified diff