/* virtio-touchscreen-pci */
static Property virtio_touchscreen_pci_properties[] = {
- DEFINE_PROP_UINT32(TOUCHSCREEN_OPTION_NAME,
- VirtIOTouchscreenPCI, vdev.max_finger, DEFAULT_MAX_FINGER),
DEFINE_PROP_END_OF_LIST(),
};
-static int virtio_touchscreen_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_touchscreen_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOTouchscreenPCI *dev = VIRTIO_TOUCHSCREEN_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_touchscreen_pci_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
dc->props = virtio_touchscreen_pci_properties;
- k->init = virtio_touchscreen_pci_init;
+ k->realize = virtio_touchscreen_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_TOUCHSCREEN;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_touchscreen_pci_instance_init(Object *obj)
{
VirtIOTouchscreenPCI *dev = VIRTIO_TOUCHSCREEN_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TOUCHSCREEN);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_TOUCHSCREEN);
dev->vdev.max_finger = DEFAULT_MAX_FINGER;
}
/* virtio-keyboard-pci */
-static int virtio_keyboard_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_keyboard_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOKeyboardPCI *dev = VIRTIO_KEYBOARD_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_keyboard_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_keyboard_pci_init;
+ k->realize = virtio_keyboard_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_KEYBOARD;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_keyboard_pci_instance_init(Object *obj)
{
VirtIOKeyboardPCI *dev = VIRTIO_KEYBOARD_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_KEYBOARD);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_KEYBOARD);
}
static TypeInfo virtio_keyboard_pci_info = {
/* virtio-esm-pci */
-static int virtio_esm_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_esm_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOESMPCI *dev = VIRTIO_ESM_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_esm_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_esm_pci_init;
+ k->realize = virtio_esm_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_ESM;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_esm_pci_instance_init(Object *obj)
{
VirtIOESMPCI *dev = VIRTIO_ESM_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_ESM);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_ESM);
}
static TypeInfo virtio_esm_pci_info = {
/* virtio-hwkey-pci */
-static int virtio_hwkey_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_hwkey_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOHWKeyPCI *dev = VIRTIO_HWKEY_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_hwkey_pci_class_init(ObjectClass *klass, void *data)
{
-// DeviceClass *dc = DEVICE_CLASS(klass);
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_hwkey_pci_init;
+ k->realize= virtio_hwkey_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_HWKEY;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_hwkey_pci_instance_init(Object *obj)
{
VirtIOHWKeyPCI *dev = VIRTIO_HWKEY_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_HWKEY);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_HWKEY);
}
static TypeInfo virtio_hwkey_pci_info = {
/* virtio-tablet-pci */
-static int virtio_tablet_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_tablet_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOTabletPCI *dev = VIRTIO_TABLET_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_tablet_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_tablet_pci_init;
+ k->realize = virtio_tablet_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_TABLET;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_tablet_pci_instance_init(Object *obj)
{
VirtIOTabletPCI *dev = VIRTIO_TABLET_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TABLET);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_TABLET);
}
static TypeInfo virtio_tablet_pci_info = {
DEFINE_PROP_END_OF_LIST(),
};
-static int virtio_evdi_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_evdi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOEVDIPCI *dev = VIRTIO_EVDI_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_evdi_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_evdi_pci_init;
+ k->realize = virtio_evdi_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_EVDI;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_evdi_pci_instance_init(Object *obj)
{
VirtIOEVDIPCI *dev = VIRTIO_EVDI_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_EVDI);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_EVDI);
}
static TypeInfo virtio_evdi_pci_info = {
/* virtio-sensor-pci */
-static int virtio_sensor_pci_init(VirtIOPCIProxy *vpci_dev)
+static Property virtio_sensor_pci_properties[] = {
+ DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_sensor_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOSENSORPCI *dev = VIRTIO_SENSOR_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
-static Property virtio_sensor_pci_properties[] = {
- DEFINE_PROP_STRING(ATTRIBUTE_NAME_SENSORS, VirtIOSENSORPCI, vdev.sensors),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void virtio_sensor_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_sensor_pci_init;
+ k->realize = virtio_sensor_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SENSOR;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_sensor_pci_instance_init(Object *obj)
{
VirtIOSENSORPCI *dev = VIRTIO_SENSOR_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SENSOR);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_SENSOR);
}
static TypeInfo virtio_sensor_pci_info = {
/* virtio NFC */
-static int virtio_nfc_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_nfc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIONFCPCI *dev = VIRTIO_NFC_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_nfc_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_nfc_pci_init;
+ k->realize = virtio_nfc_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_NFC;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_nfc_pci_instance_init(Object *obj)
{
VirtIONFCPCI *dev = VIRTIO_NFC_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_NFC);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_NFC);
}
static TypeInfo virtio_nfc_pci_info = {
/* virtio-jack-pci */
-static int virtio_jack_pci_init(VirtIOPCIProxy *vpci_dev)
+static Property virtio_jack_pci_properties[] = {
+ DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_jack_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOJACKPCI *dev = VIRTIO_JACK_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
-static Property virtio_jack_pci_properties[] = {
- DEFINE_PROP_STRING(ATTRIBUTE_NAME_JACKS, VirtIOJACKPCI, vdev.jacks),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void virtio_jack_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_jack_pci_init;
+ k->realize = virtio_jack_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_JACK;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_jack_pci_instance_init(Object *obj)
{
VirtIOJACKPCI *dev = VIRTIO_JACK_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_JACK);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_JACK);
}
static TypeInfo virtio_jack_pci_info = {
/* virtio-power-pci */
-static int virtio_power_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_power_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOPOWERPCI *dev = VIRTIO_POWER_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_power_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_power_pci_init;
+ k->realize = virtio_power_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_POWER;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_power_pci_instance_init(Object *obj)
{
VirtIOPOWERPCI *dev = VIRTIO_POWER_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_POWER);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_POWER);
}
static TypeInfo virtio_power_pci_info = {
/* virtio-vmodem-pci */
-static int virtio_vmodem_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_vmodem_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOVModemPCI *dev = VIRTIO_VMODEM_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_vmodem_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_vmodem_pci_init;
+ k->realize = virtio_vmodem_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VMODEM;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_vmodem_pci_instance_init(Object *obj)
{
VirtIOVModemPCI *dev = VIRTIO_VMODEM_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_VMODEM);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_VMODEM);
}
static TypeInfo virtio_vmodem_pci_info = {
/* virtio-rotary-pci */
-static int virtio_rotary_pci_init(VirtIOPCIProxy *vpci_dev)
+static void virtio_rotary_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIORotaryPCI *dev = VIRTIO_ROTARY_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- if (qdev_init(vdev) < 0) {
- return -1;
- }
- return 0;
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_rotary_pci_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
- k->init = virtio_rotary_pci_init;
+ k->realize = virtio_rotary_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_ROTARY;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
static void virtio_rotary_pci_instance_init(Object *obj)
{
VirtIORotaryPCI *dev = VIRTIO_ROTARY_PCI(obj);
- object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_ROTARY);
- object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_ROTARY);
}
static TypeInfo virtio_rotary_pci_info = {