qdev: Unrealize must not fail

Devices may have component devices and buses.

Device realization may fail.  Realization is recursive: a device's
realize() method realizes its components, and device_set_realized()
realizes its buses (which should in turn realize the devices on that
bus, except bus_set_realized() doesn't implement that, yet).

When realization of a component or bus fails, we need to roll back:
unrealize everything we realized so far.  If any of these unrealizes
failed, the device would be left in an inconsistent state.  Must not
happen.

device_set_realized() lets it happen: it ignores errors in the roll
back code starting at label child_realize_fail.

Since realization is recursive, unrealization must be recursive, too.
But how could a partly failed unrealize be rolled back?  We'd have to
re-realize, which can fail.  This design is fundamentally broken.

device_set_realized() does not roll back at all.  Instead, it keeps
unrealizing, ignoring further errors.

It can screw up even for a device with no buses: if the lone
dc->unrealize() fails, it still unregisters vmstate, and calls
listeners' unrealize() callback.

bus_set_realized() does not roll back either.  Instead, it stops
unrealizing.

Fortunately, no unrealize method can fail, as we'll see below.

To fix the design error, drop parameter @errp from all the unrealize
methods.

Any unrealize method that uses @errp now needs an update.  This leads
us to unrealize() methods that can fail.  Merely passing it to another
unrealize method cannot cause failure, though.  Here are the ones that
do other things with @errp:

* virtio_serial_device_unrealize()

  Fails when qbus_set_hotplug_handler() fails, but still does all the
  other work.  On failure, the device would stay realized with its
  resources completely gone.  Oops.  Can't happen, because
  qbus_set_hotplug_handler() can't actually fail here.  Pass
  &error_abort to qbus_set_hotplug_handler() instead.

* hw/ppc/spapr_drc.c's unrealize()

  Fails when object_property_del() fails, but all the other work is
  already done.  On failure, the device would stay realized with its
  vmstate registration gone.  Oops.  Can't happen, because
  object_property_del() can't actually fail here.  Pass &error_abort
  to object_property_del() instead.

* spapr_phb_unrealize()

  Fails and bails out when remove_drcs() fails, but other work is
  already done.  On failure, the device would stay realized with some
  of its resources gone.  Oops.  remove_drcs() fails only when
  chassis_from_bus()'s object_property_get_uint() fails, and it can't
  here.  Pass &error_abort to remove_drcs() instead.

Therefore, no unrealize method can fail before this patch.

device_set_realized()'s recursive unrealization via bus uses
object_property_set_bool().  Can't drop @errp there, so pass
&error_abort.

We similarly unrealize with object_property_set_bool() elsewhere,
always ignoring errors.  Pass &error_abort instead.

Several unrealize methods no longer handle errors from other unrealize
methods: virtio_9p_device_unrealize(),
virtio_input_device_unrealize(), scsi_qdev_unrealize(), ...
Much of the deleted error handling looks wrong anyway.

One unrealize methods no longer ignore such errors:
usb_ehci_pci_exit().

Several realize methods no longer ignore errors when rolling back:
v9fs_device_realize_common(), pci_qdev_unrealize(),
spapr_phb_realize(), usb_qdev_realize(), vfio_ccw_realize(),
virtio_device_realize().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-17-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2020-05-05 17:29:24 +02:00
parent 40c2281cc3
commit b69c3c21a5
93 changed files with 158 additions and 214 deletions

View File

@ -4124,13 +4124,13 @@ int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t,
rc = 0;
out:
if (rc) {
v9fs_device_unrealize_common(s, NULL);
v9fs_device_unrealize_common(s);
}
v9fs_path_free(&path);
return rc;
}
void v9fs_device_unrealize_common(V9fsState *s, Error **errp)
void v9fs_device_unrealize_common(V9fsState *s)
{
if (s->ops && s->ops->cleanup) {
s->ops->cleanup(&s->ctx);

View File

@ -423,7 +423,7 @@ int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
const char *name, V9fsPath *path);
int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t,
Error **errp);
void v9fs_device_unrealize_common(V9fsState *s, Error **errp);
void v9fs_device_unrealize_common(V9fsState *s);
V9fsPDU *pdu_alloc(V9fsState *s);
void pdu_free(V9fsPDU *pdu);

View File

@ -212,7 +212,7 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp)
v->vq = virtio_add_queue(vdev, MAX_REQ, handle_9p_output);
}
static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_9p_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
V9fsVirtioState *v = VIRTIO_9P(dev);
@ -220,7 +220,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp)
virtio_delete_queue(v->vq);
virtio_cleanup(vdev);
v9fs_device_unrealize_common(s, errp);
v9fs_device_unrealize_common(s);
}
/* virtio-9p device */

View File

@ -266,7 +266,7 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
{
trace_acpi_pci_unplug(PCI_SLOT(PCI_DEVICE(dev)->devfn),
acpi_pcihp_get_bsel(pci_get_bus(PCI_DEVICE(dev))));
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,

View File

@ -74,7 +74,7 @@ static void hda_codec_dev_realize(DeviceState *qdev, Error **errp)
}
}
static void hda_codec_dev_unrealize(DeviceState *qdev, Error **errp)
static void hda_codec_dev_unrealize(DeviceState *qdev)
{
HDACodecDevice *dev = HDA_CODEC_DEVICE(qdev);
HDACodecDeviceClass *cdc = HDA_CODEC_DEVICE_GET_CLASS(dev);

View File

@ -949,7 +949,7 @@ static Property pflash_cfi02_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
static void pflash_cfi02_unrealize(DeviceState *dev, Error **errp)
static void pflash_cfi02_unrealize(DeviceState *dev)
{
PFlashCFI02 *pfl = PFLASH_CFI02(dev);
timer_del(&pfl->timer);

View File

@ -452,7 +452,7 @@ virtio_err:
vhost_user_cleanup(&s->vhost_user);
}
static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp)
static void vhost_user_blk_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostUserBlk *s = VHOST_USER_BLK(dev);

View File

