]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/pci-host/aspeed_pcie: convert to use Resettable interface
authorKane Chen <kane_chen@aspeedtech.com>
Mon, 25 May 2026 04:41:45 +0000 (04:41 +0000)
committerCédric Le Goater <clg@redhat.com>
Tue, 26 May 2026 06:56:48 +0000 (08:56 +0200)
Replace the legacy reset callback registered via
device_class_set_legacy_reset() with the Resettable interface.

Signed-off-by: Kane Chen <kane_chen@aspeedtech.com>
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Link: https://lore.kernel.org/qemu-devel/20260525044129.3133916-11-kane_chen@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/pci-host/aspeed_pcie.c

index c150496f7b9ce58b156e854834163920db254588..186e5aeea298f698c89b6a86fe9555584daf9547 100644 (file)
@@ -613,9 +613,9 @@ static void aspeed_pcie_cfg_instance_init(Object *obj)
     return;
 }
 
-static void aspeed_pcie_cfg_reset(DeviceState *dev)
+static void aspeed_pcie_cfg_reset_hold(Object *obj, ResetType type)
 {
-    AspeedPCIECfgState *s = ASPEED_PCIE_CFG(dev);
+    AspeedPCIECfgState *s = ASPEED_PCIE_CFG(obj);
     AspeedPCIECfgClass *apc = ASPEED_PCIE_CFG_GET_CLASS(s);
 
     memset(s->regs, 0, apc->nr_regs << 2);
@@ -663,12 +663,13 @@ static const Property aspeed_pcie_cfg_props[] = {
 static void aspeed_pcie_cfg_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     AspeedPCIECfgClass *apc = ASPEED_PCIE_CFG_CLASS(klass);
 
     dc->desc = "ASPEED PCIe Config";
     dc->realize = aspeed_pcie_cfg_realize;
     dc->unrealize = aspeed_pcie_cfg_unrealize;
-    device_class_set_legacy_reset(dc, aspeed_pcie_cfg_reset);
+    rc->phases.hold = aspeed_pcie_cfg_reset_hold;
     device_class_set_props(dc, aspeed_pcie_cfg_props);
 
     apc->reg_ops = &aspeed_pcie_cfg_ops;
@@ -870,9 +871,9 @@ static const MemoryRegionOps aspeed_pcie_phy_ops = {
     },
 };
 
-static void aspeed_pcie_phy_reset(DeviceState *dev)
+static void aspeed_pcie_phy_reset_hold(Object *obj, ResetType type)
 {
-    AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(dev);
+    AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(obj);
     AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_GET_CLASS(s);
 
     memset(s->regs, 0, apc->nr_regs << 2);
@@ -913,12 +914,13 @@ static const Property aspeed_pcie_phy_props[] = {
 static void aspeed_pcie_phy_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_CLASS(klass);
 
     dc->desc = "ASPEED PCIe Phy";
     dc->realize = aspeed_pcie_phy_realize;
     dc->unrealize = aspeed_pcie_phy_unrealize;
-    device_class_set_legacy_reset(dc, aspeed_pcie_phy_reset);
+    rc->phases.hold = aspeed_pcie_phy_reset_hold;
     device_class_set_props(dc, aspeed_pcie_phy_props);
 
     apc->nr_regs = 0x100 >> 2;
@@ -932,9 +934,9 @@ static const TypeInfo aspeed_pcie_phy_info = {
     .class_size = sizeof(AspeedPCIEPhyClass),
 };
 
-static void aspeed_2700_pcie_phy_reset(DeviceState *dev)
+static void aspeed_2700_pcie_phy_reset_hold(Object *obj, ResetType type)
 {
-    AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(dev);
+    AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(obj);
     AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_GET_CLASS(s);
 
     memset(s->regs, 0, apc->nr_regs << 2);
@@ -950,10 +952,11 @@ static void aspeed_2700_pcie_phy_class_init(ObjectClass *klass,
                                             const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_CLASS(klass);
 
     dc->desc = "ASPEED AST2700 PCIe Phy";
-    device_class_set_legacy_reset(dc, aspeed_2700_pcie_phy_reset);
+    rc->phases.hold = aspeed_2700_pcie_phy_reset_hold;
 
     apc->nr_regs = 0x800 >> 2;
 }