Skip to contentSkip to conversation

qom: Use typedefs instead of struct names on instance_size/class_size

PATCH In review Eduardo Habkost 3 participants 10 messages Aug 24, 2020 – Sep 4, 2020 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover qom: Use typedefs instead of struct names on instance_size/class_size

This changes existing QOM boilerplate to use existing typedef names when setting instance_size and class_size on TypeInfo variables. This makes the code more consistent and will make future conversion to QOM type declaration macros easier.

Cc "Michael S. Tsirkin" <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "Edgar E. Iglesias" <[email protected]>
Cc Alistair Francis <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc Jason Wang <[email protected]>

Eduardo Habkost (6):
xilinx_axidma: Use typedef name for instance_size
omap_intc: Use typedef name for instance_size
lpc_ich9: Use typedef name for instance_size
xilinx_axienet: Use typedef name for instance_size
vhost-user-vga: Use typedef name for instance_size
virtio-vga: Use typedef name for instance_size

 hw/display/vhost-user-vga.c | 2 +-
 hw/display/virtio-vga.c     | 6 +++---
 hw/dma/xilinx_axidma.c      | 4 ++--
 hw/intc/omap_intc.c         | 2 +-
 hw/isa/lpc_ich9.c           | 2 +-
 hw/net/xilinx_axienet.c     | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/6 xilinx_axidma: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/dma/xilinx_axidma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/dma/xilinx_axidma.c +2 -2