@ -1223,7 +1223,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
conf->conf.lsecs);
}
static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_blk_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOBlock *s = VIRTIO_BLK(dev);

View File

@ -136,7 +136,7 @@ static void xen_block_connect(XenDevice *xendev, Error **errp)
g_free(ring_ref);
}
static void xen_block_unrealize(XenDevice *xendev, Error **errp)
static void xen_block_unrealize(XenDevice *xendev)
{
XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
XenBlockDeviceClass *blockdev_class =
@ -157,7 +157,7 @@ static void xen_block_unrealize(XenDevice *xendev, Error **errp)
blockdev->dataplane = NULL;
if (blockdev_class->unrealize) {
blockdev_class->unrealize(blockdev, errp);
blockdev_class->unrealize(blockdev);
}
}
@ -567,7 +567,7 @@ static const TypeInfo xen_block_type_info = {
.class_init = xen_block_class_init,
};
static void xen_disk_unrealize(XenBlockDevice *blockdev, Error **errp)
static void xen_disk_unrealize(XenBlockDevice *blockdev)
{
trace_xen_disk_unrealize();
}
@ -606,7 +606,7 @@ static const TypeInfo xen_disk_type_info = {
.class_init = xen_disk_class_init,
};
static void xen_cdrom_unrealize(XenBlockDevice *blockdev, Error **errp)
static void xen_cdrom_unrealize(XenBlockDevice *blockdev)
{
trace_xen_cdrom_unrealize();
}

View File

@ -56,7 +56,7 @@ static void multi_serial_pci_exit(PCIDevice *dev)
for (i = 0; i < pci->ports; i++) {
s = pci->state + i;
object_property_set_bool(OBJECT(s), false, "realized", NULL);
object_property_set_bool(OBJECT(s), false, "realized", &error_abort);
memory_region_del_subregion(&pci->iobar, &s->io);
g_free(pci->name[i]);
}

View File

@ -68,7 +68,7 @@ static void serial_pci_exit(PCIDevice *dev)
PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev);
SerialState *s = &pci->state;
object_property_set_bool(OBJECT(s), false, "realized", NULL);
object_property_set_bool(OBJECT(s), false, "realized", &error_abort);
qemu_free_irq(s->irq);
}

View File

@ -950,7 +950,7 @@ static void serial_realize(DeviceState *dev, Error **errp)
serial_reset(s);
}
static void serial_unrealize(DeviceState *dev, Error **errp)
static void serial_unrealize(DeviceState *dev)
{
SerialState *s = SERIAL(dev);

View File

@ -249,7 +249,7 @@ static void virtconsole_realize(DeviceState *dev, Error **errp)
}
}
static void virtconsole_unrealize(DeviceState *dev, Error **errp)
static void virtconsole_unrealize(DeviceState *dev)
{
VirtConsole *vcon = VIRTIO_CONSOLE(dev);

View File

@ -1010,7 +1010,7 @@ static void virtser_port_device_plug(HotplugHandler *hotplug_dev,
virtio_notify_config(VIRTIO_DEVICE(hotplug_dev));
}
static void virtser_port_device_unrealize(DeviceState *dev, Error **errp)
static void virtser_port_device_unrealize(DeviceState *dev)
{
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);
VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(dev);
@ -1022,7 +1022,7 @@ static void virtser_port_device_unrealize(DeviceState *dev, Error **errp)
QTAILQ_REMOVE(&vser->ports, port, next);
if (vsc->unrealize) {
vsc->unrealize(dev, errp);
vsc->unrealize(dev);
}
}
@ -1122,7 +1122,7 @@ static const TypeInfo virtio_serial_port_type_info = {
.class_init = virtio_serial_port_class_init,
};
static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_serial_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOSerial *vser = VIRTIO_SERIAL(dev);
@ -1147,7 +1147,7 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)
g_free(vser->post_load);
}
qbus_set_hotplug_handler(BUS(&vser->bus), NULL, errp);
qbus_set_hotplug_handler(BUS(&vser->bus), NULL, &error_abort);
virtio_cleanup(vdev);
}

View File

@ -176,11 +176,10 @@ static void bus_set_realized(Object *obj, bool value, Error **errp)
BusState *bus = BUS(obj);
BusClass *bc = BUS_GET_CLASS(bus);
BusChild *kid;
Error *local_err = NULL;
if (value && !bus->realized) {
if (bc->realize) {
bc->realize(bus, &local_err);
bc->realize(bus, errp);
}
/* TODO: recursive realization */
@ -188,21 +187,13 @@ static void bus_set_realized(Object *obj, bool value, Error **errp)
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
object_property_set_bool(OBJECT(dev), false, "realized",
&local_err);
if (local_err != NULL) {
break;
}
&error_abort);
}
if (bc->unrealize && local_err == NULL) {
bc->unrealize(bus, &local_err);
if (bc->unrealize) {
bc->unrealize(bus);
}
}
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
bus->realized = value;
}

View File

@ -345,7 +345,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
trace_init_vcpu(cpu);
}
static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
static void cpu_common_unrealizefn(DeviceState *dev)
{
CPUState *cpu = CPU(dev);
/* NOTE: latest generic point before the cpu is fully unrealized */

View File

@ -173,7 +173,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
}
}
static void generic_loader_unrealize(DeviceState *dev, Error **errp)
static void generic_loader_unrealize(DeviceState *dev)
{
qemu_unregister_reset(generic_loader_reset, dev);
}

View File

