xen-pvdevice: convert to realize()
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
parent
37aa7a0e2f
commit
c6b14aed77
|
@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
|
||||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int xen_pv_init(PCIDevice *pci_dev)
|
static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
|
||||||
{
|
{
|
||||||
XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
|
XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
|
||||||
uint8_t *pci_conf;
|
uint8_t *pci_conf;
|
||||||
|
|
||||||
/* device-id property must always be supplied */
|
/* device-id property must always be supplied */
|
||||||
if (d->device_id == 0xffff)
|
if (d->device_id == 0xffff) {
|
||||||
return -1;
|
error_setg(errp, "Device ID invalid, it must always be supplied");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pci_conf = pci_dev->config;
|
pci_conf = pci_dev->config;
|
||||||
|
|
||||||
|
@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)
|
||||||
|
|
||||||
pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
|
pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
|
||||||
&d->mmio);
|
&d->mmio);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property xen_pv_props[] = {
|
static Property xen_pv_props[] = {
|
||||||
|
@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void *data)
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = xen_pv_init;
|
k->realize = xen_pv_realize;
|
||||||
k->class_id = PCI_CLASS_SYSTEM_OTHER;
|
k->class_id = PCI_CLASS_SYSTEM_OTHER;
|
||||||
dc->desc = "Xen PV Device";
|
dc->desc = "Xen PV Device";
|
||||||
dc->props = xen_pv_props;
|
dc->props = xen_pv_props;
|
||||||
|
|
Loading…
Reference in a new issue