[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 082/126] hw/usb/ohci: Move a function next to where it is used
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 082/126] hw/usb/ohci: Move a function next to where it is used |
Date: |
Mon, 27 Feb 2023 15:01:29 +0100 |
From: BALATON Zoltan <balaton@eik.bme.hu>
The ohci_port_set_if_connected() function is only used by
ohci_port_set_status(), move next to it to have them at the same place.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id:
<46411d4980ab0fba61ab0d2209a939fdc41eb573.1676916640.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ohci.c | 60 +++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index b7877866f6..2a52aace80 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1271,36 +1271,6 @@ void ohci_bus_stop(OHCIState *ohci)
timer_del(ohci->eof_timer);
}
-/*
- * Sets a flag in a port status reg but only set it if the port is connected.
- * If not set ConnectStatusChange flag. If flag is enabled return 1.
- */
-static int ohci_port_set_if_connected(OHCIState *ohci, int i, uint32_t val)
-{
- int ret = 1;
-
- /* writing a 0 has no effect */
- if (val == 0) {
- return 0;
- }
- /* If CurrentConnectStatus is cleared we set ConnectStatusChange */
- if (!(ohci->rhport[i].ctrl & OHCI_PORT_CCS)) {
- ohci->rhport[i].ctrl |= OHCI_PORT_CSC;
- if (ohci->rhstatus & OHCI_RHS_DRWE) {
- /* TODO: CSC is a wakeup event */
- }
- return 0;
- }
-
- if (ohci->rhport[i].ctrl & val) {
- ret = 0;
- }
- /* set the bit */
- ohci->rhport[i].ctrl |= val;
-
- return ret;
-}
-
/* Frame interval toggle is manipulated by the hcd only */
static void ohci_set_frame_interval(OHCIState *ohci, uint16_t val)
{
@@ -1422,6 +1392,36 @@ static void ohci_set_hub_status(OHCIState *ohci,
uint32_t val)
}
}
+/*
+ * Sets a flag in a port status reg but only set it if the port is connected.
+ * If not set ConnectStatusChange flag. If flag is enabled return 1.
+ */
+static int ohci_port_set_if_connected(OHCIState *ohci, int i, uint32_t val)
+{
+ int ret = 1;
+
+ /* writing a 0 has no effect */
+ if (val == 0) {
+ return 0;
+ }
+ /* If CurrentConnectStatus is cleared we set ConnectStatusChange */
+ if (!(ohci->rhport[i].ctrl & OHCI_PORT_CCS)) {
+ ohci->rhport[i].ctrl |= OHCI_PORT_CSC;
+ if (ohci->rhstatus & OHCI_RHS_DRWE) {
+ /* TODO: CSC is a wakeup event */
+ }
+ return 0;
+ }
+
+ if (ohci->rhport[i].ctrl & val) {
+ ret = 0;
+ }
+ /* set the bit */
+ ohci->rhport[i].ctrl |= val;
+
+ return ret;
+}
+
/* Set root hub port status */
static void ohci_port_set_status(OHCIState *ohci, int portnum, uint32_t val)
{
--
2.38.1
- [PULL 071/126] hw/audio/es1370: Avoid forward-declaring ES1370State, (continued)
- [PULL 071/126] hw/audio/es1370: Avoid forward-declaring ES1370State, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 072/126] hw/audio/es1370: Replace container_of() by ES1370() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 073/126] hw/audio/ac97: Replace container_of() by AC97() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 075/126] hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 074/126] hw/audio/ac97: Split off some definitions to a header, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 076/126] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 077/126] hw/usb/ohci: Include missing 'sysbus.h' header, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 078/126] hw/usb/ohci: Use OHCIState type definition, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 080/126] hw/usb/ohci: Code style fix white space errors, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 081/126] hw/usb/ohci: Code style fix missing braces and extra parenthesis, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 082/126] hw/usb/ohci: Move a function next to where it is used,
Philippe Mathieu-Daudé <=
- [PULL 079/126] hw/usb/ohci: Code style fix comments, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 083/126] hw/usb/ohci: Add trace points for register access, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 084/126] hw/usb/ohci: Fix typo, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 087/126] hw/usb/xhci-nec: Declare QOM macros for NEC_XHCI, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 089/126] hw/display/sm501: Embed OHCI QOM child in chipset, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 086/126] hw/usb/uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 088/126] hw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 090/126] hw/display/sm501: Alias 'dma-offset' QOM property in chipset object, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 085/126] hw/usb/uhci: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 091/126] hw/display/sm501: Implement more 2D raster operations, Philippe Mathieu-Daudé, 2023/02/27