@ -392,7 +392,7 @@ static void device_reset_child_foreach(Object *obj, ResettableChildCallback cb,
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
/*
@ -945,23 +945,18 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
}
} else if (!value && dev->realized) {
/* We want local_err to track only the first error */
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
object_property_set_bool(OBJECT(bus), false, "realized",
local_err ? NULL : &local_err);
&error_abort);
}
if (qdev_get_vmsd(dev)) {
vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev);
}
if (dc->unrealize) {
dc->unrealize(dev, local_err ? NULL : &local_err);
dc->unrealize(dev);
}
dev->pending_deleted_event = true;
DEVICE_LISTENER_CALL(unrealize, Reverse, dev);
if (local_err != NULL) {
goto fail;
}
}
assert(local_err == NULL);
@ -971,7 +966,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
child_realize_fail:
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
object_property_set_bool(OBJECT(bus), false, "realized",
NULL);
&error_abort);
}
if (qdev_get_vmsd(dev)) {
@ -982,7 +977,7 @@ post_realize_fail:
g_free(dev->canonical_path);
dev->canonical_path = NULL;
if (dc->unrealize) {
dc->unrealize(dev, NULL);
dc->unrealize(dev);
}
fail:
@ -1083,7 +1078,7 @@ static void device_unparent(Object *obj)
BusState *bus;
if (dev->realized) {
object_property_set_bool(obj, false, "realized", NULL);
object_property_set_bool(obj, false, "realized", &error_abort);
}
while (dev->num_child_bus) {
bus = QLIST_FIRST(&dev->child_bus);

View File

@ -203,7 +203,7 @@ virtio_gpu_base_set_features(VirtIODevice *vdev, uint64_t features)
}
static void
virtio_gpu_base_device_unrealize(DeviceState *qdev, Error **errp)
virtio_gpu_base_device_unrealize(DeviceState *qdev)
{
VirtIOGPUBase *g = VIRTIO_GPU_BASE(qdev);

View File

@ -690,7 +690,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)
address_space_init(&s->dma_as, MEMORY_REGION(&s->dma_mr), "rc4030-dma");
}
static void rc4030_unrealize(DeviceState *dev, Error **errp)
static void rc4030_unrealize(DeviceState *dev)
{
rc4030State *s = RC4030(dev);

View File

@ -230,7 +230,7 @@ static void kvm_apic_realize(DeviceState *dev, Error **errp)
}
}
static void kvm_apic_unrealize(DeviceState *dev, Error **errp)
static void kvm_apic_unrealize(DeviceState *dev)
{
}

View File

@ -1385,7 +1385,7 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
}
pc_dimm_unplug(PC_DIMM(dev), MACHINE(pcms));
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
out:
error_propagate(errp, local_err);
}
@ -1493,7 +1493,7 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
found_cpu = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, NULL);
found_cpu->cpu = NULL;
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
/* decrement the number of CPUs */
x86ms->boot_cpus--;

View File

@ -36,7 +36,7 @@
/* --------------------------------- */
static char *idebus_get_fw_dev_path(DeviceState *dev);
static void idebus_unrealize(BusState *qdev, Error **errp);
static void idebus_unrealize(BusState *qdev);
static Property ide_props[] = {
DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
@ -51,7 +51,7 @@ static void ide_bus_class_init(ObjectClass *klass, void *data)
k->unrealize = idebus_unrealize;
}
static void idebus_unrealize(BusState *bus, Error **errp)
static void idebus_unrealize(BusState *bus)
{
IDEBus *ibus = IDE_BUS(bus);

View File

@ -165,7 +165,7 @@ static void virtio_input_hid_realize(DeviceState *dev, Error **errp)
}
}
static void virtio_input_hid_unrealize(DeviceState *dev, Error **errp)
static void virtio_input_hid_unrealize(DeviceState *dev)
{
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
qemu_input_handler_unregister(vhid->hs);

View File

@ -178,7 +178,7 @@ err_close:
return;
}
static void virtio_input_host_unrealize(DeviceState *dev, Error **errp)
static void virtio_input_host_unrealize(DeviceState *dev)
{
VirtIOInputHost *vih = VIRTIO_INPUT_HOST(dev);

View File

@ -276,19 +276,14 @@ static void virtio_input_finalize(Object *obj)
g_free(vinput->queue);
}
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_input_device_unrealize(DeviceState *dev)
{
VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOInput *vinput = VIRTIO_INPUT(dev);
Error *local_err = NULL;
if (vic->unrealize) {
vic->unrealize(dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
vic->unrealize(dev);
}
virtio_delete_queue(vinput->evt);
virtio_delete_queue(vinput->sts);

View File

@ -900,7 +900,7 @@ static void apic_realize(DeviceState *dev, Error **errp)
msi_nonbroken = true;
}
static void apic_unrealize(DeviceState *dev, Error **errp)
static void apic_unrealize(DeviceState *dev)
{
APICCommonState *s = APIC(dev);

View File

@ -293,13 +293,13 @@ static void apic_common_realize(DeviceState *dev, Error **errp)
s, -1, 0, NULL);
}
static void apic_common_unrealize(DeviceState *dev, Error **errp)
static void apic_common_unrealize(DeviceState *dev)
{
APICCommonState *s = APIC_COMMON(dev);
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
vmstate_unregister(NULL, &vmstate_apic_common, s);
info->unrealize(dev, errp);
info->unrealize(dev);
if (apic_report_tpr_access && info->enable_tpr_reporting) {
info->enable_tpr_reporting(s, false);

View File

@ -451,7 +451,7 @@ static void ioapic_realize(DeviceState *dev, Error **errp)
qemu_add_machine_init_done_notifier(&s->machine_done);
}
static void ioapic_unrealize(DeviceState *dev, Error **errp)
static void ioapic_unrealize(DeviceState *dev)
{
IOAPICCommonState *s = IOAPIC_COMMON(dev);

View File

@ -338,7 +338,7 @@ static void icp_realize(DeviceState *dev, Error **errp)
vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp);
}
static void icp_unrealize(DeviceState *dev, Error **errp)
static void icp_unrealize(DeviceState *dev)
{
ICPState *icp = ICP(dev);

View File

@ -60,15 +60,13 @@ static void ipack_device_realize(DeviceState *dev, Error **errp)
k->realize(dev, errp);
}
static void ipack_device_unrealize(DeviceState *dev, Error **errp)
static void ipack_device_unrealize(DeviceState *dev)
{
IPackDevice *idev = IPACK_DEVICE(dev);
IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
Error *err = NULL;
if (k->unrealize) {
k->unrealize(dev, &err);
error_propagate(errp, err);
k->unrealize(dev);
return;
}

View File

@ -199,7 +199,7 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
host_memory_backend_set_mapped(dimm->hostmem, true);
}
static void pc_dimm_unrealize(DeviceState *dev, Error **errp)
static void pc_dimm_unrealize(DeviceState *dev)
{
PCDIMMDevice *dimm = PC_DIMM(dev);

View File

@ -3077,7 +3077,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
n->qdev = dev;
}
static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_net_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIONet *n = VIRTIO_NET(dev);

