aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2022-01-25 14:33:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2022-03-04 09:34:21 +0100
commitb6b0c066f5750c3c977b647509f225ba06038b60 (patch)
tree2411fd7989c7c318135821aa8046a9a6de91add1
parent37bf0654b8e6195e2255e7d5f737a66b0ef4d83f (diff)
usb/ohci: Merge ohci_async_cancel_device() into ohci_child_detach()
These two do the same and only used once so no need to have two functions, simplify by merging them. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <5fc8ba0bbf55703014d22dd06ab2f9eabaf370bf.1643117600.git.balaton@eik.bme.hu> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/hcd-ohci.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 190f5a8aba..09d07367cc 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1725,8 +1725,10 @@ static void ohci_attach(USBPort *port1)
}
}
-static void ohci_async_cancel_device(OHCIState *ohci, USBDevice *dev)
+static void ohci_child_detach(USBPort *port1, USBDevice *dev)
{
+ OHCIState *ohci = port1->opaque;
+
if (ohci->async_td &&
usb_packet_is_inflight(&ohci->usb_packet) &&
ohci->usb_packet.ep->dev == dev) {
@@ -1735,20 +1737,13 @@ static void ohci_async_cancel_device(OHCIState *ohci, USBDevice *dev)
}
}
-static void ohci_child_detach(USBPort *port1, USBDevice *child)
-{
- OHCIState *s = port1->opaque;
-
- ohci_async_cancel_device(s, child);
-}
-
static void ohci_detach(USBPort *port1)
{
OHCIState *s = port1->opaque;
OHCIPort *port = &s->rhport[port1->index];
uint32_t old_state = port->ctrl;
- ohci_async_cancel_device(s, port1->dev);
+ ohci_child_detach(port1, port1->dev);
/* set connect status */
if (port->ctrl & OHCI_PORT_CCS) {