Hi Peter,

On 13/8/24 18:52, Peter Maydell wrote:
Convert the virtio-ccw code to three-phase reset.  This allows us to
remove a call to device_class_set_parent_reset(), replacing it with
the three-phase equivalent resettable_class_set_parent_phases().
Removing all the device_class_set_parent_reset() uses will allow us
to remove some of the glue code that interworks between three-phase
and legacy reset.

This is a simple conversion, with no behavioural changes.

Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
---
It looks a little odd that we do the this-class reset first
and then chain up to the parent's reset, but that's what the
existing code does, so I left it alone.

Do you plan to post a follow up patch inverting the
call order? Otherwise, could you add a comment in the
code so we don't forget about this odd case?

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>

---
  hw/s390x/virtio-ccw.h |  2 +-
  hw/s390x/virtio-ccw.c | 13 ++++++++-----
  2 files changed, 9 insertions(+), 6 deletions(-)


-static void virtio_ccw_reset(DeviceState *d)
+static void virtio_ccw_reset_hold(Object *obj, ResetType type)
  {
-    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
+    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(obj);
      VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
virtio_ccw_reset_virtio(dev);
-    if (vdc->parent_reset) {
-        vdc->parent_reset(d);
+
+    if (vdc->parent_phases.hold) {
+        vdc->parent_phases.hold(obj, type);
      }
  }


Reply via email to