summaryrefslogtreecommitdiffstats
path: root/hw/pci-bridge
diff options
context:
space:
mode:
authorEduardo Habkost2020-09-03 22:43:22 +0200
committerEduardo Habkost2020-09-09 15:26:43 +0200
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /hw/pci-bridge
parentDelete duplicate QOM typedefs (diff)
downloadqemu-db1015e92e04835c9eb50c29625fe566d1202dbd.tar.gz
qemu-db1015e92e04835c9eb50c29625fe566d1202dbd.tar.xz
qemu-db1015e92e04835c9eb50c29625fe566d1202dbd.zip
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/pci-bridge')
-rw-r--r--hw/pci-bridge/dec.c6
-rw-r--r--hw/pci-bridge/gen_pcie_root_port.c6
-rw-r--r--hw/pci-bridge/pci_bridge_dev.c3
-rw-r--r--hw/pci-bridge/pci_expander_bridge.c11
-rw-r--r--hw/pci-bridge/pcie_pci_bridge.c6
5 files changed, 21 insertions, 11 deletions
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index 677a310b96..b35866d8d1 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -32,12 +32,14 @@
#include "hw/pci/pci_host.h"
#include "hw/pci/pci_bridge.h"
#include "hw/pci/pci_bus.h"
+#include "qom/object.h"
+typedef struct DECState DECState;
#define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154)
-typedef struct DECState {
+struct DECState {
PCIHostState parent_obj;
-} DECState;
+};
static int dec_map_irq(PCIDevice *pci_dev, int irq_num)
{
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index bb26e272c1..b62e20a648 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -17,8 +17,10 @@
#include "hw/pci/pcie_port.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#define TYPE_GEN_PCIE_ROOT_PORT "pcie-root-port"
+typedef struct GenPCIERootPort GenPCIERootPort;
#define GEN_PCIE_ROOT_PORT(obj) \
OBJECT_CHECK(GenPCIERootPort, (obj), TYPE_GEN_PCIE_ROOT_PORT)
@@ -28,7 +30,7 @@
#define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
-typedef struct GenPCIERootPort {
+struct GenPCIERootPort {
/*< private >*/
PCIESlot parent_obj;
/*< public >*/
@@ -37,7 +39,7 @@ typedef struct GenPCIERootPort {
/* additional resources to reserve */
PCIResReserve res_reserve;
-} GenPCIERootPort;
+};
static uint8_t gen_rp_aer_vector(const PCIDevice *d)
{
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 4a080b7c7b..bd1b10c848 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -31,9 +31,11 @@
#include "exec/memory.h"
#include "hw/pci/pci_bus.h"
#include "hw/hotplug.h"
+#include "qom/object.h"
#define TYPE_PCI_BRIDGE_DEV "pci-bridge"
#define TYPE_PCI_BRIDGE_SEAT_DEV "pci-bridge-seat"
+typedef struct PCIBridgeDev PCIBridgeDev;
#define PCI_BRIDGE_DEV(obj) \
OBJECT_CHECK(PCIBridgeDev, (obj), TYPE_PCI_BRIDGE_DEV)
@@ -52,7 +54,6 @@ struct PCIBridgeDev {
/* additional resources to reserve */
PCIResReserve res_reserve;
};
-typedef struct PCIBridgeDev PCIBridgeDev;
static void pci_bridge_dev_realize(PCIDevice *dev, Error **errp)
{
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index 22f9fc223b..4a31ee3748 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -22,35 +22,38 @@
#include "qemu/module.h"
#include "sysemu/numa.h"
#include "hw/boards.h"
+#include "qom/object.h"
#define TYPE_PXB_BUS "pxb-bus"
+typedef struct PXBBus PXBBus;
#define PXB_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_BUS)
#define TYPE_PXB_PCIE_BUS "pxb-pcie-bus"
#define PXB_PCIE_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_PCIE_BUS)
-typedef struct PXBBus {
+struct PXBBus {
/*< private >*/
PCIBus parent_obj;
/*< public >*/
char bus_path[8];
-} PXBBus;
+};
#define TYPE_PXB_DEVICE "pxb"
+typedef struct PXBDev PXBDev;
#define PXB_DEV(obj) OBJECT_CHECK(PXBDev, (obj), TYPE_PXB_DEVICE)
#define TYPE_PXB_PCIE_DEVICE "pxb-pcie"
#define PXB_PCIE_DEV(obj) OBJECT_CHECK(PXBDev, (obj), TYPE_PXB_PCIE_DEVICE)
-typedef struct PXBDev {
+struct PXBDev {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
uint8_t bus_nr;
uint16_t numa_node;
-} PXBDev;
+};
static PXBDev *convert_to_pxb(PCIDevice *dev)
{
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index eade133968..1178cd8620 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -17,15 +17,17 @@
#include "hw/pci/shpc.h"
#include "hw/pci/slotid_cap.h"
#include "hw/qdev-properties.h"
+#include "qom/object.h"
-typedef struct PCIEPCIBridge {
+struct PCIEPCIBridge {
/*< private >*/
PCIBridge parent_obj;
OnOffAuto msi;
MemoryRegion shpc_bar;
/*< public >*/
-} PCIEPCIBridge;
+};
+typedef struct PCIEPCIBridge PCIEPCIBridge;
#define TYPE_PCIE_PCI_BRIDGE_DEV "pcie-pci-bridge"
#define PCIE_PCI_BRIDGE_DEV(obj) \