[PULL 03/17] sifive: Move QOM typedefs and add missing includes

Eduardo Habkost posted 17 patches 5 years, 4 months ago
Maintainers: Max Reitz <mreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marek Vasut <marex@denx.de>, Juan Quintela <quintela@redhat.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Andrew Jeffery <andrew@aj.id.au>, Peter Chubb <peter.chubb@nicta.com.au>, Eric Auger <eric.auger@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, BALATON Zoltan <balaton@eik.bme.hu>, Thomas Huth <huth@tuxfamily.org>, Laurent Vivier <lvivier@redhat.com>, Michael Rolnik <mrolnik@gmail.com>, Sarah Harris <S.E.Harris@kent.ac.uk>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Jason Wang <jasowang@redhat.com>, Li Zhijian <lizhijian@cn.fujitsu.com>, Alistair Francis <alistair@alistair23.me>, Kevin Wolf <kwolf@redhat.com>, Beniamino Galvani <b.galvani@gmail.com>, Thomas Huth <thuth@redhat.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Greg Kurz <groug@kaod.org>, Michael Walle <michael@walle.cc>, Igor Mitsyanko <i.mitsyanko@gmail.com>, KONRAD Frederic <frederic.konrad@adacore.com>, Stefan Hajnoczi <stefanha@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Corey Minyard <cminyard@mvista.com>, Chris Wulff <crwulff@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Stefano Stabellini <sstabellini@kernel.org>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Ben Warren <ben@skyportsystems.com>, Joel Stanley <joel@jms.id.au>, Yoshinori Sato <ysato@users.sourceforge.jp>, Zhang Chen <chen.zhang@intel.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Jan Kiszka <jan.kiszka@web.de>, Rob Herring <robh@kernel.org>, Amit Shah <amit@kernel.org>, Pierre Morel <pmorel@linux.ibm.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Aurelien Jarno <aurelien@aurel32.net>, Niek Linnenbank <nieklinnenbank@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, Igor Mammedov <imammedo@redhat.com>, Helge Deller <deller@gmx.de>, Palmer Dabbelt <palmer@dabbelt.com>, David Hildenbrand <david@redhat.com>, Alberto Garcia <berto@igalia.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, "Daniel P. Berrangé" <berrange@redhat.com>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Richard Henderson <rth@twiddle.net>, Radoslaw Biernacki <rad@semihalf.com>, Fabien Chouteau <chouteau@adacore.com>, Max Filippov <jcmvbkbc@gmail.com>, Andrzej Zaborowski <balrogg@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Antony Pavlov <antonynpavlov@gmail.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Anthony Perard <anthony.perard@citrix.com>, Artyom Tarasenko <atar4qemu@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Eric Farman <farman@linux.ibm.com>, Andrew Baumann <Andrew.Baumann@microsoft.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Huacai Chen <chenhc@lemote.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, David Gibson <david@gibson.dropbear.id.au>, "Hervé Poussineau" <hpoussin@reactos.org>, Paul Burton <paulburton@kernel.org>, Sven Schnelle <svens@stackframe.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Peter Xu <peterx@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Anup Patel <anup.patel@wdc.com>, Fam Zheng <fam@euphon.net>, Laszlo Ersek <lersek@redhat.com>, Alistair Francis <Alistair.Francis@wdc.com>, Alex Williamson <alex.williamson@redhat.com>, Leif Lindholm <leif@nuviainc.com>, Stefan Berger <stefanb@linux.ibm.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, Paul Durrant <paul@xen.org>
[PULL 03/17] sifive: Move QOM typedefs and add missing includes
Posted by Eduardo Habkost 5 years, 4 months ago
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

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200831210740.126168-9-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/intc/sifive_plic.h           | 6 ++++--
 include/hw/char/sifive_uart.h   | 6 ++++--
 include/hw/gpio/sifive_gpio.h   | 6 ++++--
 include/hw/misc/sifive_e_prci.h | 6 ++++--
 include/hw/misc/sifive_test.h   | 6 ++++--
 include/hw/misc/sifive_u_otp.h  | 6 ++++--
 include/hw/misc/sifive_u_prci.h | 6 ++++--
 7 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/hw/intc/sifive_plic.h b/hw/intc/sifive_plic.h
index ace76d0f1b..aa6ae13c3a 100644
--- a/hw/intc/sifive_plic.h
+++ b/hw/intc/sifive_plic.h
@@ -22,9 +22,11 @@
 #define HW_SIFIVE_PLIC_H
 
 #include "hw/sysbus.h"