View File

@ -107,7 +107,7 @@ static void macio_nvram_realizefn(DeviceState *dev, Error **errp)
sysbus_init_mmio(d, &s->mem);
}
static void macio_nvram_unrealizefn(DeviceState *dev, Error **errp)
static void macio_nvram_unrealizefn(DeviceState *dev)
{
MacIONVRAMState *s = MACIO_NVRAM(dev);

View File

@ -146,7 +146,7 @@ static void pcie_bus_realize(BusState *qbus, Error **errp)
}
}
static void pci_bus_unrealize(BusState *qbus, Error **errp)
static void pci_bus_unrealize(BusState *qbus)
{
PCIBus *bus = PCI_BUS(qbus);
@ -456,7 +456,7 @@ void pci_root_bus_cleanup(PCIBus *bus)
{
pci_bus_uninit(bus);
/* the caller of the unplug hotplug handler will delete this device */
object_property_set_bool(OBJECT(bus), false, "realized", NULL);
object_property_set_bool(OBJECT(bus), false, "realized", &error_abort);
}
void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
@ -1118,7 +1118,7 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
pci_unregister_vga(pci_dev);
}
static void pci_qdev_unrealize(DeviceState *dev, Error **errp)
static void pci_qdev_unrealize(DeviceState *dev)
{
PCIDevice *pci_dev = PCI_DEVICE(dev);
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
@ -2108,7 +2108,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
error_setg(errp, "failover primary device must be on "
"PCIExpress bus");
error_propagate(errp, local_err);
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
pci_qdev_unrealize(DEVICE(pci_dev));
return;
}
class_id = pci_get_word(pci_dev->config + PCI_CLASS_DEVICE);
@ -2116,7 +2116,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
error_setg(errp, "failover primary device is not an "
"Ethernet device");
error_propagate(errp, local_err);
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
pci_qdev_unrealize(DEVICE(pci_dev));
return;
}
if (!(pci_dev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION)
@ -2126,7 +2126,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
error_setg(errp, "failover: primary device must be in its own "
"PCI slot");
error_propagate(errp, local_err);
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
pci_qdev_unrealize(DEVICE(pci_dev));
return;
}
qdev->allow_unplug_during_migration = true;
@ -2142,7 +2142,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
pci_add_option_rom(pci_dev, is_default_rom, &local_err);
if (local_err) {
error_propagate(errp, local_err);
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
pci_qdev_unrealize(DEVICE(pci_dev));
return;
}
}

View File

@ -457,7 +457,7 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
void pcie_cap_slot_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
static void pcie_unplug_device(PCIBus *bus, PCIDevice *dev, void *opaque)

View File

