Re: [PATCH for-6.2 06/12] [automated] Split QOM "typedef struct T { ... } T" declarations

2021-08-10 Thread Cornelia Huck
On Fri, Aug 06 2021, Eduardo Habkost  wrote:

> Automatically split struct definition and typedef declaration in
> separate declarations, using a codeconverter rule.  The rule will
> only touch declarations of structs/typedefs actually used by QOM
> types.
>
> This will make automated changes to use OBJECT_DECLARE* macros
> easier to implement, because automated removal of typedef lines
> will be easier and safer.
>
> Generated using:
>
>   $ ./scripts/codeconverter/converter.py -i \
> --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]')
>
> Signed-off-by: Eduardo Habkost 
> ---
> Cc: "Marc-André Lureau" 
> Cc: Paolo Bonzini 
> Cc: Patrick Venture 
> Cc: Thomas Huth 
> Cc: Keith Busch 
> Cc: Klaus Jensen 
> Cc: "Michael S. Tsirkin" 
> Cc: Cornelia Huck 
> Cc: Halil Pasic 
> Cc: Christian Borntraeger 
> Cc: Richard Henderson 
> Cc: David Hildenbrand 
> Cc: Gerd Hoffmann 
> Cc: Havard Skinnemoen 
> Cc: Tyrone Ting 
> Cc: Alistair Francis 
> Cc: Bin Meng 
> Cc: Palmer Dabbelt 
> Cc: "Edgar E. Iglesias" 
> Cc: Peter Maydell 
> Cc: Andrew Baumann 
> Cc: "Philippe Mathieu-Daudé" 
> Cc: "Cédric Le Goater" 
> Cc: David Gibson 
> Cc: Greg Kurz 
> Cc: Laurent Vivier 
> Cc: qemu-de...@nongnu.org
> Cc: qemu-block@nongnu.org
> Cc: qemu-s3...@nongnu.org
> Cc: qemu-...@nongnu.org
> Cc: qemu-ri...@nongnu.org
> Cc: qemu-...@nongnu.org
> ---
>  hw/nvme/nvme.h  | 10 ++
>  hw/usb/hcd-uhci.h   |  5 +++--
>  hw/usb/u2f.h|  5 +++--
>  include/hw/adc/npcm7xx_adc.h|  5 +++--
>  include/hw/arm/npcm7xx.h| 10 ++
>  include/hw/core/accel-cpu.h |  5 +++--
>  include/hw/dma/sifive_pdma.h|  5 +++--
>  include/hw/dma/xlnx_csu_dma.h   |  5 +++--
>  include/hw/gpio/npcm7xx_gpio.h  |  5 +++--
>  include/hw/i2c/npcm7xx_smbus.h  |  5 +++--
>  include/hw/mem/npcm7xx_mc.h |  5 +++--
>  include/hw/misc/bcm2835_cprman.h| 20 
>  include/hw/misc/mchp_pfsoc_dmc.h| 10 ++
>  include/hw/misc/mchp_pfsoc_ioscb.h  |  5 +++--
>  include/hw/misc/mchp_pfsoc_sysreg.h |  5 +++--
>  include/hw/misc/npcm7xx_clk.h   | 15 +--
>  include/hw/misc/npcm7xx_gcr.h   |  5 +++--
>  include/hw/misc/npcm7xx_mft.h   |  5 +++--
>  include/hw/misc/npcm7xx_rng.h   |  5 +++--
>  include/hw/nvram/npcm7xx_otp.h  |  5 +++--
>  include/hw/riscv/microchip_pfsoc.h  | 10 ++
>  include/hw/riscv/sifive_e.h |  5 +++--
>  include/hw/sd/cadence_sdhci.h   |  5 +++--
>  include/qemu/accel.h| 10 ++
>  chardev/char-parallel.c | 10 ++
>  hw/i2c/i2c_mux_pca954x.c|  5 +++--
>  hw/m68k/mcf5206.c   |  5 +++--
>  hw/misc/sbsa_ec.c   |  5 +++--
>  hw/s390x/vhost-user-fs-ccw.c|  5 +++--
>  tests/qtest/pnv-xscom-test.c|  5 +++--
>  30 files changed, 123 insertions(+), 82 deletions(-)

Acked-by: Cornelia Huck 




[PATCH for-6.2 06/12] [automated] Split QOM "typedef struct T { ... } T" declarations

2021-08-06 Thread Eduardo Habkost
Automatically split struct definition and typedef declaration in
separate declarations, using a codeconverter rule.  The rule will
only touch declarations of structs/typedefs actually used by QOM
types.

This will make automated changes to use OBJECT_DECLARE* macros
easier to implement, because automated removal of typedef lines
will be easier and safer.

Generated using:

  $ ./scripts/codeconverter/converter.py -i \
--pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]')

