hw/display/virtio-vga: Convert TYPE_VIRTIO_VGA_BASE to 3-phase reset

Convert the TYPE_VIRTIO_VGA_BASE class to 3-phase reset, so we
don't need to use device_class_set_parent_reset() any more.

Note that this is an abstract class itself; none of the subclasses
override its reset method.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20221125115240.3005559-3-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2022-11-25 11:52:35 +00:00
parent 54da41834f
commit 0d89890466
2 changed files with 10 additions and 7 deletions

View File

@ -165,13 +165,15 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
}
}
static void virtio_vga_base_reset(DeviceState *dev)
static void virtio_vga_base_reset_hold(Object *obj)
{
VirtIOVGABaseClass *klass = VIRTIO_VGA_BASE_GET_CLASS(dev);
VirtIOVGABase *vvga = VIRTIO_VGA_BASE(dev);
VirtIOVGABaseClass *klass = VIRTIO_VGA_BASE_GET_CLASS(obj);
VirtIOVGABase *vvga = VIRTIO_VGA_BASE(obj);
/* reset virtio-gpu */
klass->parent_reset(dev);
if (klass->parent_phases.hold) {
klass->parent_phases.hold(obj);
}
/* reset vga */
vga_common_reset(&vvga->vga);
@ -203,13 +205,14 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
VirtIOVGABaseClass *v = VIRTIO_VGA_BASE_CLASS(klass);
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
ResettableClass *rc = RESETTABLE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
device_class_set_props(dc, virtio_vga_base_properties);
dc->vmsd = &vmstate_virtio_vga_base;
dc->hotpluggable = false;
device_class_set_parent_reset(dc, virtio_vga_base_reset,
&v->parent_reset);
resettable_class_set_parent_phases(rc, NULL, virtio_vga_base_reset_hold,
NULL, &v->parent_phases);
k->realize = virtio_vga_base_realize;
pcidev_k->romfile = "vgabios-virtio.bin";

View File

@ -23,7 +23,7 @@ struct VirtIOVGABase {
struct VirtIOVGABaseClass {
VirtioPCIClass parent_class;
DeviceReset parent_reset;
ResettablePhases parent_phases;
};
#endif /* VIRTIO_VGA_H */