index a4812e480a..5ad8bd3d2e 100644
@@ -634,7 +634,7 @@ static const TypeInfo axidma_info = {
 static const TypeInfo xilinx_axidma_data_stream_info = {
     .name          = TYPE_XILINX_AXI_DMA_DATA_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIDMAStreamSlave),
+    .instance_size = sizeof(XilinxAXIDMAStreamSlave),
     .class_init    = xilinx_axidma_stream_class_init,
     .class_data    = &xilinx_axidma_data_stream_class,
     .interfaces = (InterfaceInfo[]) {
@@ -646,7 +646,7 @@ static const TypeInfo xilinx_axidma_data_stream_info = {
 static const TypeInfo xilinx_axidma_control_stream_info = {
     .name          = TYPE_XILINX_AXI_DMA_CONTROL_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIDMAStreamSlave),
+    .instance_size = sizeof(XilinxAXIDMAStreamSlave),
     .class_init    = xilinx_axidma_stream_class_init,
     .class_data    = &xilinx_axidma_control_stream_class,
     .interfaces = (InterfaceInfo[]) {
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/6 omap_intc: Use typedef name for instance_size

In reply to Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/intc/omap_intc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/omap_intc.c +1 -1
index b8a1d1fd7d..d7183d035e 100644
@@ -676,7 +676,7 @@ static const TypeInfo omap2_intc_info = {
 static const TypeInfo omap_intc_type_info = {
     .name          = TYPE_OMAP_INTC,
     .parent        = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(struct omap_intr_handler_s),
+    .instance_size = sizeof(omap_intr_handler),
     .abstract      = true,
 };
 
Signature · 1 line
2.26.2
#3 lore raw

PATCH 3/6 lpc_ich9: Use typedef name for instance_size

In reply to Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]

---
 hw/isa/lpc_ich9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/isa/lpc_ich9.c +1 -1
index cd6e169d47..3303d2eab6 100644
@@ -792,7 +792,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
 static const TypeInfo ich9_lpc_info = {
     .name       = TYPE_ICH9_LPC_DEVICE,
     .parent     = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(struct ICH9LPCState),
+    .instance_size = sizeof(ICH9LPCState),
     .instance_init = ich9_lpc_initfn,
     .class_init  = ich9_lpc_class_init,
     .interfaces = (InterfaceInfo[]) {
Signature · 1 line
2.26.2
#4 lore raw

PATCH 4/6 xilinx_axienet: Use typedef name for instance_size

In reply to Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/net/xilinx_axienet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/xilinx_axienet.c +2 -2
index 1e48eb70c9..ceb4652938 100644
@@ -1069,7 +1069,7 @@ static const TypeInfo xilinx_enet_info = {
 static const TypeInfo xilinx_enet_data_stream_info = {
     .name          = TYPE_XILINX_AXI_ENET_DATA_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIEnetStreamSlave),
+    .instance_size = sizeof(XilinxAXIEnetStreamSlave),
     .class_init    = xilinx_enet_data_stream_class_init,
     .interfaces = (InterfaceInfo[]) {
             { TYPE_STREAM_SLAVE },
@@ -1080,7 +1080,7 @@ static const TypeInfo xilinx_enet_data_stream_info = {
 static const TypeInfo xilinx_enet_control_stream_info = {
     .name          = TYPE_XILINX_AXI_ENET_CONTROL_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIEnetStreamSlave),
+    .instance_size = sizeof(XilinxAXIEnetStreamSlave),
     .class_init    = xilinx_enet_control_stream_class_init,
     .interfaces = (InterfaceInfo[]) {
             { TYPE_STREAM_SLAVE },
Signature · 1 line
2.26.2
Reviewed-by on v1 4/6
#5 lore raw

Re: [PATCH 4/6] xilinx_axienet: Use typedef name for instance_size

Quoted 6 lines · Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

Alistair

Quoted 37 lines

---
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/net/xilinx_axienet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/xilinx_axienet.c +2 -3
index 1e48eb70c9..ceb4652938 100644
@@ -1069,7 +1069,7 @@ static const TypeInfo xilinx_enet_info = {
 static const TypeInfo xilinx_enet_data_stream_info = {
     .name          = TYPE_XILINX_AXI_ENET_DATA_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIEnetStreamSlave),
+    .instance_size = sizeof(XilinxAXIEnetStreamSlave),
     .class_init    = xilinx_enet_data_stream_class_init,
     .interfaces = (InterfaceInfo[]) {
             { TYPE_STREAM_SLAVE },
@@ -1080,7 +1080,7 @@ static const TypeInfo xilinx_enet_data_stream_info = {
 static const TypeInfo xilinx_enet_control_stream_info = {
     .name          = TYPE_XILINX_AXI_ENET_CONTROL_STREAM,
     .parent        = TYPE_OBJECT,
-    .instance_size = sizeof(struct XilinxAXIEnetStreamSlave),
+    .instance_size = sizeof(XilinxAXIEnetStreamSlave),
     .class_init    = xilinx_enet_control_stream_class_init,
     .interfaces = (InterfaceInfo[]) {
             { TYPE_STREAM_SLAVE },
--

2.26.2

#6 lore raw

PATCH 5/6 vhost-user-vga: Use typedef name for instance_size

In reply to Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/display/vhost-user-vga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/vhost-user-vga.c +1 -1
index 1690f6b610..78f58bd340 100644
@@ -39,7 +39,7 @@ static void vhost_user_vga_inst_initfn(Object *obj)
 static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
     .generic_name  = TYPE_VHOST_USER_VGA,
     .parent        = TYPE_VIRTIO_VGA_BASE,
-    .instance_size = sizeof(struct VhostUserVGA),
+    .instance_size = sizeof(VhostUserVGA),
     .instance_init = vhost_user_vga_inst_initfn,
 };
 
Signature · 1 line
2.26.2
#7 lore raw

PATCH 6/6 virtio-vga: Use typedef name for instance_size

In reply to Eduardo Habkost

This makes the code consistent with the rest of QOM code in QEMU, and will make automated conversion to type declaration macros simpler.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/display/virtio-vga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/display/virtio-vga.c +3 -3
index f533d7d1b4..7c995ddc81 100644
@@ -194,8 +194,8 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
 static TypeInfo virtio_vga_base_info = {
     .name          = TYPE_VIRTIO_VGA_BASE,
     .parent        = TYPE_VIRTIO_PCI,
-    .instance_size = sizeof(struct VirtIOVGABase),
-    .class_size    = sizeof(struct VirtIOVGABaseClass),
+    .instance_size = sizeof(VirtIOVGABase),
+    .class_size    = sizeof(VirtIOVGABaseClass),
     .class_init    = virtio_vga_base_class_init,
     .abstract      = true,
 };
@@ -224,7 +224,7 @@ static void virtio_vga_inst_initfn(Object *obj)
 static VirtioPCIDeviceTypeInfo virtio_vga_info = {
     .generic_name  = TYPE_VIRTIO_VGA,
     .parent        = TYPE_VIRTIO_VGA_BASE,
-    .instance_size = sizeof(struct VirtIOVGA),
+    .instance_size = sizeof(VirtIOVGA),
     .instance_init = virtio_vga_inst_initfn,
 };
 
Signature · 1 line
2.26.2
#9 lore raw
In reply to Eduardo Habkost
Quoted 4 lines · Eduardo Habkost

This changes existing QOM boilerplate to use existing typedef names when setting instance_size and class_size on TypeInfo variables. This makes the code more consistent and will make future conversion to QOM type declaration macros easier.

I'm queueing this series, as I consider the patches trivial cleanups.

Signature · 1 line
Eduardo