All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH v2 2/5] usb/ohci: Move cancelling async packet to ohci_stop_endpoints()
Date: Tue, 25 Jan 2022 14:33:20 +0100	[thread overview]
Message-ID: <ce766722506bfd7145cccbec750692ff57072280.1643117600.git.balaton@eik.bme.hu> (raw)
In-Reply-To: <cover.1643117600.git.balaton@eik.bme.hu>

This is always done before calling this function so remove duplicated
code and do it within the function at one place.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/usb/hcd-ohci.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index f915cc5473..6d762973eb 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -369,6 +369,10 @@ void ohci_stop_endpoints(OHCIState *ohci)
     USBDevice *dev;
     int i, j;
 
+    if (ohci->async_td) {
+        usb_cancel_packet(&ohci->usb_packet);
+        ohci->async_td = 0;
+    }
     for (i = 0; i < ohci->num_ports; i++) {
         dev = ohci->rhport[i].port.dev;
         if (dev && dev->attached) {
@@ -398,10 +402,6 @@ static void ohci_roothub_reset(OHCIState *ohci)
             usb_port_reset(&port->port);
         }
     }
-    if (ohci->async_td) {
-        usb_cancel_packet(&ohci->usb_packet);
-        ohci->async_td = 0;
-    }
     ohci_stop_endpoints(ohci);
 }
 
@@ -1277,10 +1277,6 @@ static void ohci_frame_boundary(void *opaque)
 
     /* Cancel all pending packets if either of the lists has been disabled.  */
     if (ohci->old_ctl & (~ohci->ctl) & (OHCI_CTL_BLE | OHCI_CTL_CLE)) {
-        if (ohci->async_td) {
-            usb_cancel_packet(&ohci->usb_packet);
-            ohci->async_td = 0;
-        }
         ohci_stop_endpoints(ohci);
     }
     ohci->old_ctl = ohci->ctl;
-- 
2.30.2



  reply	other threads:[~2022-01-25 15:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 13:33 [PATCH v2 0/5] Misc OHCI clean ups BALATON Zoltan
2022-01-25 13:33 ` BALATON Zoltan [this message]
2022-01-25 13:33 ` [PATCH v2 5/5] usb/ohci: Don't use packet from OHCIState for isochronous transfers BALATON Zoltan
2022-01-25 13:33 ` [PATCH v2 4/5] usb/ohci: Merge ohci_async_cancel_device() into ohci_child_detach() BALATON Zoltan
2022-01-25 13:33 ` [PATCH v2 3/5] usb/ohci: Move USBPortOps related functions together BALATON Zoltan
2022-01-25 13:33 ` [PATCH v2 1/5] usb/ohci: Move trace point and log ep number to help debugging BALATON Zoltan
2022-02-08  9:35 ` [PATCH v2 0/5] Misc OHCI clean ups BALATON Zoltan
2022-02-16 12:27   ` BALATON Zoltan
2022-02-25 11:08     ` BALATON Zoltan
2022-03-02 23:11       ` BALATON Zoltan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce766722506bfd7145cccbec750692ff57072280.1643117600.git.balaton@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.