qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/9] hw/usb/hcd-ohci: Use OHCIState type definition
Date: Mon, 20 Feb 2023 16:05:08 +0100	[thread overview]
Message-ID: <20230220150515.32549-3-philmd@linaro.org> (raw)
In-Reply-To: <20230220150515.32549-1-philmd@linaro.org>

Forward-define the type first, then use it for the ohci_die() handler.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/hcd-ohci.c |  2 +-
 hw/usb/hcd-ohci.h | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 9d68036d23..7ecf9b15b7 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1827,7 +1827,7 @@ static USBBusOps ohci_bus_ops = {
 void usb_ohci_init(OHCIState *ohci, DeviceState *dev, uint32_t num_ports,
                    dma_addr_t localmem_base, char *masterbus,
                    uint32_t firstport, AddressSpace *as,
-                   void (*ohci_die_fn)(struct OHCIState *), Error **errp)
+                   void (*ohci_die_fn)(OHCIState *), Error **errp)
 {
     Error *err = NULL;
     int i;
diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
index 11ac57058d..8a9ba8b959 100644
--- a/hw/usb/hcd-ohci.h
+++ b/hw/usb/hcd-ohci.h
@@ -33,7 +33,9 @@ typedef struct OHCIPort {
     uint32_t ctrl;
 } OHCIPort;
 
-typedef struct OHCIState {
+typedef struct OHCIState OHCIState;
+
+struct OHCIState {
     USBBus bus;
     qemu_irq irq;
     MemoryRegion mem;
@@ -89,8 +91,8 @@ typedef struct OHCIState {
     uint32_t async_td;
     bool async_complete;
 
-    void (*ohci_die)(struct OHCIState *ohci);
-} OHCIState;
+    void (*ohci_die)(OHCIState *ohci);
+};
 
 #define TYPE_SYSBUS_OHCI "sysbus-ohci"
 OBJECT_DECLARE_SIMPLE_TYPE(OHCISysBusState, SYSBUS_OHCI)
@@ -112,7 +114,7 @@ extern const VMStateDescription vmstate_ohci_state;
 void usb_ohci_init(OHCIState *ohci, DeviceState *dev, uint32_t num_ports,
                    dma_addr_t localmem_base, char *masterbus,
                    uint32_t firstport, AddressSpace *as,
-                   void (*ohci_die_fn)(struct OHCIState *), Error **errp);
+                   void (*ohci_die_fn)(OHCIState *), Error **errp);
 void ohci_bus_stop(OHCIState *ohci);
 void ohci_stop_endpoints(OHCIState *ohci);
 void ohci_hard_reset(OHCIState *ohci);
-- 
2.38.1



  parent reply	other threads:[~2023-02-20 15:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 15:05 [PATCH 0/9] hw/usb: Cleanups around QOM style Philippe Mathieu-Daudé
2023-02-20 15:05 ` [PATCH 1/9] hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus Philippe Mathieu-Daudé
2023-02-20 19:08   ` Richard Henderson
2023-02-20 15:05 ` Philippe Mathieu-Daudé [this message]
2023-02-20 19:09   ` [PATCH 2/9] hw/usb/hcd-ohci: Use OHCIState type definition Richard Henderson
2023-02-20 15:05 ` [PATCH 3/9] hw/usb/hcd-ohci-pci: Use QOM type-safe cast conversion macro Philippe Mathieu-Daudé
2023-02-20 15:05 ` [PATCH 4/9] hw/usb/hcd-uhci: Declare QOM macros using OBJECT_DECLARE_TYPE() Philippe Mathieu-Daudé
2023-02-20 19:11   ` Richard Henderson
2023-02-20 15:05 ` [PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro Philippe Mathieu-Daudé
2023-02-20 19:11   ` Richard Henderson
2023-02-20 15:05 ` [PATCH 6/9] hw/usb/hcd-xhci-nec: Declare QOM macros for NEC_XHCI Philippe Mathieu-Daudé
2023-02-20 19:12   ` Richard Henderson
2023-02-20 15:05 ` [PATCH 7/9] hw/usb/hcd-xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro Philippe Mathieu-Daudé
2023-02-20 19:13   ` Richard Henderson
2023-02-20 15:05 ` [PATCH 8/9] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE() Philippe Mathieu-Daudé
2023-02-20 19:22   ` Richard Henderson
2023-02-20 15:05 ` [PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros Philippe Mathieu-Daudé

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=20230220150515.32549-3-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=armbru@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).