hw/usb/hcd-xhci: Reset the XHCIState with device_cold_reset()
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 14 Oct 2022 14:54:23 +0000 (15:54 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 23 Nov 2022 11:28:51 +0000 (12:28 +0100)
Currently the hcd-xhci-pci and hcd-xhci-sysbus devices, which are
mostly wrappers around the TYPE_XHCI device, which is a direct
subclass of TYPE_DEVICE.  Since TYPE_DEVICE devices are not on any
qbus and do not get automatically reset, the wrapper devices both
reset the TYPE_XHCI device in their own reset functions.  However,
they do this using device_legacy_reset(), which will reset the device
itself but not any bus it has.

Switch to device_cold_reset(), which avoids using a deprecated
function and also propagates reset along any child buses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20221014145423.2102706-1-peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci-pci.c
hw/usb/hcd-xhci-sysbus.c

index e934b1a5b1fbbf38a588e4299a77e780fb3b9055..643d4643e4d6cdfe660c6cc169874bd37799bf5a 100644 (file)
@@ -85,7 +85,7 @@ static void xhci_pci_reset(DeviceState *dev)
 {
     XHCIPciState *s = XHCI_PCI(dev);
 
-    device_legacy_reset(DEVICE(&s->xhci));
+    device_cold_reset(DEVICE(&s->xhci));
 }
 
 static int xhci_pci_vmstate_post_load(void *opaque, int version_id)
index a14e4381960ef5d34d0567ed1b58eb55375a3e61..faf57b47975dc53dc43bd8fb1c6bd06451eb085b 100644 (file)
@@ -29,7 +29,7 @@ void xhci_sysbus_reset(DeviceState *dev)
 {
     XHCISysbusState *s = XHCI_SYSBUS(dev);
 
-    device_legacy_reset(DEVICE(&s->xhci));
+    device_cold_reset(DEVICE(&s->xhci));
 }
 
 static void xhci_sysbus_realize(DeviceState *dev, Error **errp)