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

@ -60,6 +60,8 @@
* @{
*/
typedef struct AwRtcClass AwRtcClass;
typedef struct AwRtcState AwRtcState;
#define AW_RTC(obj) \
OBJECT_CHECK(AwRtcState, (obj), TYPE_AW_RTC)
#define AW_RTC_CLASS(klass) \
@ -72,7 +74,7 @@
/**
* Allwinner RTC per-object instance state.
*/
typedef struct AwRtcState {
struct AwRtcState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@ -92,7 +94,7 @@ typedef struct AwRtcState {
/** Array of hardware registers */
uint32_t regs[AW_RTC_REGS_NUM];
} AwRtcState;
};
/**
* Allwinner RTC class-level struct.
@ -101,7 +103,7 @@ typedef struct AwRtcState {
* such that the generic code can use this struct to support
* all devices.
*/
typedef struct AwRtcClass {
struct AwRtcClass {
/*< private >*/
SysBusDeviceClass parent_class;
/*< public >*/
@ -129,6 +131,6 @@ typedef struct AwRtcClass {
*/
bool (*write)(AwRtcState *s, uint32_t offset, uint32_t data);
} AwRtcClass;
};
#endif /* HW_MISC_ALLWINNER_RTC_H */

View file

@ -9,8 +9,9 @@
#define HW_RTC_ASPEED_RTC_H
#include "hw/sysbus.h"
#include "qom/object.h"
typedef struct AspeedRtcState {
struct AspeedRtcState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@ -19,7 +20,8 @@ typedef struct AspeedRtcState {
uint32_t reg[0x18];
int offset;
} AspeedRtcState;
};
typedef struct AspeedRtcState AspeedRtcState;
#define TYPE_ASPEED_RTC "aspeed.rtc"
#define ASPEED_RTC(obj) OBJECT_CHECK(AspeedRtcState, (obj), TYPE_ASPEED_RTC)

View file

@ -23,12 +23,14 @@
#define HW_RTC_GOLDFISH_RTC_H
#include "hw/sysbus.h"
#include "qom/object.h"
#define TYPE_GOLDFISH_RTC "goldfish_rtc"
typedef struct GoldfishRTCState GoldfishRTCState;
#define GOLDFISH_RTC(obj) \
OBJECT_CHECK(GoldfishRTCState, (obj), TYPE_GOLDFISH_RTC)
typedef struct GoldfishRTCState {
struct GoldfishRTCState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@ -42,6 +44,6 @@ typedef struct GoldfishRTCState {
uint32_t irq_pending;
uint32_t irq_enabled;
uint32_t time_high;
} GoldfishRTCState;
};
#endif

View file

@ -31,6 +31,7 @@
#define TYPE_NVRAM "nvram"
typedef struct NvramClass NvramClass;
#define NVRAM_CLASS(klass) \
OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM)
#define NVRAM_GET_CLASS(obj) \
@ -40,13 +41,13 @@
typedef struct Nvram Nvram;
typedef struct NvramClass {
struct NvramClass {
InterfaceClass parent;
uint32_t (*read)(Nvram *obj, uint32_t addr);
void (*write)(Nvram *obj, uint32_t addr, uint32_t val);
void (*toggle_lock)(Nvram *obj, int lock);
} NvramClass;
};
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
int base_year, int type);

View file

@ -13,11 +13,13 @@
#include "qemu/queue.h"
#include "qemu/timer.h"
#include "hw/isa/isa.h"
#include "qom/object.h"
#define TYPE_MC146818_RTC "mc146818rtc"
typedef struct RTCState RTCState;
#define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC)
typedef struct RTCState {
struct RTCState {
ISADevice parent_obj;
MemoryRegion io;
@ -44,7 +46,7 @@ typedef struct RTCState {
LostTickPolicy lost_tick_policy;
Notifier suspend_notifier;
QLIST_ENTRY(RTCState) link;
} RTCState;
};
#define RTC_ISA_IRQ 8
#define RTC_ISA_BASE 0x70

View file

@ -16,11 +16,13 @@
#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "qom/object.h"
#define TYPE_PL031 "pl031"
typedef struct PL031State PL031State;
#define PL031(obj) OBJECT_CHECK(PL031State, (obj), TYPE_PL031)
typedef struct PL031State {
struct PL031State {
SysBusDevice parent_obj;
MemoryRegion iomem;
@ -42,6 +44,6 @@ typedef struct PL031State {
uint32_t cr;
uint32_t im;
uint32_t is;
} PL031State;
};
#endif

View file

@ -29,9 +29,11 @@
#include "hw/register.h"
#include "hw/sysbus.h"
#include "qom/object.h"
#define TYPE_XLNX_ZYNQMP_RTC "xlnx-zynmp.rtc"
typedef struct XlnxZynqMPRTC XlnxZynqMPRTC;
#define XLNX_ZYNQMP_RTC(obj) \
OBJECT_CHECK(XlnxZynqMPRTC, (obj), TYPE_XLNX_ZYNQMP_RTC)
@ -77,7 +79,7 @@ REG32(SAFETY_CHK, 0x50)
#define XLNX_ZYNQMP_RTC_R_MAX (R_SAFETY_CHK + 1)
typedef struct XlnxZynqMPRTC {
struct XlnxZynqMPRTC {
SysBusDevice parent_obj;
MemoryRegion iomem;
qemu_irq irq_rtc_int;
@ -87,6 +89,6 @@ typedef struct XlnxZynqMPRTC {
uint32_t regs[XLNX_ZYNQMP_RTC_R_MAX];
RegisterInfo regs_info[XLNX_ZYNQMP_RTC_R_MAX];
} XlnxZynqMPRTC;
};
#endif