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

@ -11,8 +11,11 @@
#define ASPEED_GPIO_H
#include "hw/sysbus.h"
#include "qom/object.h"
#define TYPE_ASPEED_GPIO "aspeed.gpio"
typedef struct AspeedGPIOClass AspeedGPIOClass;
typedef struct AspeedGPIOState AspeedGPIOState;
#define ASPEED_GPIO(obj) OBJECT_CHECK(AspeedGPIOState, (obj), TYPE_ASPEED_GPIO)
#define ASPEED_GPIO_CLASS(klass) \
OBJECT_CLASS_CHECK(AspeedGPIOClass, (klass), TYPE_ASPEED_GPIO)
@ -58,16 +61,16 @@ typedef struct AspeedGPIOReg {
enum GPIORegType type;
} AspeedGPIOReg;
typedef struct AspeedGPIOClass {
struct AspeedGPIOClass {
SysBusDevice parent_obj;
const GPIOSetProperties *props;
uint32_t nr_gpio_pins;
uint32_t nr_gpio_sets;
uint32_t gap;
const AspeedGPIOReg *reg_table;
} AspeedGPIOClass;
};
typedef struct AspeedGPIOState {
struct AspeedGPIOState {
/* <private> */
SysBusDevice parent;
@ -95,6 +98,6 @@ typedef struct AspeedGPIOState {
uint32_t debounce_2;
uint32_t input_mask;
} sets[ASPEED_GPIO_MAX_NR_SETS];
} AspeedGPIOState;
};
#endif /* _ASPEED_GPIO_H_ */

View file

@ -16,8 +16,9 @@
#include "hw/sd/sd.h"
#include "hw/sysbus.h"
#include "qom/object.h"
typedef struct BCM2835GpioState {
struct BCM2835GpioState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@ -31,7 +32,8 @@ typedef struct BCM2835GpioState {
uint32_t lev0, lev1;
uint8_t sd_fsel;
qemu_irq out[54];
} BCM2835GpioState;
};
typedef struct BCM2835GpioState BCM2835GpioState;
#define TYPE_BCM2835_GPIO "bcm2835_gpio"
#define BCM2835_GPIO(obj) \

View file

@ -21,8 +21,10 @@
#define IMX_GPIO_H
#include "hw/sysbus.h"
#include "qom/object.h"
#define TYPE_IMX_GPIO "imx.gpio"
typedef struct IMXGPIOState IMXGPIOState;
#define IMX_GPIO(obj) OBJECT_CHECK(IMXGPIOState, (obj), TYPE_IMX_GPIO)
#define IMX_GPIO_MEM_SIZE 0x20
@ -39,7 +41,7 @@
#define IMX_GPIO_PIN_COUNT 32
typedef struct IMXGPIOState {
struct IMXGPIOState {
/*< private >*/
SysBusDevice parent_obj;
@ -58,6 +60,6 @@ typedef struct IMXGPIOState {
qemu_irq irq[2];
qemu_irq output[IMX_GPIO_PIN_COUNT];
} IMXGPIOState;
};
#endif /* IMX_GPIO_H */

View file

@ -27,7 +27,9 @@
#define NRF51_GPIO_H
#include "hw/sysbus.h"
#include "qom/object.h"
#define TYPE_NRF51_GPIO "nrf51_soc.gpio"
typedef struct NRF51GPIOState NRF51GPIOState;
#define NRF51_GPIO(obj) OBJECT_CHECK(NRF51GPIOState, (obj), TYPE_NRF51_GPIO)
#define NRF51_GPIO_PINS 32
@ -47,7 +49,7 @@
#define NRF51_GPIO_PULLDOWN 1
#define NRF51_GPIO_PULLUP 3
typedef struct NRF51GPIOState {
struct NRF51GPIOState {
SysBusDevice parent_obj;
MemoryRegion mmio;
@ -63,7 +65,7 @@ typedef struct NRF51GPIOState {
uint32_t old_out_connected;
qemu_irq output[NRF51_GPIO_PINS];
} NRF51GPIOState;
};
#endif