aboutsummaryrefslogtreecommitdiff
path: root/include/hw/sd
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /include/hw/sd
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
downloadqemu-db1015e92e04835c9eb50c29625fe566d1202dbd.zip
qemu-db1015e92e04835c9eb50c29625fe566d1202dbd.tar.gz
qemu-db1015e92e04835c9eb50c29625fe566d1202dbd.tar.bz2
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 'include/hw/sd')
-rw-r--r--include/hw/sd/allwinner-sdhost.h10
-rw-r--r--include/hw/sd/aspeed_sdhci.h6
-rw-r--r--include/hw/sd/bcm2835_sdhost.h6
-rw-r--r--include/hw/sd/sd.h11
-rw-r--r--include/hw/sd/sdhci.h6
5 files changed, 25 insertions, 14 deletions
diff --git a/include/hw/sd/allwinner-sdhost.h b/include/hw/sd/allwinner-sdhost.h
index 839732e..b23de2c 100644
--- a/include/hw/sd/allwinner-sdhost.h
+++ b/include/hw/sd/allwinner-sdhost.h
@@ -45,6 +45,8 @@
* @{
*/
+typedef struct AwSdHostClass AwSdHostClass;
+typedef struct AwSdHostState AwSdHostState;
#define AW_SDHOST(obj) \
OBJECT_CHECK(AwSdHostState, (obj), TYPE_AW_SDHOST)
#define AW_SDHOST_CLASS(klass) \
@@ -57,7 +59,7 @@
/**
* Allwinner SD Host Controller object instance state.
*/
-typedef struct AwSdHostState {
+struct AwSdHostState {
/*< private >*/
SysBusDevice busdev;
/*< public >*/
@@ -119,7 +121,7 @@ typedef struct AwSdHostState {
/** @} */
-} AwSdHostState;
+};
/**
* Allwinner SD Host Controller class-level struct.
@@ -128,7 +130,7 @@ typedef struct AwSdHostState {
* such that the generic code can use this struct to support
* all devices.
*/
-typedef struct AwSdHostClass {
+struct AwSdHostClass {
/*< private >*/
SysBusDeviceClass parent_class;
/*< public >*/
@@ -136,6 +138,6 @@ typedef struct AwSdHostClass {
/** Maximum buffer size in bytes per DMA descriptor */
size_t max_desc_size;
-} AwSdHostClass;
+};
#endif /* HW_SD_ALLWINNER_SDHOST_H */
diff --git a/include/hw/sd/aspeed_sdhci.h b/include/hw/sd/aspeed_sdhci.h
index dffbb46..5270754 100644
--- a/include/hw/sd/aspeed_sdhci.h
+++ b/include/hw/sd/aspeed_sdhci.h
@@ -10,8 +10,10 @@
#define ASPEED_SDHCI_H
#include "hw/sd/sdhci.h"
+#include "qom/object.h"
#define TYPE_ASPEED_SDHCI "aspeed.sdhci"
+typedef struct AspeedSDHCIState AspeedSDHCIState;
#define ASPEED_SDHCI(obj) OBJECT_CHECK(AspeedSDHCIState, (obj), \
TYPE_ASPEED_SDHCI)
@@ -20,7 +22,7 @@
#define ASPEED_SDHCI_NUM_REGS (ASPEED_SDHCI_REG_SIZE / sizeof(uint32_t))
#define ASPEED_SDHCI_REG_SIZE 0x100
-typedef struct AspeedSDHCIState {
+struct AspeedSDHCIState {
SysBusDevice parent;
SDHCIState slots[ASPEED_SDHCI_NUM_SLOTS];
@@ -30,6 +32,6 @@ typedef struct AspeedSDHCIState {
qemu_irq irq;
uint32_t regs[ASPEED_SDHCI_NUM_REGS];
-} AspeedSDHCIState;
+};
#endif /* ASPEED_SDHCI_H */
diff --git a/include/hw/sd/bcm2835_sdhost.h b/include/hw/sd/bcm2835_sdhost.h
index 7520dd6..233e74b 100644
--- a/include/hw/sd/bcm2835_sdhost.h
+++ b/include/hw/sd/bcm2835_sdhost.h
@@ -16,14 +16,16 @@
#include "hw/sysbus.h"
#include "hw/sd/sd.h"
+#include "qom/object.h"
#define TYPE_BCM2835_SDHOST "bcm2835-sdhost"
+typedef struct BCM2835SDHostState BCM2835SDHostState;
#define BCM2835_SDHOST(obj) \
OBJECT_CHECK(BCM2835SDHostState, (obj), TYPE_BCM2835_SDHOST)
#define BCM2835_SDHOST_FIFO_LEN 16
-typedef struct {
+struct BCM2835SDHostState {
SysBusDevice busdev;
SDBus sdbus;
MemoryRegion iomem;
@@ -43,6 +45,6 @@ typedef struct {
uint32_t datacnt;
qemu_irq irq;
-} BCM2835SDHostState;
+};
#endif
diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h
index ac02d61..850740e 100644
--- a/include/hw/sd/sd.h
+++ b/include/hw/sd/sd.h
@@ -31,6 +31,7 @@
#define HW_SD_H
#include "hw/qdev-core.h"
+#include "qom/object.h"
#define OUT_OF_RANGE (1 << 31)
#define ADDRESS_ERROR (1 << 30)
@@ -92,13 +93,14 @@ typedef struct SDState SDState;
typedef struct SDBus SDBus;
#define TYPE_SD_CARD "sd-card"
+typedef struct SDCardClass SDCardClass;
#define SD_CARD(obj) OBJECT_CHECK(SDState, (obj), TYPE_SD_CARD)
#define SD_CARD_CLASS(klass) \
OBJECT_CLASS_CHECK(SDCardClass, (klass), TYPE_SD_CARD)
#define SD_CARD_GET_CLASS(obj) \
OBJECT_GET_CLASS(SDCardClass, (obj), TYPE_SD_CARD)
-typedef struct {
+struct SDCardClass {
/*< private >*/
DeviceClass parent_class;
/*< public >*/
@@ -128,9 +130,10 @@ typedef struct {
void (*enable)(SDState *sd, bool enable);
bool (*get_inserted)(SDState *sd);
bool (*get_readonly)(SDState *sd);
-} SDCardClass;
+};
#define TYPE_SD_BUS "sd-bus"
+typedef struct SDBusClass SDBusClass;
#define SD_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_SD_BUS)
#define SD_BUS_CLASS(klass) OBJECT_CLASS_CHECK(SDBusClass, (klass), TYPE_SD_BUS)
#define SD_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(SDBusClass, (obj), TYPE_SD_BUS)
@@ -139,7 +142,7 @@ struct SDBus {
BusState qbus;
};
-typedef struct {
+struct SDBusClass {
/*< private >*/
BusClass parent_class;
/*< public >*/
@@ -149,7 +152,7 @@ typedef struct {
*/
void (*set_inserted)(DeviceState *dev, bool inserted);
void (*set_readonly)(DeviceState *dev, bool readonly);
-} SDBusClass;
+};
/* Functions to be used by qdevified callers (working via
* an SDBus rather than directly with SDState)
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index 5d9275f..67b01fc 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -28,9 +28,10 @@
#include "hw/pci/pci.h"
#include "hw/sysbus.h"
#include "hw/sd/sd.h"
+#include "qom/object.h"
/* SD/MMC host controller state */
-typedef struct SDHCIState {
+struct SDHCIState {
/*< private >*/
union {
PCIDevice pcidev;
@@ -98,7 +99,8 @@ typedef struct SDHCIState {
uint8_t sd_spec_version;
uint8_t uhs_mode;
uint8_t vendor; /* For vendor specific functionality */
-} SDHCIState;
+};
+typedef struct SDHCIState SDHCIState;
#define SDHCI_VENDOR_NONE 0
#define SDHCI_VENDOR_IMX 1