Replace the deprecated device_class_set_legacy_reset() with the ResettableClass hold phase.
Signed-off-by: Oscar Alejandro Sánchez Lucero <[email protected]> --- To: [email protected] To: Michael S. Tsirkin <[email protected]> Cc: Marcel Apfelbaum <[email protected]> Cc: Peter Maydell <[email protected]> --- Changes in v2: - Set rc->phases.hold directly without parent_phases chaining. - Link to v1: https://lore.kernel.org/qemu-devel/[email protected] --- hw/pci-bridge/pci_bridge_dev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c index bc53bcb..783a545 100644 --- a/hw/pci-bridge/pci_bridge_dev.c +++ b/hw/pci-bridge/pci_bridge_dev.c @@ -31,6 +31,7 @@ #include "system/memory.h" #include "hw/pci/pci_bus.h" #include "hw/core/hotplug.h" +#include "hw/core/resettable.h" #include "qom/object.h" #define TYPE_PCI_BRIDGE_DEV "pci-bridge" @@ -158,11 +159,11 @@ static void pci_bridge_dev_write_config(PCIDevice *d, } } -static void qdev_pci_bridge_dev_reset(DeviceState *qdev) +static void pci_bridge_dev_reset_hold(Object *obj, ResetType type) { - PCIDevice *dev = PCI_DEVICE(qdev); + PCIDevice *dev = PCI_DEVICE(obj); - pci_bridge_reset(qdev); + pci_bridge_reset(DEVICE(obj)); if (shpc_present(dev)) { shpc_reset(dev); } @@ -245,6 +246,7 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, const void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); k->realize = pci_bridge_dev_realize; k->exit = pci_bridge_dev_exitfn; @@ -253,7 +255,7 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, const void *data) k->device_id = PCI_DEVICE_ID_REDHAT_BRIDGE; k->class_id = PCI_CLASS_BRIDGE_PCI; dc->desc = "Standard PCI Bridge"; - device_class_set_legacy_reset(dc, qdev_pci_bridge_dev_reset); + rc->phases.hold = pci_bridge_dev_reset_hold; device_class_set_props(dc, pci_bridge_dev_properties); dc->vmsd = &pci_bridge_dev_vmstate; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); --- base-commit: 29760efaf96bbe5928f8111881eddbf5ac06439e change-id: 20261112-pci-bridge-resettable-008877a75471 Best regards, -- Oscar Alejandro Sánchez Lucero <[email protected]>