@ -547,7 +547,7 @@ void shpc_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
void shpc_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
void shpc_device_unplug_request_cb(HotplugHandler *hotplug_dev,

View File

@ -275,7 +275,7 @@ static void pnv_core_cpu_unrealize(PnvCore *pc, PowerPCCPU *cpu)
object_unparent(OBJECT(cpu));
}
static void pnv_core_unrealize(DeviceState *dev, Error **errp)
static void pnv_core_unrealize(DeviceState *dev)
{
PnvCore *pc = PNV_CORE(dev);
CPUCore *cc = CPU_CORE(dev);

View File

@ -3670,7 +3670,7 @@ static void spapr_memory_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)
SpaprDimmState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev));
pc_dimm_unplug(PC_DIMM(dev), MACHINE(hotplug_dev));
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
spapr_pending_dimm_unplugs_remove(spapr, ds);
}
@ -3763,7 +3763,7 @@ static void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)
assert(core_slot);
core_slot->cpu = NULL;
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
static
@ -4036,7 +4036,7 @@ void spapr_phb_release(DeviceState *dev)
static void spapr_phb_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)
{
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
static void spapr_phb_unplug_request(HotplugHandler *hotplug_dev,
@ -4072,7 +4072,7 @@ static void spapr_tpm_proxy_unplug(HotplugHandler *hotplug_dev, DeviceState *dev
{
SpaprMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
object_unparent(OBJECT(dev));
spapr->tpm_proxy = NULL;
}

View File

@ -218,7 +218,7 @@ static void spapr_cpu_core_reset_handler(void *opaque)
spapr_cpu_core_reset(opaque);
}
static void spapr_cpu_core_unrealize(DeviceState *dev, Error **errp)
static void spapr_cpu_core_unrealize(DeviceState *dev)
{
SpaprCpuCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
CPUCore *cc = CPU_CORE(dev);

View File

@ -541,7 +541,7 @@ static void realize(DeviceState *d, Error **errp)
trace_spapr_drc_realize_complete(spapr_drc_index(drc));
}
static void unrealize(DeviceState *d, Error **errp)
static void unrealize(DeviceState *d)
{
SpaprDrc *drc = SPAPR_DR_CONNECTOR(d);
Object *root_container;
@ -551,7 +551,7 @@ static void unrealize(DeviceState *d, Error **errp)
vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc);
root_container = container_get(object_get_root(), DRC_CONTAINER_PATH);
name = g_strdup_printf("%x", spapr_drc_index(drc));
object_property_del(root_container, name, errp);
object_property_del(root_container, name, &error_abort);
g_free(name);
}
@ -650,17 +650,11 @@ static void realize_physical(DeviceState *d, Error **errp)
qemu_register_reset(drc_physical_reset, drcp);
}
static void unrealize_physical(DeviceState *d, Error **errp)
static void unrealize_physical(DeviceState *d)
{
SpaprDrcPhysical *drcp = SPAPR_DRC_PHYSICAL(d);
Error *local_err = NULL;
unrealize(d, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
unrealize(d);
vmstate_unregister(VMSTATE_IF(drcp), &vmstate_spapr_drc_physical, drcp);
qemu_unregister_reset(drc_physical_reset, drcp);
}

View File

@ -416,7 +416,7 @@ void spapr_tce_table_disable(SpaprTceTable *tcet)
tcet->nb_table = 0;
}
static void spapr_tce_table_unrealize(DeviceState *dev, Error **errp)
static void spapr_tce_table_unrealize(DeviceState *dev)
{
SpaprTceTable *tcet = SPAPR_TCE_TABLE(dev);

View File

@ -1627,7 +1627,8 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,
return;
}
object_property_set_bool(OBJECT(plugged_dev), false, "realized", NULL);
object_property_set_bool(OBJECT(plugged_dev), false, "realized",
&error_abort);
}
static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
@ -1715,7 +1716,7 @@ static void spapr_phb_finalizefn(Object *obj)
sphb->dtbusname = NULL;
}
static void spapr_phb_unrealize(DeviceState *dev, Error **errp)
static void spapr_phb_unrealize(DeviceState *dev)
{
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
SysBusDevice *s = SYS_BUS_DEVICE(dev);
@ -1724,7 +1725,6 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp)
SpaprTceTable *tcet;
int i;
const unsigned windows_supported = spapr_phb_windows_supported(sphb);
Error *local_err = NULL;
spapr_phb_nvgpu_free(sphb);
@ -1745,11 +1745,7 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp)
}
}
remove_drcs(sphb, phb->bus, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
remove_drcs(sphb, phb->bus, &error_abort);
for (i = PCI_NUM_PINS - 1; i >= 0; i--) {
if (sphb->lsi_table[i].irq) {
@ -2011,7 +2007,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
return;
unrealize:
spapr_phb_unrealize(dev, NULL);
spapr_phb_unrealize(dev);
}
static int spapr_phb_children_reset(Object *child, void *opaque)

View File

@ -140,7 +140,7 @@ static void spapr_tpm_proxy_realize(DeviceState *d, Error **errp)
qemu_register_reset(spapr_tpm_proxy_reset, tpm_proxy);
}
static void spapr_tpm_proxy_unrealize(DeviceState *d, Error **errp)
static void spapr_tpm_proxy_unrealize(DeviceState *d)
{
SpaprTpmProxy *tpm_proxy = SPAPR_TPM_PROXY(d);

View File

@ -54,7 +54,7 @@ static void ccw_device_unplug(HotplugHandler *hotplug_dev,
css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, 1, 0);
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
static void virtual_css_bus_reset(BusState *qbus)

View File

@ -132,7 +132,7 @@ out_err_propagate:
error_propagate(errp, err);
}
static void s390_ccw_unrealize(S390CCWDevice *cdev, Error **errp)
static void s390_ccw_unrealize(S390CCWDevice *cdev)
{
CcwDevice *ccw_dev = CCW_DEVICE(cdev);
SubchDev *sch = ccw_dev->sch;

View File

@ -1003,7 +1003,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
pbdev->fh, pbdev->fid);
bus = pci_get_bus(pci_dev);
devfn = pci_dev->devfn;
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
s390_pci_msix_free(pbdev);
s390_pci_iommu_free(s, bus, devfn);
@ -1014,7 +1014,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
pbdev->fid = 0;
QTAILQ_REMOVE(&s->zpci_devs, pbdev, link);
g_hash_table_remove(s->zpci_table, &pbdev->idx);
object_property_set_bool(OBJECT(dev), false, "realized", NULL);
object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
}
}

View File

@ -752,14 +752,14 @@ out_err:
g_free(sch);
}
static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev, Error **errp)
static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev)
{
VirtIOCCWDeviceClass *dc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
CcwDevice *ccw_dev = CCW_DEVICE(dev);
SubchDev *sch = ccw_dev->sch;
if (dc->unrealize) {
dc->unrealize(dev, errp);
dc->unrealize(dev);
}
if (sch) {
@ -1155,11 +1155,11 @@ static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
virtio_ccw_device_realize(_dev, errp);
}
static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp)
static void virtio_ccw_busdev_unrealize(DeviceState *dev)
{
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
virtio_ccw_device_unrealize(_dev, errp);
virtio_ccw_device_unrealize(_dev);
}
static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,

View File

@ -76,7 +76,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice;
typedef struct VirtIOCCWDeviceClass {
CCWDeviceClass parent_class;
void (*realize)(VirtioCcwDevice *dev, Error **errp);
void (*unrealize)(VirtioCcwDevice *dev, Error **errp);
void (*unrealize)(VirtioCcwDevice *dev);
void (*parent_reset)(DeviceState *dev);
} VirtIOCCWDeviceClass;

View File

@ -2312,7 +2312,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
}
static void lsi_scsi_unrealize(DeviceState *dev, Error **errp)
static void lsi_scsi_unrealize(DeviceState *dev)
{
LSIState *s = LSI53C895A(dev);

View File

@ -59,11 +59,11 @@ static void scsi_device_realize(SCSIDevice *s, Error **errp)
}
}
static void scsi_device_unrealize(SCSIDevice *s, Error **errp)
static void scsi_device_unrealize(SCSIDevice *s)
{
SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(s);
if (sc->unrealize) {
sc->unrealize(s, errp);
sc->unrealize(s);
}
}
@ -222,10 +222,9 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
scsi_dma_restart_cb, dev);
}
static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
static void scsi_qdev_unrealize(DeviceState *qdev)
{
SCSIDevice *dev = SCSI_DEVICE(qdev);
Error *local_err = NULL;
if (dev->vmsentry) {
qemu_del_vm_change_state_handler(dev->vmsentry);
@ -233,11 +232,7 @@ static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE));
scsi_device_unrealize(dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
scsi_device_unrealize(dev);
blockdev_mark_auto_del(dev->conf.blk);
}