+#include "qom/object.h"
 
 #define TYPE_SIFIVE_PLIC "riscv.sifive.plic"
 
+typedef struct SiFivePLICState SiFivePLICState;
 #define SIFIVE_PLIC(obj) \
     OBJECT_CHECK(SiFivePLICState, (obj), TYPE_SIFIVE_PLIC)
 
@@ -41,7 +43,7 @@ typedef struct PLICAddr {
     PLICMode mode;
 } PLICAddr;
 
-typedef struct SiFivePLICState {
+struct SiFivePLICState {
     /*< private >*/
     SysBusDevice parent_obj;
 
@@ -69,7 +71,7 @@ typedef struct SiFivePLICState {
     uint32_t context_base;
     uint32_t context_stride;
     uint32_t aperture_size;
-} SiFivePLICState;
+};
 
 DeviceState *sifive_plic_create(hwaddr addr, char *hart_config,
     uint32_t hartid_base, uint32_t num_sources,
diff --git a/include/hw/char/sifive_uart.h b/include/hw/char/sifive_uart.h
index 65668825a3..2bb72ac80b 100644
--- a/include/hw/char/sifive_uart.h
+++ b/include/hw/char/sifive_uart.h
@@ -22,6 +22,7 @@
 
 #include "chardev/char-fe.h"
 #include "hw/sysbus.h"
+#include "qom/object.h"
 
 enum {
     SIFIVE_UART_TXFIFO        = 0,
@@ -51,10 +52,11 @@ enum {
 
 #define TYPE_SIFIVE_UART "riscv.sifive.uart"
 
+typedef struct SiFiveUARTState SiFiveUARTState;
 #define SIFIVE_UART(obj) \
     OBJECT_CHECK(SiFiveUARTState, (obj), TYPE_SIFIVE_UART)
 
-typedef struct SiFiveUARTState {
+struct SiFiveUARTState {
     /*< private >*/
     SysBusDevice parent_obj;
 
@@ -69,7 +71,7 @@ typedef struct SiFiveUARTState {
     uint32_t txctrl;
     uint32_t rxctrl;
     uint32_t div;
-} SiFiveUARTState;
+};
 
 SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base,
     Chardev *chr, qemu_irq irq);
diff --git a/include/hw/gpio/sifive_gpio.h b/include/hw/gpio/sifive_gpio.h
index cf12fcfd62..af991fa44e 100644
--- a/include/hw/gpio/sifive_gpio.h
+++ b/include/hw/gpio/sifive_gpio.h
@@ -15,8 +15,10 @@
 #define SIFIVE_GPIO_H
 
 #include "hw/sysbus.h"
+#include "qom/object.h"
 
 #define TYPE_SIFIVE_GPIO "sifive_soc.gpio"
+typedef struct SIFIVEGPIOState SIFIVEGPIOState;
 #define SIFIVE_GPIO(obj) OBJECT_CHECK(SIFIVEGPIOState, (obj), TYPE_SIFIVE_GPIO)
 
 #define SIFIVE_GPIO_PINS 32
@@ -41,7 +43,7 @@
 #define SIFIVE_GPIO_REG_IOF_SEL    0x03C
 #define SIFIVE_GPIO_REG_OUT_XOR    0x040
 
-typedef struct SIFIVEGPIOState {
+struct SIFIVEGPIOState {
     SysBusDevice parent_obj;
 
     MemoryRegion mmio;
@@ -71,6 +73,6 @@ typedef struct SIFIVEGPIOState {
 
     /* config */
     uint32_t ngpio;
-} SIFIVEGPIOState;
+};
 
 #endif /* SIFIVE_GPIO_H */
diff --git a/include/hw/misc/sifive_e_prci.h b/include/hw/misc/sifive_e_prci.h
index 698b0b451c..de1e502eea 100644
--- a/include/hw/misc/sifive_e_prci.h
+++ b/include/hw/misc/sifive_e_prci.h
@@ -18,6 +18,7 @@
 
 #ifndef HW_SIFIVE_E_PRCI_H
 #define HW_SIFIVE_E_PRCI_H
+#include "qom/object.h"
 
 enum {
     SIFIVE_E_PRCI_HFROSCCFG = 0x0,
@@ -51,10 +52,11 @@ enum {
 
 #define TYPE_SIFIVE_E_PRCI      "riscv.sifive.e.prci"
 
+typedef struct SiFiveEPRCIState SiFiveEPRCIState;
 #define SIFIVE_E_PRCI(obj) \
     OBJECT_CHECK(SiFiveEPRCIState, (obj), TYPE_SIFIVE_E_PRCI)
 
-typedef struct SiFiveEPRCIState {
+struct SiFiveEPRCIState {
     /*< private >*/
     SysBusDevice parent_obj;
 
@@ -64,7 +66,7 @@ typedef struct SiFiveEPRCIState {
     uint32_t hfxosccfg;
     uint32_t pllcfg;
     uint32_t plloutdiv;
-} SiFiveEPRCIState;
+};
 
 DeviceState *sifive_e_prci_create(hwaddr addr);
 
diff --git a/include/hw/misc/sifive_test.h b/include/hw/misc/sifive_test.h
index 1ec416ac1b..dc54b7af0c 100644
--- a/include/hw/misc/sifive_test.h
+++ b/include/hw/misc/sifive_test.h
@@ -20,19 +20,21 @@
 #define HW_SIFIVE_TEST_H
 
 #include "hw/sysbus.h"
+#include "qom/object.h"
 
 #define TYPE_SIFIVE_TEST "riscv.sifive.test"
 
+typedef struct SiFiveTestState SiFiveTestState;
 #define SIFIVE_TEST(obj) \
     OBJECT_CHECK(SiFiveTestState, (obj), TYPE_SIFIVE_TEST)
 
-typedef struct SiFiveTestState {
+struct SiFiveTestState {
     /*< private >*/
     SysBusDevice parent_obj;
 
     /*< public >*/
     MemoryRegion mmio;
-} SiFiveTestState;
+};
 
 enum {
     FINISHER_FAIL = 0x3333,
diff --git a/include/hw/misc/sifive_u_otp.h b/include/hw/misc/sifive_u_otp.h
index 639297564a..4572534f50 100644
--- a/include/hw/misc/sifive_u_otp.h
+++ b/include/hw/misc/sifive_u_otp.h
@@ -18,6 +18,7 @@
 
 #ifndef HW_SIFIVE_U_OTP_H
 #define HW_SIFIVE_U_OTP_H
+#include "qom/object.h"
 
 #define SIFIVE_U_OTP_PA         0x00
 #define SIFIVE_U_OTP_PAIO       0x04
@@ -49,10 +50,11 @@
 
 #define TYPE_SIFIVE_U_OTP           "riscv.sifive.u.otp"
 
+typedef struct SiFiveUOTPState SiFiveUOTPState;
 #define SIFIVE_U_OTP(obj) \
     OBJECT_CHECK(SiFiveUOTPState, (obj), TYPE_SIFIVE_U_OTP)
 
-typedef struct SiFiveUOTPState {
+struct SiFiveUOTPState {
     /*< private >*/
     SysBusDevice parent_obj;
 
@@ -75,6 +77,6 @@ typedef struct SiFiveUOTPState {
     uint32_t fuse[SIFIVE_U_OTP_NUM_FUSES];
     /* config */
     uint32_t serial;
-} SiFiveUOTPState;
+};
 
 #endif /* HW_SIFIVE_U_OTP_H */
diff --git a/include/hw/misc/sifive_u_prci.h b/include/hw/misc/sifive_u_prci.h
index 0a531fdadc..83eab43686 100644
--- a/include/hw/misc/sifive_u_prci.h
+++ b/include/hw/misc/sifive_u_prci.h
@@ -18,6 +18,7 @@
 
 #ifndef HW_SIFIVE_U_PRCI_H
 #define HW_SIFIVE_U_PRCI_H
+#include "qom/object.h"
 
 #define SIFIVE_U_PRCI_HFXOSCCFG     0x00
 #define SIFIVE_U_PRCI_COREPLLCFG0   0x04
@@ -58,10 +59,11 @@
 
 #define TYPE_SIFIVE_U_PRCI      "riscv.sifive.u.prci"
 
+typedef struct SiFiveUPRCIState SiFiveUPRCIState;
 #define SIFIVE_U_PRCI(obj) \
     OBJECT_CHECK(SiFiveUPRCIState, (obj), TYPE_SIFIVE_U_PRCI)
 
-typedef struct SiFiveUPRCIState {
+struct SiFiveUPRCIState {
     /*< private >*/
     SysBusDevice parent_obj;
 
@@ -76,7 +78,7 @@ typedef struct SiFiveUPRCIState {
     uint32_t coreclksel;
     uint32_t devicesreset;
     uint32_t clkmuxstatus;
-} SiFiveUPRCIState;
+};
 
 /*
  * Clock indexes for use by Device Tree data and the PRCI driver.
-- 
2.26.2