Signed-off-by: Eduardo Habkost 
---
Cc: "Marc-André Lureau" 
Cc: Paolo Bonzini 
Cc: Patrick Venture 
Cc: Thomas Huth 
Cc: Keith Busch 
Cc: Klaus Jensen 
Cc: "Michael S. Tsirkin" 
Cc: Cornelia Huck 
Cc: Halil Pasic 
Cc: Christian Borntraeger 
Cc: Richard Henderson 
Cc: David Hildenbrand 
Cc: Gerd Hoffmann 
Cc: Havard Skinnemoen 
Cc: Tyrone Ting 
Cc: Alistair Francis 
Cc: Bin Meng 
Cc: Palmer Dabbelt 
Cc: "Edgar E. Iglesias" 
Cc: Peter Maydell 
Cc: Andrew Baumann 
Cc: "Philippe Mathieu-Daudé" 
Cc: "Cédric Le Goater" 
Cc: David Gibson 
Cc: Greg Kurz 
Cc: Laurent Vivier 
Cc: qemu-de...@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-s3...@nongnu.org
Cc: qemu-...@nongnu.org
Cc: qemu-ri...@nongnu.org
Cc: qemu-...@nongnu.org
---
 hw/nvme/nvme.h  | 10 ++
 hw/usb/hcd-uhci.h   |  5 +++--
 hw/usb/u2f.h|  5 +++--
 include/hw/adc/npcm7xx_adc.h|  5 +++--
 include/hw/arm/npcm7xx.h| 10 ++
 include/hw/core/accel-cpu.h |  5 +++--
 include/hw/dma/sifive_pdma.h|  5 +++--
 include/hw/dma/xlnx_csu_dma.h   |  5 +++--
 include/hw/gpio/npcm7xx_gpio.h  |  5 +++--
 include/hw/i2c/npcm7xx_smbus.h  |  5 +++--
 include/hw/mem/npcm7xx_mc.h |  5 +++--
 include/hw/misc/bcm2835_cprman.h| 20 
 include/hw/misc/mchp_pfsoc_dmc.h| 10 ++
 include/hw/misc/mchp_pfsoc_ioscb.h  |  5 +++--
 include/hw/misc/mchp_pfsoc_sysreg.h |  5 +++--
 include/hw/misc/npcm7xx_clk.h   | 15 +--
 include/hw/misc/npcm7xx_gcr.h   |  5 +++--
 include/hw/misc/npcm7xx_mft.h   |  5 +++--
 include/hw/misc/npcm7xx_rng.h   |  5 +++--
 include/hw/nvram/npcm7xx_otp.h  |  5 +++--
 include/hw/riscv/microchip_pfsoc.h  | 10 ++
 include/hw/riscv/sifive_e.h |  5 +++--
 include/hw/sd/cadence_sdhci.h   |  5 +++--
 include/qemu/accel.h| 10 ++
 chardev/char-parallel.c | 10 ++
 hw/i2c/i2c_mux_pca954x.c|  5 +++--
 hw/m68k/mcf5206.c   |  5 +++--
 hw/misc/sbsa_ec.c   |  5 +++--
 hw/s390x/vhost-user-fs-ccw.c|  5 +++--
 tests/qtest/pnv-xscom-test.c|  5 +++--
 30 files changed, 123 insertions(+), 82 deletions(-)

diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 5ddcd783055..0840f585d6e 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -118,7 +118,7 @@ typedef struct NvmeNamespaceParams {
 uint32_t zd_extension_size;
 } NvmeNamespaceParams;
 
-typedef struct NvmeNamespace {
+struct NvmeNamespace {
 DeviceState  parent_obj;
 BlockConfblkconf;
 int32_t  bootindex;
@@ -153,7 +153,8 @@ typedef struct NvmeNamespace {
 struct {
 uint32_t err_rec;
 } features;
-} NvmeNamespace;
+};
+typedef struct NvmeNamespace NvmeNamespace;
 
 static inline uint32_t nvme_nsid(NvmeNamespace *ns)
 {
@@ -395,7 +396,7 @@ typedef struct NvmeParams {
 bool legacy_cmb;
 } NvmeParams;
 
-typedef struct NvmeCtrl {
+struct NvmeCtrl {
 PCIDeviceparent_obj;
 MemoryRegion bar0;
 MemoryRegion iomem;
@@ -462,7 +463,8 @@ typedef struct NvmeCtrl {
 };
 uint32_tasync_config;
 } features;
-} NvmeCtrl;
+};
+typedef struct NvmeCtrl NvmeCtrl;
 
 static inline NvmeNamespace *nvme_ns(NvmeCtrl *n, uint32_t nsid)
 {
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index 57d0d574644..2597a6d2eb6 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -43,7 +43,7 @@ typedef struct UHCIPort {
 uint16_t ctrl;
 } UHCIPort;
 
-typedef struct UHCIState {
+struct UHCIState {
 PCIDevice dev;
 MemoryRegion io_bar;
 USBBus bus; /* Note unused when we're a companion controller */
@@ -73,7 +73,8 @@ typedef struct UHCIState {
 char *masterbus;
 uint32_t firstport;
 uint32_t maxframes;
-} UHCIState;
+};
+typedef struct UHCIState UHCIState;
 
 #define TYPE_UHCI "pci-uhci-usb"
 DECLARE_INSTANCE_CHECKER(UHCIState, UHCI, TYPE_UHCI)
diff --git a/hw/usb/u2f.h b/hw/usb/u2f.h
index 705d5c43ce6..7191a23ee1a 100644
--- a/hw/usb/u2f.h
+++ b/hw/usb/u2f.h
@@ -62,7 +62,7 @@ struct U2FKeyClass {
 /*
  * State of the U2F key base device (i.e. hw/u2f.c)
  */
-typedef struct U2FKeyState {
+struct U2FKeyState {
 USBDevice dev;
 USBEndpoint *ep;
 uint8_t idle;
@@ -72,7 +72,8 @@ typedef struct U2FKeyState {
 uint8_t pending_in_start;
 uint8_t pending_in_end;
 uint8_t pending_in_num;
-} U2FKeyState;
+};
+typedef struct U2FKeyState