View File

@ -2421,7 +2421,7 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
dev->conf.lsecs);
}
static void scsi_unrealize(SCSIDevice *dev, Error **errp)
static void scsi_unrealize(SCSIDevice *dev)
{
del_boot_device_lchs(&dev->qdev, NULL);
}

View File

@ -248,7 +248,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
return;
}
static void vhost_scsi_unrealize(DeviceState *dev, Error **errp)
static void vhost_scsi_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(dev);

View File

@ -143,7 +143,7 @@ free_virtio:
virtio_scsi_common_unrealize(dev);
}
static void vhost_user_scsi_unrealize(DeviceState *dev, Error **errp)
static void vhost_user_scsi_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostUserSCSI *s = VHOST_USER_SCSI(dev);

View File

@ -954,7 +954,7 @@ void virtio_scsi_common_unrealize(DeviceState *dev)
virtio_cleanup(vdev);
}
static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_scsi_device_unrealize(DeviceState *dev)
{
VirtIOSCSI *s = VIRTIO_SCSI(dev);

View File

@ -335,7 +335,7 @@ extern const VMStateDescription sdhci_vmstate;
void sdhci_initfn(SDHCIState *s);
void sdhci_uninitfn(SDHCIState *s);
void sdhci_common_realize(SDHCIState *s, Error **errp);
void sdhci_common_unrealize(SDHCIState *s, Error **errp);
void sdhci_common_unrealize(SDHCIState *s);
void sdhci_common_class_init(ObjectClass *klass, void *data);
#endif

View File

@ -50,7 +50,7 @@ static void sdhci_pci_exit(PCIDevice *dev)
{
SDHCIState *s = PCI_SDHCI(dev);
sdhci_common_unrealize(s, &error_abort);
sdhci_common_unrealize(s);
sdhci_uninitfn(s);
}

View File

@ -1346,7 +1346,7 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
SDHC_REGISTERS_MAP_SIZE);
}
void sdhci_common_unrealize(SDHCIState *s, Error **errp)
void sdhci_common_unrealize(SDHCIState *s)
{
/* This function is expected to be called only once for each class:
* - SysBus: via DeviceClass->unrealize(),
@ -1479,11 +1479,11 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->iomem);
}
static void sdhci_sysbus_unrealize(DeviceState *dev, Error **errp)
static void sdhci_sysbus_unrealize(DeviceState *dev)
{
SDHCIState *s = SYSBUS_SDHCI(dev);
sdhci_common_unrealize(s, &error_abort);
sdhci_common_unrealize(s);
if (s->dma_mr) {
address_space_destroy(s->dma_as);

View File

@ -14,7 +14,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
static char *usb_get_dev_path(DeviceState *dev);
static char *usb_get_fw_dev_path(DeviceState *qdev);
static void usb_qdev_unrealize(DeviceState *qdev, Error **errp);
static void usb_qdev_unrealize(DeviceState *qdev);
static Property usb_props[] = {
DEFINE_PROP_STRING("port", USBDevice, port_path),
@ -130,12 +130,12 @@ USBDevice *usb_device_find_device(USBDevice *dev, uint8_t addr)
return NULL;
}
static void usb_device_unrealize(USBDevice *dev, Error **errp)
static void usb_device_unrealize(USBDevice *dev)
{
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
if (klass->unrealize) {
klass->unrealize(dev, errp);
klass->unrealize(dev);
}
}
@ -265,14 +265,14 @@ static void usb_qdev_realize(DeviceState *qdev, Error **errp)
if (dev->auto_attach) {
usb_device_attach(dev, &local_err);
if (local_err) {
usb_qdev_unrealize(qdev, NULL);
usb_qdev_unrealize(qdev);
error_propagate(errp, local_err);
return;
}
}
}
static void usb_qdev_unrealize(DeviceState *qdev, Error **errp)
static void usb_qdev_unrealize(DeviceState *qdev)
{
USBDevice *dev = USB_DEVICE(qdev);
USBDescString *s, *next;
@ -286,7 +286,7 @@ static void usb_qdev_unrealize(DeviceState *qdev, Error **errp)
if (dev->attached) {
usb_device_detach(dev);
}
usb_device_unrealize(dev, errp);
usb_device_unrealize(dev);
if (dev->port) {
usb_release_port(dev);
}

View File

@ -562,7 +562,7 @@ out1:
qemu_mutex_destroy(&card->event_list_mutex);
}
static void emulated_unrealize(CCIDCardState *base, Error **errp)
static void emulated_unrealize(CCIDCardState *base)
{
EmulatedState *card = EMULATED_CCID_CARD(base);
VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL);

View File

@ -36,7 +36,7 @@ typedef struct CCIDCardClass {
const uint8_t *apdu,
uint32_t len);
void (*realize)(CCIDCardState *card, Error **errp);
void (*unrealize)(CCIDCardState *card, Error **errp);
void (*unrealize)(CCIDCardState *card);
} CCIDCardClass;
/*

View File

@ -923,7 +923,7 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void usb_audio_unrealize(USBDevice *dev, Error **errp)
static void usb_audio_unrealize(USBDevice *dev)
{
USBAudioState *s = USB_AUDIO(dev);

View File

@ -699,7 +699,7 @@ static void usb_hid_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void usb_hid_unrealize(USBDevice *dev, Error **errp)
static void usb_hid_unrealize(USBDevice *dev)
{
USBHIDState *us = USB_HID(dev);

View File

@ -565,7 +565,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void usb_hub_unrealize(USBDevice *dev, Error **errp)
static void usb_hub_unrealize(USBDevice *dev)
{
USBHubState *s = (USBHubState *)dev;
int i;

View File

@ -1326,7 +1326,7 @@ static void usbnet_cleanup(NetClientState *nc)
s->nic = NULL;
}
static void usb_net_unrealize(USBDevice *dev, Error **errp)
static void usb_net_unrealize(USBDevice *dev)
{
USBNetState *s = (USBNetState *) dev;

View File

@ -1146,7 +1146,7 @@ static void ccid_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void ccid_unrealize(USBDevice *dev, Error **errp)
static void ccid_unrealize(USBDevice *dev)
{
USBCCIDState *s = USB_CCID_DEV(dev);
@ -1269,23 +1269,18 @@ void ccid_card_card_inserted(CCIDCardState *card)
ccid_on_slot_change(s, true);
}
static void ccid_card_unrealize(DeviceState *qdev, Error **errp)
static void ccid_card_unrealize(DeviceState *qdev)
{
CCIDCardState *card = CCID_CARD(qdev);
CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
Error *local_err = NULL;
if (ccid_card_inserted(s)) {
ccid_card_card_removed(card);
}
if (cc->unrealize) {
cc->unrealize(card, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
cc->unrealize(card);
}
s->card = NULL;
}

View File

@ -894,7 +894,7 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void usb_uas_unrealize(USBDevice *dev, Error **errp)
static void usb_uas_unrealize(USBDevice *dev)
{
UASDevice *uas = USB_UAS(dev);

View File

@ -331,7 +331,7 @@ static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p)
}
}
static void usb_wacom_unrealize(USBDevice *dev, Error **errp)
static void usb_wacom_unrealize(USBDevice *dev)
{
USBWacomState *s = (USBWacomState *) dev;

View File

@ -105,7 +105,7 @@ static void usb_ehci_pci_exit(PCIDevice *dev)
EHCIPCIState *i = PCI_EHCI(dev);
EHCIState *s = &i->ehci;
usb_ehci_unrealize(s, DEVICE(dev), NULL);
usb_ehci_unrealize(s, DEVICE(dev));
g_free(s->irq);
s->irq = NULL;

View File

@ -2522,7 +2522,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
}
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev, Error **errp)
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev)
{
trace_usb_ehci_unrealize();

View File

@ -324,7 +324,7 @@ extern const VMStateDescription vmstate_ehci;
void usb_ehci_init(EHCIState *s, DeviceState *dev);
void usb_ehci_finalize(EHCIState *s);
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp);
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev, Error **errp);
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev);
void ehci_reset(void *opaque);
#define TYPE_PCI_EHCI "pci-ehci-usb"

View File

@ -1104,7 +1104,7 @@ static void usb_host_instance_init(Object *obj)
&udev->qdev);
}
static void usb_host_unrealize(USBDevice *udev, Error **errp)
static void usb_host_unrealize(USBDevice *udev)
{
USBHostDevice *s = USB_HOST_DEVICE(udev);

View File

@ -1468,7 +1468,7 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev)
}
}
static void usbredir_unrealize(USBDevice *udev, Error **errp)
static void usbredir_unrealize(USBDevice *udev)
{
USBRedirDevice *dev = USB_REDIRECT(udev);

View File

@ -124,7 +124,7 @@ out_get_dev_err:
vfio_put_group(vfio_group);
}
static void vfio_ap_unrealize(DeviceState *dev, Error **errp)
static void vfio_ap_unrealize(DeviceState *dev)
{
APDevice *apdev = AP_DEVICE(dev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);

View File

@ -521,13 +521,13 @@ out_device_err:
vfio_put_group(group);
out_group_err:
if (cdc->unrealize) {
cdc->unrealize(cdev, NULL);
cdc->unrealize(cdev);
}
out_err_propagate:
error_propagate(errp, err);
}
static void vfio_ccw_unrealize(DeviceState *dev, Error **errp)
static void vfio_ccw_unrealize(DeviceState *dev)
{
CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
@ -541,7 +541,7 @@ static void vfio_ccw_unrealize(DeviceState *dev, Error **errp)
vfio_put_group(group);
if (cdc->unrealize) {
cdc->unrealize(cdev, errp);
cdc->unrealize(cdev);
}
}

View File

@ -241,7 +241,7 @@ err_virtio:
return;
}
static void vuf_device_unrealize(DeviceState *dev, Error **errp)
static void vuf_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostUserFS *fs = VHOST_USER_FS(dev);

View File

@ -377,7 +377,7 @@ err_virtio:
return;
}
static void vhost_vsock_device_unrealize(DeviceState *dev, Error **errp)
static void vhost_vsock_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostVSock *vsock = VHOST_VSOCK(dev);

View File

@ -819,7 +819,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
reset_stats(s);
}
static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_balloon_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOBalloon *s = VIRTIO_BALLOON(dev);

View File

@ -822,7 +822,7 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
cryptodev_backend_set_used(vcrypto->cryptodev, true);
}
static void virtio_crypto_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_crypto_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOCrypto *vcrypto = VIRTIO_CRYPTO(dev);

View File

@ -688,7 +688,7 @@ static void virtio_iommu_device_realize(DeviceState *dev, Error **errp)
}
}
static void virtio_iommu_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_iommu_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOIOMMU *s = VIRTIO_IOMMU(dev);

View File

@ -124,7 +124,7 @@ static void virtio_pmem_realize(DeviceState *dev, Error **errp)
pmem->rq_vq = virtio_add_queue(vdev, 128, virtio_pmem_flush);
}
static void virtio_pmem_unrealize(DeviceState *dev, Error **errp)
static void virtio_pmem_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOPMEM *pmem = VIRTIO_PMEM(dev);

View File

@ -230,7 +230,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
vrng);
}
static void virtio_rng_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_rng_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIORNG *vrng = VIRTIO_RNG(dev);

View File

@ -3622,7 +3622,7 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
virtio_bus_device_plugged(vdev, &err);
if (err != NULL) {
error_propagate(errp, err);
vdc->unrealize(dev, NULL);
vdc->unrealize(dev);
return;
}
@ -3630,20 +3630,15 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
memory_listener_register(&vdev->listener, vdev->dma_as);
}
static void virtio_device_unrealize(DeviceState *dev, Error **errp)
static void virtio_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev);
Error *err = NULL;
virtio_bus_device_unplugged(vdev);
if (vdc->unrealize != NULL) {
vdc->unrealize(dev, &err);
if (err != NULL) {
error_propagate(errp, err);
return;
}
vdc->unrealize(dev);
}
g_free(vdev->bus_name);

View File

@ -108,7 +108,7 @@ static void wdt_diag288_realize(DeviceState *dev, Error **errp)
dev);
}
static void wdt_diag288_unrealize(DeviceState *dev, Error **errp)
static void wdt_diag288_unrealize(DeviceState *dev)
{
DIAG288State *diag288 = DIAG288(dev);

View File

@ -428,7 +428,7 @@ static void xen_bus_backend_changed(void *opaque)
xen_bus_cleanup(xenbus);
}
static void xen_bus_unrealize(BusState *bus, Error **errp)
static void xen_bus_unrealize(BusState *bus)
{
XenBus *xenbus = XEN_BUS(bus);
@ -486,7 +486,7 @@ static void xen_bus_realize(BusState *bus, Error **errp)
return;
fail:
xen_bus_unrealize(bus, &error_abort);
xen_bus_unrealize(bus);
}
static void xen_bus_unplug_request(HotplugHandler *hotplug,
@ -1189,7 +1189,7 @@ void xen_device_unbind_event_channel(XenDevice *xendev,
g_free(channel);
}
static void xen_device_unrealize(DeviceState *dev, Error **errp)
static void xen_device_unrealize(DeviceState *dev)
{
XenDevice *xendev = XEN_DEVICE(dev);
XenDeviceClass *xendev_class = XEN_DEVICE_GET_CLASS(xendev);
@ -1208,7 +1208,7 @@ static void xen_device_unrealize(DeviceState *dev, Error **errp)
}
if (xendev_class->unrealize) {
xendev_class->unrealize(xendev, errp);
xendev_class->unrealize(xendev);
}
/* Make sure all event channels are cleaned up */
@ -1242,7 +1242,7 @@ static void xen_device_exit(Notifier *n, void *data)
{
XenDevice *xendev = container_of(n, XenDevice, exit);
xen_device_unrealize(DEVICE(xendev), &error_abort);
xen_device_unrealize(DEVICE(xendev));
}
static void xen_device_realize(DeviceState *dev, Error **errp)
@ -1336,7 +1336,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
return;
unrealize:
xen_device_unrealize(dev, &error_abort);
xen_device_unrealize(dev);
}
static Property xen_device_props[] = {

View File

@ -30,10 +30,10 @@ typedef enum DeviceCategory {
} DeviceCategory;
typedef void (*DeviceRealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev);
typedef void (*DeviceReset)(DeviceState *dev);
typedef void (*BusRealize)(BusState *bus, Error **errp);
typedef void (*BusUnrealize)(BusState *bus, Error **errp);
typedef void (*BusUnrealize)(BusState *bus);
/**
* DeviceClass:

View File

@ -33,7 +33,7 @@ typedef struct S390CCWDevice {
typedef struct S390CCWDeviceClass {
CCWDeviceClass parent_class;
void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
void (*unrealize)(S390CCWDevice *dev, Error **errp);
void (*unrealize)(S390CCWDevice *dev);
IOInstEnding (*handle_request) (SubchDev *sch);
int (*handle_halt) (SubchDev *sch);
int (*handle_clear) (SubchDev *sch);

View File

@ -59,7 +59,7 @@ struct SCSIRequest {
typedef struct SCSIDeviceClass {
DeviceClass parent_class;
void (*realize)(SCSIDevice *dev, Error **errp);
void (*unrealize)(SCSIDevice *dev, Error **errp);
void (*unrealize)(SCSIDevice *dev);
int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
void *hba_private);
SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,

View File

@ -272,7 +272,7 @@ struct USBDevice {
OBJECT_GET_CLASS(USBDeviceClass, (obj), TYPE_USB_DEVICE)
typedef void (*USBDeviceRealize)(USBDevice *dev, Error **errp);
typedef void (*USBDeviceUnrealize)(USBDevice *dev, Error **errp);
typedef void (*USBDeviceUnrealize)(USBDevice *dev);
typedef struct USBDeviceClass {
DeviceClass parent_class;

View File

@ -57,7 +57,7 @@ typedef struct XenBlockDevice {
} XenBlockDevice;
typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev, Error **errp);
typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev);
typedef struct XenBlockDeviceClass {
/*< private >*/

View File

@ -42,7 +42,7 @@ typedef void (*XenDeviceRealize)(XenDevice *xendev, Error **errp);
typedef void (*XenDeviceFrontendChanged)(XenDevice *xendev,
enum xenbus_state frontend_state,
Error **errp);
typedef void (*XenDeviceUnrealize)(XenDevice *xendev, Error **errp);
typedef void (*XenDeviceUnrealize)(XenDevice *xendev);
typedef struct XenDeviceClass {
/*< private >*/

View File

@ -6722,11 +6722,10 @@ out:
}
}
static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp)
static void x86_cpu_unrealizefn(DeviceState *dev)
{
X86CPU *cpu = X86_CPU(dev);
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
Error *local_err = NULL;
#ifndef CONFIG_USER_ONLY
cpu_remove_sync(CPU(dev));
@ -6738,11 +6737,7 @@ static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp)
cpu->apic_state = NULL;
}
xcc->parent_unrealize(dev, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
xcc->parent_unrealize(dev);
}
typedef struct BitProperty {

View File

@ -10293,19 +10293,14 @@ unrealize:
cpu_exec_unrealizefn(cs);
}
static void ppc_cpu_unrealize(DeviceState *dev, Error **errp)
static void ppc_cpu_unrealize(DeviceState *dev)
{
PowerPCCPU *cpu = POWERPC_CPU(dev);
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
Error *local_err = NULL;
opc_handler_t **table, **table_2;
int i, j, k;
pcc->parent_unrealize(dev, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
pcc->parent_unrealize(dev);
for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) {
if (cpu->opcodes[i] == &invalid_handler) {