mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 14:02:05 -06:00
s390x: Convert virtio-ccw to hotplug handler API
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
e98f8c3622
commit
277bc95ed3
1 changed files with 9 additions and 8 deletions
|
@ -230,7 +230,7 @@ VirtualCssBus *virtual_css_bus_init(void)
|
||||||
cbus = VIRTUAL_CSS_BUS(bus);
|
cbus = VIRTUAL_CSS_BUS(bus);
|
||||||
|
|
||||||
/* Enable hotplugging */
|
/* Enable hotplugging */
|
||||||
bus->allow_hotplug = 1;
|
qbus_set_hotplug_handler(bus, dev, &error_abort);
|
||||||
|
|
||||||
return cbus;
|
return cbus;
|
||||||
}
|
}
|
||||||
|
@ -1590,7 +1590,8 @@ static int virtio_ccw_busdev_exit(DeviceState *dev)
|
||||||
return _info->exit(_dev);
|
return _info->exit(_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_ccw_busdev_unplug(DeviceState *dev)
|
static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
|
||||||
|
DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
|
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
|
||||||
SubchDev *sch = _dev->sch;
|
SubchDev *sch = _dev->sch;
|
||||||
|
@ -1609,7 +1610,6 @@ static int virtio_ccw_busdev_unplug(DeviceState *dev)
|
||||||
css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, 1, 0);
|
css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, 1, 0);
|
||||||
|
|
||||||
object_unparent(OBJECT(dev));
|
object_unparent(OBJECT(dev));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property virtio_ccw_properties[] = {
|
static Property virtio_ccw_properties[] = {
|
||||||
|
@ -1624,9 +1624,7 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
|
||||||
dc->props = virtio_ccw_properties;
|
dc->props = virtio_ccw_properties;
|
||||||
dc->init = virtio_ccw_busdev_init;
|
dc->init = virtio_ccw_busdev_init;
|
||||||
dc->exit = virtio_ccw_busdev_exit;
|
dc->exit = virtio_ccw_busdev_exit;
|
||||||
dc->unplug = virtio_ccw_busdev_unplug;
|
|
||||||
dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
|
dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtio_ccw_device_info = {
|
static const TypeInfo virtio_ccw_device_info = {
|
||||||
|
@ -1650,8 +1648,10 @@ static int virtual_css_bridge_init(SysBusDevice *dev)
|
||||||
static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||||
|
|
||||||
k->init = virtual_css_bridge_init;
|
k->init = virtual_css_bridge_init;
|
||||||
|
hc->unplug = virtio_ccw_busdev_unplug;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtual_css_bridge_info = {
|
static const TypeInfo virtual_css_bridge_info = {
|
||||||
|
@ -1659,6 +1659,10 @@ static const TypeInfo virtual_css_bridge_info = {
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(SysBusDevice),
|
.instance_size = sizeof(SysBusDevice),
|
||||||
.class_init = virtual_css_bridge_class_init,
|
.class_init = virtual_css_bridge_class_init,
|
||||||
|
.interfaces = (InterfaceInfo[]) {
|
||||||
|
{ TYPE_HOTPLUG_HANDLER },
|
||||||
|
{ }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* virtio-ccw-bus */
|
/* virtio-ccw-bus */
|
||||||
|
@ -1667,13 +1671,10 @@ static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
|
||||||
VirtioCcwDevice *dev)
|
VirtioCcwDevice *dev)
|
||||||
{
|
{
|
||||||
DeviceState *qdev = DEVICE(dev);
|
DeviceState *qdev = DEVICE(dev);
|
||||||
BusState *qbus;
|
|
||||||
char virtio_bus_name[] = "virtio-bus";
|
char virtio_bus_name[] = "virtio-bus";
|
||||||
|
|
||||||
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_CCW_BUS,
|
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_CCW_BUS,
|
||||||
qdev, virtio_bus_name);
|
qdev, virtio_bus_name);
|
||||||
qbus = BUS(bus);
|
|
||||||
qbus->allow_hotplug = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data)
|
static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue