]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
Replace use of qdev_reset_all() with device_cold_reset()
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Dec 2022 15:55:27 +0000 (15:55 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Dec 2022 15:55:32 +0000 (15:55 +0000)
The legacy function qdev_reset_all() performs a recursive reset,
starting from a qdev.  However, it does not permit any of the devices
in the tree to use three-phase reset, because device reset goes
through the device_legacy_reset() function that only calls the single
DeviceClass::reset method.

Switch to using the device_cold_reset() function instead.  This also
performs a recursive reset, where first the children are reset and
then finally the parent, but it uses the new (...in 2020...)
Resettable mechanism, which supports both the old style single-reset
method and also the new 3-phase reset handling.

This commit changes the five remaining uses of this function.

Commit created with:
 sed -i -e 's/qdev_reset_all/device_cold_reset/g' hw/i386/xen/xen_platform.c hw/input/adb.c hw/remote/vfio-user-obj.c hw/s390x/s390-virtio-ccw.c hw/usb/dev-uas.c

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/i386/xen/xen_platform.c
hw/input/adb.c
hw/remote/vfio-user-obj.c
hw/s390x/s390-virtio-ccw.c
hw/usb/dev-uas.c

index a64265cca073c0afcc69d179af7e69f1621c0936..7db0d94ec289d1430f68b1d3f88b44ab052ea5df 100644 (file)
@@ -177,7 +177,7 @@ static void pci_xen_ide_unplug(DeviceState *dev, bool aux)
             blk_unref(blk);
         }
     }
-    qdev_reset_all(dev);
+    device_cold_reset(dev);
 }
 
 static void unplug_disks(PCIBus *b, PCIDevice *d, void *opaque)
index 84331b9fce6fdbc89f8d812fc8dbef89eed8f104..214ae6f42b3e705ed97b1dd0c5adb62262d6ff94 100644 (file)
@@ -43,7 +43,7 @@ static const char *adb_commands[] = {
 
 static void adb_device_reset(ADBDevice *d)
 {
-    qdev_reset_all(DEVICE(d));
+    device_cold_reset(DEVICE(d));
 }
 
 static int do_adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf,
index 6d0310cec9789ec583e88489957b8cb7aba91757..fe1fdfb5f709049a0243c6c23b532baa9feba83e 100644 (file)
@@ -678,7 +678,7 @@ static int vfu_object_device_reset(vfu_ctx_t *vfu_ctx, vfu_reset_type_t type)
         return 0;
     }
 
-    qdev_reset_all(DEVICE(o->pci_dev));
+    device_cold_reset(DEVICE(o->pci_dev));
 
     return 0;
 }
index 2e64ffab45ef55bbb93ff61bcfd0d6632938b8ad..fab79045dd0c8438e999797171e96f93e5d3e255 100644 (file)
@@ -118,7 +118,7 @@ static void subsystem_reset(void)
     for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) {
         dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL));
         if (dev) {
-            qdev_reset_all(dev);
+            device_cold_reset(dev);
         }
     }
 }
index 5192b062d6f9321bcb42f0fe88d843606517b327..88f99c05d53d657558c31c7b5975215acbd68a1d 100644 (file)
@@ -791,7 +791,7 @@ static void usb_uas_task(UASDevice *uas, uas_iu *iu)
 
     case UAS_TMF_LOGICAL_UNIT_RESET:
         trace_usb_uas_tmf_logical_unit_reset(uas->dev.addr, tag, lun);
-        qdev_reset_all(&dev->qdev);
+        device_cold_reset(&dev->qdev);
         usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE);
         break;