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>
This commit is contained in:
Eduardo Habkost 2020-09-03 16:43:22 -04:00
parent 1c8eef0227
commit db1015e92e
796 changed files with 3378 additions and 1823 deletions

View file

@ -16,6 +16,7 @@
#include "migration/vmstate.h"
#include "qemu/bcd.h"
#include "qemu/module.h"
#include "qom/object.h"
/* Size of NVRAM including both the user-accessible area and the
* secondary register area.
@ -29,9 +30,10 @@
#define CTRL_OSF 0x20
#define TYPE_DS1338 "ds1338"
typedef struct DS1338State DS1338State;
#define DS1338(obj) OBJECT_CHECK(DS1338State, (obj), TYPE_DS1338)
typedef struct DS1338State {
struct DS1338State {
I2CSlave parent_obj;
int64_t offset;
@ -39,7 +41,7 @@ typedef struct DS1338State {
uint8_t nvram[NVRAM_SIZE];
int32_t ptr;
bool addr_byte;
} DS1338State;
};
static const VMStateDescription vmstate_ds1338 = {
.name = "ds1338",

View file

@ -38,6 +38,7 @@
#include "hw/irq.h"
#include "hw/arm/exynos4210.h"
#include "qom/object.h"
#define DEBUG_RTC 0
@ -84,10 +85,11 @@
#define RTC_BASE_FREQ 32768
#define TYPE_EXYNOS4210_RTC "exynos4210.rtc"
typedef struct Exynos4210RTCState Exynos4210RTCState;
#define EXYNOS4210_RTC(obj) \
OBJECT_CHECK(Exynos4210RTCState, (obj), TYPE_EXYNOS4210_RTC)
typedef struct Exynos4210RTCState {
struct Exynos4210RTCState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@ -113,7 +115,7 @@ typedef struct Exynos4210RTCState {
qemu_irq alm_irq; /* alarm irq */
struct tm current_tm; /* current time */
} Exynos4210RTCState;
};
#define TICCKSEL(value) ((value & (0x0F << 4)) >> 4)

View file

@ -14,14 +14,16 @@
#include "qemu/timer.h"
#include "qemu/bcd.h"
#include "hw/i2c/i2c.h"
#include "qom/object.h"
#define TYPE_M41T80 "m41t80"
typedef struct M41t80State M41t80State;
#define M41T80(obj) OBJECT_CHECK(M41t80State, (obj), TYPE_M41T80)
typedef struct M41t80State {
struct M41t80State {
I2CSlave parent_obj;
int8_t addr;
} M41t80State;
};
static void m41t80_realize(DeviceState *dev, Error **errp)
{

View file

@ -30,8 +30,11 @@
#include "m48t59-internal.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qom/object.h"
#define TYPE_M48TXX_ISA "isa-m48txx"
typedef struct M48txxISADeviceClass M48txxISADeviceClass;
typedef struct M48txxISAState M48txxISAState;
#define M48TXX_ISA_GET_CLASS(obj) \
OBJECT_GET_CLASS(M48txxISADeviceClass, (obj), TYPE_M48TXX_ISA)
#define M48TXX_ISA_CLASS(klass) \
@ -39,17 +42,17 @@
#define M48TXX_ISA(obj) \
OBJECT_CHECK(M48txxISAState, (obj), TYPE_M48TXX_ISA)
typedef struct M48txxISAState {
struct M48txxISAState {
ISADevice parent_obj;
M48t59State state;
uint32_t io_base;
MemoryRegion io;
} M48txxISAState;
};
typedef struct M48txxISADeviceClass {
struct M48txxISADeviceClass {
ISADeviceClass parent_class;
M48txxInfo info;
} M48txxISADeviceClass;
};
static M48txxInfo m48txx_isa_info[] = {
{

View file

@ -40,8 +40,11 @@
#include "m48t59-internal.h"
#include "migration/vmstate.h"
#include "qom/object.h"
#define TYPE_M48TXX_SYS_BUS "sysbus-m48txx"
typedef struct M48txxSysBusDeviceClass M48txxSysBusDeviceClass;
typedef struct M48txxSysBusState M48txxSysBusState;
#define M48TXX_SYS_BUS_GET_CLASS(obj) \
OBJECT_GET_CLASS(M48txxSysBusDeviceClass, (obj), TYPE_M48TXX_SYS_BUS)
#define M48TXX_SYS_BUS_CLASS(klass) \
@ -56,16 +59,16 @@
* http://www.st.com/stonline/products/literature/od/7001/m48t59y.pdf
*/
typedef struct M48txxSysBusState {
struct M48txxSysBusState {
SysBusDevice parent_obj;
M48t59State state;
MemoryRegion io;
} M48txxSysBusState;
};
typedef struct M48txxSysBusDeviceClass {
struct M48txxSysBusDeviceClass {
SysBusDeviceClass parent_class;
M48txxInfo info;
} M48txxSysBusDeviceClass;
};
static M48txxInfo m48txx_sysbus_info[] = {
{

View file

@ -16,16 +16,18 @@
#include "qemu/timer.h"
#include "hw/rtc/sun4v-rtc.h"
#include "trace.h"
#include "qom/object.h"
#define TYPE_SUN4V_RTC "sun4v_rtc"
typedef struct Sun4vRtc Sun4vRtc;
#define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC)
typedef struct Sun4vRtc {
struct Sun4vRtc {
SysBusDevice parent_obj;
MemoryRegion iomem;
} Sun4vRtc;
};
static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
unsigned size)

View file

@ -29,13 +29,15 @@
#include "sysemu/sysemu.h"
#include "qemu/bcd.h"
#include "qemu/module.h"
#include "qom/object.h"
#define VERBOSE 1
#define TYPE_TWL92230 "twl92230"
typedef struct MenelausState MenelausState;
#define TWL92230(obj) OBJECT_CHECK(MenelausState, (obj), TYPE_TWL92230)
typedef struct MenelausState {
struct MenelausState {
I2CSlave parent_obj;
int firstbyte;
@ -71,7 +73,7 @@ typedef struct MenelausState {
uint16_t rtc_next_vmstate;
qemu_irq out[4];
uint8_t pwrbtn_state;
} MenelausState;
};
static inline void menelaus_update(MenelausState *s)
{