From nobody Mon Feb 9 09:35:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633123207815335.73228601669246; Fri, 1 Oct 2021 14:20:07 -0700 (PDT) Received: from localhost ([::1]:35206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWPws-0004gL-Mb for importer@patchew.org; Fri, 01 Oct 2021 17:20:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWPtw-0001yl-6f for qemu-devel@nongnu.org; Fri, 01 Oct 2021 17:17:04 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:46268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWPti-00084D-Q1 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 17:17:03 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 86B9D748F4E; Fri, 1 Oct 2021 23:16:49 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 910BF748F5A; Fri, 1 Oct 2021 23:16:42 +0200 (CEST) Message-Id: <3b131f4b448feed92422602a2b1cfe9a2d302810.1633122670.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [RFC PATCH 3/4] usb/ohci: Merge ohci_async_cancel_device() into ohci_child_detach() Date: Fri, 01 Oct 2021 23:11:10 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Gerd Hoffmann , Howard Spoelstra Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1633123209654100005 Content-Type: text/plain; charset="utf-8" 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 --- hw/usb/hcd-ohci.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index f8761370e3..212d0aabbe 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1719,8 +1719,10 @@ static void ohci_attach(USBPort *port1) } } =20 -static void ohci_async_cancel_device(OHCIState *ohci, USBDevice *dev) +static void ohci_child_detach(USBPort *port1, USBDevice *dev) { + OHCIState *ohci =3D port1->opaque; + if (ohci->async_td && usb_packet_is_inflight(&ohci->usb_packet) && ohci->usb_packet.ep->dev =3D=3D dev) { @@ -1729,20 +1731,13 @@ static void ohci_async_cancel_device(OHCIState *ohc= i, USBDevice *dev) } } =20 -static void ohci_child_detach(USBPort *port1, USBDevice *child) -{ - OHCIState *s =3D port1->opaque; - - ohci_async_cancel_device(s, child); -} - static void ohci_detach(USBPort *port1) { OHCIState *s =3D port1->opaque; OHCIPort *port =3D &s->rhport[port1->index]; uint32_t old_state =3D port->ctrl; =20 - ohci_async_cancel_device(s, port1->dev); + ohci_child_detach(port1, port1->dev); =20 /* set connect status */ if (port->ctrl & OHCI_PORT_CCS) { --=20 2.21.4