Skip to contentSkip to conversation

qom: Rename macros for consistency

PATCH In review Eduardo Habkost 12 participants 112 messages Sep 2, 2020 – Oct 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover qom: Rename macros for consistency

Reducing boilerplate QOM code using the new OBJECT_DEFINE_* and OBJECT_DECLARE_* macros is quite difficult when there are multiple ways a TYPE_* constant name is written.

This series renames many type checking macros and/or TYPE_* constants to make sure they are consistent.

This series is based on machine-next and can be fetched from:

https://github.com/ehabkost/qemu-hacks work/qom-rename-macros

Eduardo Habkost (63):
gpex: Fix type checking function name
chardev: Rename TYPE_CHARDEV_* to TYPE_*_CHARDEV
chardev: Rename TYPE_BRAILLE_CHARDEV to TYPE_BAUM_CHARDEV
chardev: Rename TYPE_MSMOUSE_CHARDEV to TYPE_MOUSE_CHARDEV
ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE
dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV
rdma: Rename PVRDMA_HW_NAME to TYPE_PVRDMA_DEV
vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE
vmcoreinfo: Rename VMCOREINFO_DEVICE to TYPE_VMCOREINFO
vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID
edu: Rename TYPE_PCI_EDU_DEVICE to TYPE_EDU
etrax: Rename TYPE_ETRAX_FS_SERIAL to TYPE_ETRAX_SERIAL
etrax: Rename TYPE_ETRAX_FS_TIMER to TYPE_ETRAX_TIMER
i8254: Rename TYPE_I8254 to TYPE_PIT
i8259: Rename TYPE_I8259 to TYPE_PIC
i8259: Rename TYPE_KVM_I8259 to TYPE_KVM_PIC
intel-hda: Rename TYPE_INTEL_HDA_GENERIC to TYPE_INTEL_HDA
mips: Rename TYPE_MIPS_BOSTON to TYPE_BOSTON
mptsas: Rename TYPE_MPTSAS1068 to TYPE_MPT_SAS
pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312
pxb: Rename TYPE_PXB_DEVICE to TYPE_PXB_DEV
pxb: Rename TYPE_PXB_PCIE_DEVICE to TYPE_PXB_PCIE_DEV
ramfb: Rename TYPE_RAMFB_DEVICE to TYPE_RAMFB
scsi: Rename TYPE_AM53C974_DEVICE to TYPE_PCI_ESP
scsi: Rename TYPE_DC390_DEVICE to TYPE_DC390
sun4m: Rename TYPE_SUN4M_MEMORY to TYPE_SUN4M_RAM
sun4u: Rename TYPE_SUN4U_MEMORY to TYPE_SUN4U_RAM
tusb6010: Rename TYPE_TUSB6010 to TYPE_TUSB
versatile: Rename TYPE_VERSATILE_PCI_HOST to TYPE_PCI_VPB_HOST
versatile: Rename TYPE_VERSATILE_PCI to TYPE_PCI_VPB
virtio-console: Rename TYPE_VIRTIO_CONSOLE_SERIAL_PORT to
TYPE_VIRTIO_CONSOLE
ahci: Rename ICH_AHCI to ICH9_AHCI
net/can: Rename TYPE_CAN_CPI constants
can: Rename KVASER_PCI_DEV to KVASER_PCI
can: Rename MIOe3680_PCI_DEV to MIOE3680_PCI
can: Rename PCM3680i_PCI_DEV to PCM3680_PCI
ccid-card-emulated: Rename EMULATED_CCID_CARD to EMULATED_CCID
ccid-card-passthru: Rename PASSTHRU_CCID_CARD to CCID_PASSTHRU
esp: Rename ESP_STATE to ESP
filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER
lance: Rename SYSBUS_PCNET to LANCE
lasi_i82596: Rename SYSBUS_I82596 to LASI_82596
pvpanic: Rename ISA_PVPANIC_DEVICE to PVPANIC
renesas: Rename RCMT to RENESAS_CMT
renesas: Rename RSCI to RENESAS_SCI
renesas: Rename RTMR to RENESAS_TMR
rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC
sabre: Rename SABRE_DEVICE to SABRE
stm32f205: Rename STM32F2XXTIMER to STM32F2XX_TIMER
tpm_crb: Rename CRB to TPM_CRB
tpm_spapr: Rename VIO_SPAPR_VTPM to TPM_SPAPR
usb: Rename USB_REDIRECT to USB_REDIR
usb: Rename USB_SERIAL_DEV to USB_SERIAL
usb: Rename USB_STORAGE_DEV to USB_STORAGE
vfio: Rename PCI_VFIO to VFIO_PCI
vmxnet3: Rename VMXNET3_DEVICE* to VMXNET3*
xen: Rename XENBACKEND_DEVICE to XENBACKEND
hvf: Rename HVF_STATE to HVF_ACCEL
kvm: Rename KVM_STATE to KVM_ACCEL
tcg: Rename TCG_STATE to TCG_ACCEL
tests: Rename TYPE_DUMMY to TYPE_DUMMY_OBJECT
tests: Rename DYNAMIC_TYPE to DYNAMIC_PROPS
tests: Rename STATIC_TYPE to STATIC_PROPS

 chardev/chardev-internal.h          |  4 ++--
 hw/rdma/vmw/pvrdma.h                |  4 ++--
 hw/scsi/mptsas.h                    |  4 ++--
 hw/vfio/pci.h                       |  2 +-
 include/chardev/char-fd.h           |  4 ++--
 include/chardev/char-win-stdio.h    |  2 +-
 include/chardev/char-win.h          |  4 ++--
 include/chardev/char.h              | 30 ++++++++++++++---------------
 include/chardev/spice.h             |  8 ++++----
 include/hw/acpi/vmgenid.h           |  6 +++---
 include/hw/char/renesas_sci.h       |  2 +-
 include/hw/display/ramfb.h          |  2 +-
 include/hw/ide/ahci.h               |  2 +-
 include/hw/isa/pc87312.h            |  4 ++--
 include/hw/misc/vmcoreinfo.h        |  6 +++---
 include/hw/net/lance.h              |  2 +-
 include/hw/net/lasi_82596.h         |  2 +-
 include/hw/pci-host/gpex.h          |  2 +-
 include/hw/pci-host/sabre.h         |  2 +-
 include/hw/s390x/ap-device.h        |  4 ++--
 include/hw/scsi/esp.h               |  2 +-
 include/hw/timer/i8254.h            |  4 ++--
 include/hw/timer/renesas_cmt.h      |  2 +-
 include/hw/timer/renesas_tmr.h      |  6 +++---
 include/hw/timer/stm32f2xx_timer.h  |  2 +-
 include/hw/xen/xen-legacy-backend.h |  2 +-
 include/sysemu/hvf.h                |  2 +-
 include/sysemu/kvm.h                |  2 +-
 accel/kvm/kvm-all.c                 | 18 ++++++++---------
 accel/tcg/tcg-all.c                 | 14 +++++++-------
 chardev/baum.c                      |  6 +++---
 chardev/char-console.c              |  4 ++--
 chardev/char-fd.c                   |  2 +-
 chardev/char-file.c                 |  6 +++---
 chardev/char-mux.c                  |  2 +-
 chardev/char-null.c                 |  2 +-
 chardev/char-parallel.c             |  4 ++--
 chardev/char-pipe.c                 |  6 +++---
 chardev/char-pty.c                  |  4 ++--
 chardev/char-ringbuf.c              |  8 ++++----
 chardev/char-serial.c               |  6 +++---
 chardev/char-socket.c               |  4 ++--
 chardev/char-stdio.c                |  6 +++---
 chardev/char-udp.c                  |  4 ++--
 chardev/char-win-stdio.c            |  4 ++--
 chardev/char-win.c                  |  2 +-
 chardev/char.c                      |  2 +-
 chardev/msmouse.c                   |  6 +++---
 chardev/spice.c                     | 10 +++++-----
 chardev/testdev.c                   |  6 +++---
 chardev/wctablet.c                  |  6 +++---
 gdbstub.c                           |  6 +++---
 hw/acpi/vmgenid.c                   |  6 +++---
 hw/arm/sysbus-fdt.c                 |  2 +-
 hw/arm/virt.c                       |  2 +-
 hw/audio/intel-hda.c                | 10 +++++-----
 hw/char/etraxfs_ser.c               |  6 +++---
 hw/char/renesas_sci.c               | 18 ++++++++---------
 hw/char/virtio-console.c            |  8 ++++----
 hw/display/ramfb-standalone.c       |  4 ++--
 hw/display/vhost-user-gpu.c         |  2 +-
 hw/dma/sparc32_dma.c                |  2 +-
 hw/i386/kvm/i8259.c                 | 10 +++++-----
 hw/i386/pc_piix.c                   |  2 +-
 hw/i386/pc_q35.c                    |  2 +-
 hw/ide/ahci.c                       |  4 ++--
 hw/ide/ich.c                        |  8 ++++----
 hw/intc/i8259.c                     | 10 +++++-----
 hw/isa/pc87312.c                    |  2 +-
 hw/m68k/q800.c                      |  2 +-
 hw/mips/boston.c                    |  8 ++++----
 hw/mips/jazz.c                      |  2 +-
 hw/misc/edu.c                       |  6 +++---
 hw/misc/pvpanic.c                   |  6 +++---
 hw/misc/vmcoreinfo.c                |  6 +++---
 hw/net/can/can_kvaser_pci.c         | 16 +++++++--------
 hw/net/can/can_mioe3680_pci.c       | 16 +++++++--------
 hw/net/can/can_pcm3680_pci.c        | 16 +++++++--------
 hw/net/lance.c                      |  6 +++---
 hw/net/lasi_i82596.c                |  8 ++++----
 hw/net/vmxnet3.c                    |  6 +++---
 hw/pci-bridge/pci_expander_bridge.c | 12 ++++++------
 hw/pci-host/sabre.c                 |  8 ++++----
 hw/pci-host/versatile.c             | 16 +++++++--------
 hw/ppc/rs6000_mc.c                  |  4 ++--
 hw/rdma/vmw/pvrdma_main.c           |  2 +-
 hw/rx/rx62n.c                       |  2 +-
 hw/s390x/ap-device.c                |  2 +-
 hw/scsi/esp-pci.c                   | 14 +++++++-------
 hw/scsi/esp.c                       |  6 +++---
 hw/scsi/mptsas.c                    |  2 +-
 hw/sparc/sun4m.c                    | 10 +++++-----
 hw/sparc64/sun4u.c                  | 10 +++++-----
 hw/timer/etraxfs_timer.c            |  6 +++---
 hw/timer/i8254.c                    |  4 ++--
 hw/timer/renesas_cmt.c              |  4 ++--
 hw/timer/renesas_tmr.c              |  6 +++---
 hw/timer/stm32f2xx_timer.c          |  6 +++---
 hw/tpm/tpm_crb.c                    | 14 +++++++-------
 hw/tpm/tpm_spapr.c                  | 14 +++++++-------
 hw/usb/ccid-card-emulated.c         | 10 +++++-----
 hw/usb/ccid-card-passthru.c         |  8 ++++----
 hw/usb/dev-serial.c                 |  4 ++--
 hw/usb/dev-smartcard-reader.c       |  8 ++++----
 hw/usb/dev-storage.c                | 12 ++++++------
 hw/usb/redirect.c                   | 22 ++++++++++-----------
 hw/usb/tusb6010.c                   |  6 +++---
 hw/vfio/ap.c                        | 10 +++++-----
 hw/vfio/pci.c                       | 22 ++++++++++-----------
 net/filter-rewriter.c               | 18 ++++++++---------
 target/arm/kvm.c                    |  2 +-
 target/i386/kvm.c                   |  2 +-
 target/mips/kvm.c                   |  2 +-
 target/ppc/kvm.c                    |  4 ++--
 tests/check-qom-proplist.c          | 30 ++++++++++++++---------------
 tests/test-char.c                   |  4 ++--
 tests/test-io-task.c                | 14 +++++++-------
 tests/test-qdev-global-props.c      | 16 +++++++--------
 ui/console.c                        |  8 ++++----
 ui/gtk.c                            |  6 +++---
 ui/spice-app.c                      | 10 +++++-----
 121 files changed, 406 insertions(+), 406 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/63 gpex: Fix type checking function name

This looks like a copy/paste mistake: the instance type checking macro for TYPE_GPEX_ROOT_DEVICE was named MCH_PCI_DEVICE.

---
Cc: [email protected]

---
 include/hw/pci-host/gpex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/pci-host/gpex.h +1 -1
index e8432eced8..2f4e852eee 100644
@@ -32,7 +32,7 @@ DECLARE_INSTANCE_CHECKER(GPEXHost, GPEX_HOST,
 
 #define TYPE_GPEX_ROOT_DEVICE "gpex-root"
 typedef struct GPEXRootState GPEXRootState;
-DECLARE_INSTANCE_CHECKER(GPEXRootState, MCH_PCI_DEVICE,
+DECLARE_INSTANCE_CHECKER(GPEXRootState, GPEX_ROOT_DEVICE,
                          TYPE_GPEX_ROOT_DEVICE)
 
 #define GPEX_NUM_IRQS 4
Signature · 1 line
2.26.2
Reviewed-by on v1 1/63
#2 lore raw

Re: [PATCH 01/63] gpex: Fix type checking function name

Quoted 15 lines · Eduardo Habkost

This looks like a copy/paste mistake: the instance type checking macro for TYPE_GPEX_ROOT_DEVICE was named MCH_PCI_DEVICE.

---
Cc: [email protected]

---
 include/hw/pci-host/gpex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/pci-host/gpex.h +0 -0
index e8432eced8..2f4e852eee 100644

include/hw/pci-host/gpex.h DECLARE_INSTANCE_CHECKER(GPEXHost, GPEX_HOST, · line 36

Quoted 6 lines
include/hw/pci-host/gpex.h +1 -1
@@ -32,7 +32,7 @@ DECLARE_INSTANCE_CHECKER(GPEXHost, GPEX_HOST,
 
 #define TYPE_GPEX_ROOT_DEVICE "gpex-root"
 typedef struct GPEXRootState GPEXRootState;
-DECLARE_INSTANCE_CHECKER(GPEXRootState, MCH_PCI_DEVICE,
+DECLARE_INSTANCE_CHECKER(GPEXRootState, GPEX_ROOT_DEVICE,
                          TYPE_GPEX_ROOT_DEVICE)
Quoted 3 lines
include/hw/pci-host/gpex.h +0 -0
 #define GPEX_NUM_IRQS 4
 
#3 lore raw

PATCH 2/63 chardev: Rename TYPE_CHARDEV_* to TYPE_*_CHARDEV

In reply to Eduardo Habkost

This will make the TYPE_* constants consistent with the name of most type checking macros we have today.

---
Cc: Samuel Thibault <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 chardev/chardev-internal.h       |  4 ++--
 include/chardev/char-fd.h        |  4 ++--
 include/chardev/char-win-stdio.h |  2 +-
 include/chardev/char-win.h       |  4 ++--
 include/chardev/char.h           | 30 +++++++++++++++---------------
 include/chardev/spice.h          |  8 ++++----
 chardev/baum.c                   |  6 +++---
 chardev/char-console.c           |  4 ++--
 chardev/char-fd.c                |  2 +-
 chardev/char-file.c              |  6 +++---
 chardev/char-mux.c               |  2 +-
 chardev/char-null.c              |  2 +-
 chardev/char-parallel.c          |  4 ++--
 chardev/char-pipe.c              |  6 +++---
 chardev/char-pty.c               |  4 ++--
 chardev/char-ringbuf.c           |  8 ++++----
 chardev/char-serial.c            |  6 +++---
 chardev/char-socket.c            |  4 ++--
 chardev/char-stdio.c             |  6 +++---
 chardev/char-udp.c               |  4 ++--
 chardev/char-win-stdio.c         |  4 ++--
 chardev/char-win.c               |  2 +-
 chardev/char.c                   |  2 +-
 chardev/msmouse.c                |  6 +++---
 chardev/spice.c                  | 10 +++++-----
 chardev/testdev.c                |  6 +++---
 chardev/wctablet.c               |  6 +++---
 gdbstub.c                        |  6 +++---
 hw/display/vhost-user-gpu.c      |  2 +-
 tests/test-char.c                |  4 ++--
 ui/console.c                     |  8 ++++----
 ui/gtk.c                         |  6 +++---
 ui/spice-app.c                   | 10 +++++-----
 33 files changed, 94 insertions(+), 94 deletions(-)
chardev/chardev-internal.h +2 -2
index aba0240759..832dc10a95 100644
@@ -55,9 +55,9 @@ struct MuxChardev {
 typedef struct MuxChardev MuxChardev;
 
 DECLARE_INSTANCE_CHECKER(MuxChardev, MUX_CHARDEV,
-                         TYPE_CHARDEV_MUX)
+                         TYPE_MUX_CHARDEV)
 #define CHARDEV_IS_MUX(chr)                             \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
+    object_dynamic_cast(OBJECT(chr), TYPE_MUX_CHARDEV)
 
 void mux_set_focus(Chardev *chr, int focus);
 void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event);
include/chardev/char-fd.h +2 -2
index 9de0e440de..14c664fc83 100644
@@ -36,10 +36,10 @@ struct FDChardev {
 };
 typedef struct FDChardev FDChardev;
 
-#define TYPE_CHARDEV_FD "chardev-fd"
+#define TYPE_FD_CHARDEV "chardev-fd"
 
 DECLARE_INSTANCE_CHECKER(FDChardev, FD_CHARDEV,
-                         TYPE_CHARDEV_FD)
+                         TYPE_FD_CHARDEV)
 
 void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out);
 int qmp_chardev_open_file_source(char *src, int flags, Error **errp);
include/chardev/char-win-stdio.h +1 -1
index d7314f734d..139dfbe92f 100644
@@ -24,6 +24,6 @@
 #ifndef CHAR_WIN_STDIO_H
 #define CHAR_WIN_STDIO_H
 
-#define TYPE_CHARDEV_WIN_STDIO "chardev-win-stdio"
+#define TYPE_WIN_STDIO_CHARDEV "chardev-win-stdio"
 
 #endif /* CHAR_WIN_STDIO_H */
include/chardev/char-win.h +2 -2
index 485521469c..a1745ba267 100644
@@ -43,9 +43,9 @@ typedef struct WinChardev WinChardev;
 #define NSENDBUF 2048
 #define NRECVBUF 2048
 
-#define TYPE_CHARDEV_WIN "chardev-win"
+#define TYPE_WIN_CHARDEV "chardev-win"
 DECLARE_INSTANCE_CHECKER(WinChardev, WIN_CHARDEV,
-                         TYPE_CHARDEV_WIN)
+                         TYPE_WIN_CHARDEV)
 
 void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open);
 int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp);
include/chardev/char.h +15 -15
index 5874de57ea..0f358a4eee 100644
@@ -230,24 +230,24 @@ typedef struct ChardevClass ChardevClass;
 DECLARE_OBJ_CHECKERS(Chardev, ChardevClass,
                      CHARDEV, TYPE_CHARDEV)
 
-#define TYPE_CHARDEV_NULL "chardev-null"
-#define TYPE_CHARDEV_MUX "chardev-mux"
-#define TYPE_CHARDEV_RINGBUF "chardev-ringbuf"
-#define TYPE_CHARDEV_PTY "chardev-pty"
-#define TYPE_CHARDEV_CONSOLE "chardev-console"
-#define TYPE_CHARDEV_STDIO "chardev-stdio"
-#define TYPE_CHARDEV_PIPE "chardev-pipe"
-#define TYPE_CHARDEV_MEMORY "chardev-memory"
-#define TYPE_CHARDEV_PARALLEL "chardev-parallel"
-#define TYPE_CHARDEV_FILE "chardev-file"
-#define TYPE_CHARDEV_SERIAL "chardev-serial"
-#define TYPE_CHARDEV_SOCKET "chardev-socket"
-#define TYPE_CHARDEV_UDP "chardev-udp"
+#define TYPE_NULL_CHARDEV "chardev-null"
+#define TYPE_MUX_CHARDEV "chardev-mux"
+#define TYPE_RINGBUF_CHARDEV "chardev-ringbuf"
+#define TYPE_PTY_CHARDEV "chardev-pty"
+#define TYPE_CONSOLE_CHARDEV "chardev-console"
+#define TYPE_STDIO_CHARDEV "chardev-stdio"
+#define TYPE_PIPE_CHARDEV "chardev-pipe"
+#define TYPE_MEMORY_CHARDEV "chardev-memory"
+#define TYPE_PARALLEL_CHARDEV "chardev-parallel"
+#define TYPE_FILE_CHARDEV "chardev-file"
+#define TYPE_SERIAL_CHARDEV "chardev-serial"
+#define TYPE_SOCKET_CHARDEV "chardev-socket"
+#define TYPE_UDP_CHARDEV "chardev-udp"
 
 #define CHARDEV_IS_RINGBUF(chr) \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_RINGBUF)
+    object_dynamic_cast(OBJECT(chr), TYPE_RINGBUF_CHARDEV)
 #define CHARDEV_IS_PTY(chr) \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_PTY)
+    object_dynamic_cast(OBJECT(chr), TYPE_PTY_CHARDEV)
 
 struct ChardevClass {
     ObjectClass parent_class;
include/chardev/spice.h +4 -4
index 99f26aedde..302573b582 100644
@@ -17,12 +17,12 @@ struct SpiceChardev {
 };
 typedef struct SpiceChardev SpiceChardev;
 
-#define TYPE_CHARDEV_SPICE "chardev-spice"
-#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc"
-#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport"
+#define TYPE_SPICE_CHARDEV "chardev-spice"
+#define TYPE_SPICEVMC_CHARDEV "chardev-spicevmc"
+#define TYPE_SPICEPORT_CHARDEV "chardev-spiceport"
 
 DECLARE_INSTANCE_CHECKER(SpiceChardev, SPICE_CHARDEV,
-                         TYPE_CHARDEV_SPICE)
+                         TYPE_SPICE_CHARDEV)
 
 void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend,
                               bool *be_opened, Error **errp);
chardev/baum.c +3 -3
index 5deca778bc..d6c9f698c1 100644
@@ -104,9 +104,9 @@ struct BaumChardev {
 };
 typedef struct BaumChardev BaumChardev;
 
-#define TYPE_CHARDEV_BRAILLE "chardev-braille"
+#define TYPE_BRAILLE_CHARDEV "chardev-braille"
 DECLARE_INSTANCE_CHECKER(BaumChardev, BAUM_CHARDEV,
-                         TYPE_CHARDEV_BRAILLE)
+                         TYPE_BRAILLE_CHARDEV)
 
 /* Let's assume NABCC by default */
 enum way {
@@ -674,7 +674,7 @@ static void char_braille_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_braille_type_info = {
-    .name = TYPE_CHARDEV_BRAILLE,
+    .name = TYPE_BRAILLE_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(BaumChardev),
     .instance_finalize = char_braille_finalize,
chardev/char-console.c +2 -2
index 6c4ce5dbce..5d175389fd 100644
@@ -42,8 +42,8 @@ static void char_console_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_console_type_info = {
-    .name = TYPE_CHARDEV_CONSOLE,
-    .parent = TYPE_CHARDEV_WIN,
+    .name = TYPE_CONSOLE_CHARDEV,
+    .parent = TYPE_WIN_CHARDEV,
     .class_init = char_console_class_init,
 };
 
chardev/char-fd.c +1 -1
index c2d8101106..031fe2a2d6 100644
@@ -154,7 +154,7 @@ static void char_fd_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_fd_type_info = {
-    .name = TYPE_CHARDEV_FD,
+    .name = TYPE_FD_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(FDChardev),
     .instance_finalize = char_fd_finalize,
chardev/char-file.c +3 -3
index 2fd80707e5..fc53bdb4aa 100644
@@ -124,11 +124,11 @@ static void char_file_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_file_type_info = {
-    .name = TYPE_CHARDEV_FILE,
+    .name = TYPE_FILE_CHARDEV,
 #ifdef _WIN32
-    .parent = TYPE_CHARDEV_WIN,
+    .parent = TYPE_WIN_CHARDEV,
 #else
-    .parent = TYPE_CHARDEV_FD,
+    .parent = TYPE_FD_CHARDEV,
 #endif
     .class_init = char_file_class_init,
 };
chardev/char-mux.c +1 -1
index 6f980bb836..8930b4d5e8 100644
@@ -388,7 +388,7 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_mux_type_info = {
-    .name = TYPE_CHARDEV_MUX,
+    .name = TYPE_MUX_CHARDEV,
     .parent = TYPE_CHARDEV,
     .class_init = char_mux_class_init,
     .instance_size = sizeof(MuxChardev),
chardev/char-null.c +1 -1
index 1c6a2900f9..fcddd33452 100644
@@ -42,7 +42,7 @@ static void char_null_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_null_type_info = {
-    .name = TYPE_CHARDEV_NULL,
+    .name = TYPE_NULL_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(Chardev),
     .class_init = char_null_class_init,
chardev/char-parallel.c +2 -2
index 66e4589b2b..289c1b002c 100644
@@ -58,7 +58,7 @@ struct ParallelChardev {
 typedef struct ParallelChardev ParallelChardev;
 
 DECLARE_INSTANCE_CHECKER(ParallelChardev, PARALLEL_CHARDEV,
-                         TYPE_CHARDEV_PARALLEL)
+                         TYPE_PARALLEL_CHARDEV)
 
 static int pp_hw_mode(ParallelChardev *s, uint16_t mode)
 {
@@ -303,7 +303,7 @@ static void char_parallel_finalize(Object *obj)
 }
 
 static const TypeInfo char_parallel_type_info = {
-    .name = TYPE_CHARDEV_PARALLEL,
+    .name = TYPE_PARALLEL_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(ParallelChardev),
     .instance_finalize = char_parallel_finalize,
chardev/char-pipe.c +3 -3
index fd12c9e63b..7458433256 100644
@@ -179,11 +179,11 @@ static void char_pipe_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_pipe_type_info = {
-    .name = TYPE_CHARDEV_PIPE,
+    .name = TYPE_PIPE_CHARDEV,
 #ifdef _WIN32
-    .parent = TYPE_CHARDEV_WIN,
+    .parent = TYPE_WIN_CHARDEV,
 #else
-    .parent = TYPE_CHARDEV_FD,
+    .parent = TYPE_FD_CHARDEV,
 #endif
     .class_init = char_pipe_class_init,
 };
chardev/char-pty.c +2 -2
index a2d1e7c985..9cf77596d2 100644
@@ -46,7 +46,7 @@ struct PtyChardev {
 typedef struct PtyChardev PtyChardev;
 
 DECLARE_INSTANCE_CHECKER(PtyChardev, PTY_CHARDEV,
-                         TYPE_CHARDEV_PTY)
+                         TYPE_PTY_CHARDEV)
 
 static void pty_chr_state(Chardev *chr, int connected);
 
@@ -240,7 +240,7 @@ static void char_pty_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_pty_type_info = {
-    .name = TYPE_CHARDEV_PTY,
+    .name = TYPE_PTY_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(PtyChardev),
     .instance_finalize = char_pty_finalize,
chardev/char-ringbuf.c +4 -4
index d40d21d3cf..edeb7daeae 100644
@@ -43,7 +43,7 @@ struct RingBufChardev {
 typedef struct RingBufChardev RingBufChardev;
 
 DECLARE_INSTANCE_CHECKER(RingBufChardev, RINGBUF_CHARDEV,
-                         TYPE_CHARDEV_RINGBUF)
+                         TYPE_RINGBUF_CHARDEV)
 
 static size_t ringbuf_count(const Chardev *chr)
 {
@@ -233,7 +233,7 @@ static void char_ringbuf_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_ringbuf_type_info = {
-    .name = TYPE_CHARDEV_RINGBUF,
+    .name = TYPE_RINGBUF_CHARDEV,
     .parent = TYPE_CHARDEV,
     .class_init = char_ringbuf_class_init,
     .instance_size = sizeof(RingBufChardev),
@@ -242,8 +242,8 @@ static const TypeInfo char_ringbuf_type_info = {
 
 /* Bug-compatibility: */
 static const TypeInfo char_memory_type_info = {
-    .name = TYPE_CHARDEV_MEMORY,
-    .parent = TYPE_CHARDEV_RINGBUF,
+    .name = TYPE_MEMORY_CHARDEV,
+    .parent = TYPE_RINGBUF_CHARDEV,
 };
 
 static void register_types(void)
chardev/char-serial.c +3 -3
index 7c3d84ae24..381107bd89 100644
@@ -308,11 +308,11 @@ static void char_serial_class_init(ObjectClass *oc, void *data)
 
 
 static const TypeInfo char_serial_type_info = {
-    .name = TYPE_CHARDEV_SERIAL,
+    .name = TYPE_SERIAL_CHARDEV,
 #ifdef _WIN32
-    .parent = TYPE_CHARDEV_WIN,
+    .parent = TYPE_WIN_CHARDEV,
 #else
-    .parent = TYPE_CHARDEV_FD,
+    .parent = TYPE_FD_CHARDEV,
 #endif
     .class_init = char_serial_class_init,
 };
chardev/char-socket.c +2 -2
index 95e45812d5..bb5ddc586c 100644
@@ -89,7 +89,7 @@ struct SocketChardev {
 typedef struct SocketChardev SocketChardev;
 
 DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,
-                         TYPE_CHARDEV_SOCKET)
+                         TYPE_SOCKET_CHARDEV)
 
 static gboolean socket_reconnect_timeout(gpointer opaque);
 static void tcp_chr_telnet_init(Chardev *chr);
@@ -1506,7 +1506,7 @@ static void char_socket_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_socket_type_info = {
-    .name = TYPE_CHARDEV_SOCKET,
+    .name = TYPE_SOCKET_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(SocketChardev),
     .instance_finalize = char_socket_finalize,
chardev/char-stdio.c +3 -3
index 82eaebc1db..fb28eaeb87 100644
@@ -150,11 +150,11 @@ static void char_stdio_finalize(Object *obj)
 }
 
 static const TypeInfo char_stdio_type_info = {
-    .name = TYPE_CHARDEV_STDIO,
+    .name = TYPE_STDIO_CHARDEV,
 #ifdef _WIN32
-    .parent = TYPE_CHARDEV_WIN_STDIO,
+    .parent = TYPE_WIN_STDIO_CHARDEV,
 #else
-    .parent = TYPE_CHARDEV_FD,
+    .parent = TYPE_FD_CHARDEV,
 #endif
     .instance_finalize = char_stdio_finalize,
     .class_init = char_stdio_class_init,
chardev/char-udp.c +2 -2
index 16b5dbce58..6d7b9d2805 100644
@@ -46,7 +46,7 @@ struct UdpChardev {
 typedef struct UdpChardev UdpChardev;
 
 DECLARE_INSTANCE_CHECKER(UdpChardev, UDP_CHARDEV,
-                         TYPE_CHARDEV_UDP)
+                         TYPE_UDP_CHARDEV)
 
 /* Called with chr_write_lock held.  */
 static int udp_chr_write(Chardev *chr, const uint8_t *buf, int len)
@@ -231,7 +231,7 @@ static void char_udp_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_udp_type_info = {
-    .name = TYPE_CHARDEV_UDP,
+    .name = TYPE_UDP_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(UdpChardev),
     .instance_finalize = char_udp_finalize,
chardev/char-win-stdio.c +2 -2
index a4771ab82e..f333b8cedc 100644
@@ -41,7 +41,7 @@ struct WinStdioChardev {
 typedef struct WinStdioChardev WinStdioChardev;
 
 DECLARE_INSTANCE_CHECKER(WinStdioChardev, WIN_STDIO_CHARDEV,
-                         TYPE_CHARDEV_WIN_STDIO)
+                         TYPE_WIN_STDIO_CHARDEV)
 
 static void win_stdio_wait_func(void *opaque)
 {
@@ -255,7 +255,7 @@ static void char_win_stdio_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_win_stdio_type_info = {
-    .name = TYPE_CHARDEV_WIN_STDIO,
+    .name = TYPE_WIN_STDIO_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(WinStdioChardev),
     .instance_finalize = char_win_stdio_finalize,
chardev/char-win.c +1 -1
index d4fb44c4dc..69dcf48873 100644
@@ -228,7 +228,7 @@ static void char_win_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_win_type_info = {
-    .name = TYPE_CHARDEV_WIN,
+    .name = TYPE_WIN_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(WinChardev),
     .instance_finalize = char_win_finalize,
chardev/char.c +1 -1
index 77e7ec814f..afebdc345e 100644
@@ -674,7 +674,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
         backend->type = CHARDEV_BACKEND_KIND_MUX;
         backend->u.mux.data = g_new0(ChardevMux, 1);
         backend->u.mux.data->chardev = g_strdup(bid);
-        mux = qemu_chardev_new(id, TYPE_CHARDEV_MUX, backend, context, errp);
+        mux = qemu_chardev_new(id, TYPE_MUX_CHARDEV, backend, context, errp);
         if (mux == NULL) {
             object_unparent(OBJECT(chr));
             chr = NULL;
chardev/msmouse.c +3 -3
index eb9231dcdb..4033ca714d 100644
@@ -44,9 +44,9 @@ struct MouseChardev {
 };
 typedef struct MouseChardev MouseChardev;
 
-#define TYPE_CHARDEV_MSMOUSE "chardev-msmouse"
+#define TYPE_MSMOUSE_CHARDEV "chardev-msmouse"
 DECLARE_INSTANCE_CHECKER(MouseChardev, MOUSE_CHARDEV,
-                         TYPE_CHARDEV_MSMOUSE)
+                         TYPE_MSMOUSE_CHARDEV)
 
 static void msmouse_chr_accept_input(Chardev *chr)
 {
@@ -178,7 +178,7 @@ static void char_msmouse_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_msmouse_type_info = {
-    .name = TYPE_CHARDEV_MSMOUSE,
+    .name = TYPE_MSMOUSE_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(MouseChardev),
     .instance_finalize = char_msmouse_finalize,
chardev/spice.c +5 -5
index bf7ea1e294..7423001b71 100644
@@ -376,7 +376,7 @@ static void char_spice_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_spice_type_info = {
-    .name = TYPE_CHARDEV_SPICE,
+    .name = TYPE_SPICE_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(SpiceChardev),
     .instance_finalize = char_spice_finalize,
@@ -394,8 +394,8 @@ static void char_spicevmc_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_spicevmc_type_info = {
-    .name = TYPE_CHARDEV_SPICEVMC,
-    .parent = TYPE_CHARDEV_SPICE,
+    .name = TYPE_SPICEVMC_CHARDEV,
+    .parent = TYPE_SPICE_CHARDEV,
     .class_init = char_spicevmc_class_init,
 };
 
@@ -409,8 +409,8 @@ static void char_spiceport_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_spiceport_type_info = {
-    .name = TYPE_CHARDEV_SPICEPORT,
-    .parent = TYPE_CHARDEV_SPICE,
+    .name = TYPE_SPICEPORT_CHARDEV,
+    .parent = TYPE_SPICE_CHARDEV,
     .class_init = char_spiceport_class_init,
 };
 
chardev/testdev.c +3 -3
index a92caca3c3..5ef9a59817 100644
@@ -39,9 +39,9 @@ struct TestdevChardev {
 };
 typedef struct TestdevChardev TestdevChardev;
 
-#define TYPE_CHARDEV_TESTDEV "chardev-testdev"
+#define TYPE_TESTDEV_CHARDEV "chardev-testdev"
 DECLARE_INSTANCE_CHECKER(TestdevChardev, TESTDEV_CHARDEV,
-                         TYPE_CHARDEV_TESTDEV)
+                         TYPE_TESTDEV_CHARDEV)
 
 /* Try to interpret a whole incoming packet */
 static int testdev_eat_packet(TestdevChardev *testdev)
@@ -118,7 +118,7 @@ static void char_testdev_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_testdev_type_info = {
-    .name = TYPE_CHARDEV_TESTDEV,
+    .name = TYPE_TESTDEV_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(TestdevChardev),
     .class_init = char_testdev_class_init,
chardev/wctablet.c +3 -3
index 95e005f5a5..2cc018efb3 100644
@@ -85,9 +85,9 @@ struct TabletChardev {
 };
 typedef struct TabletChardev TabletChardev;
 
-#define TYPE_CHARDEV_WCTABLET "chardev-wctablet"
+#define TYPE_WCTABLET_CHARDEV "chardev-wctablet"
 DECLARE_INSTANCE_CHECKER(TabletChardev, WCTABLET_CHARDEV,
-                         TYPE_CHARDEV_WCTABLET)
+                         TYPE_WCTABLET_CHARDEV)
 
 
 static void wctablet_chr_accept_input(Chardev *chr);
@@ -352,7 +352,7 @@ static void wctablet_chr_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo wctablet_type_info = {
-    .name = TYPE_CHARDEV_WCTABLET,
+    .name = TYPE_WCTABLET_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(TabletChardev),
     .instance_finalize = wctablet_chr_finalize,
gdbstub.c +3 -3
index 9dfb6e4142..7afdcf0f37 100644
@@ -3301,10 +3301,10 @@ static void char_gdb_class_init(ObjectClass *oc, void *data)
     cc->chr_write = gdb_monitor_write;
 }
 
-#define TYPE_CHARDEV_GDB "chardev-gdb"
+#define TYPE_GDB_CHARDEV "chardev-gdb"
 
 static const TypeInfo char_gdb_type_info = {
-    .name = TYPE_CHARDEV_GDB,
+    .name = TYPE_GDB_CHARDEV,
     .parent = TYPE_CHARDEV,
     .class_init = char_gdb_class_init,
 };
@@ -3409,7 +3409,7 @@ int gdbserver_start(const char *device)
         qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);
 
         /* Initialize a monitor terminal for gdb */
-        mon_chr = qemu_chardev_new(NULL, TYPE_CHARDEV_GDB,
+        mon_chr = qemu_chardev_new(NULL, TYPE_GDB_CHARDEV,
                                    NULL, NULL, &error_abort);
         monitor_init_hmp(mon_chr, false, &error_abort);
     } else {
hw/display/vhost-user-gpu.c +1 -1
index 51f1747c4a..f656fb38a7 100644
@@ -388,7 +388,7 @@ vhost_user_gpu_do_set_socket(VhostUserGPU *g, Error **errp)
         return false;
     }
 
-    chr = CHARDEV(object_new(TYPE_CHARDEV_SOCKET));
+    chr = CHARDEV(object_new(TYPE_SOCKET_CHARDEV));
     if (!chr || qemu_chr_add_client(chr, sv[0]) == -1) {
         error_setg(errp, "Failed to make socket chardev");
         goto err;
tests/test-char.c +2 -2
index d35cc839bc..2b2135ec77 100644
@@ -1232,7 +1232,7 @@ static void char_file_fifo_test(void)
     ret = write(fd, "fifo-in", 8);
     g_assert_cmpint(ret, ==, 8);
 
-    chr = qemu_chardev_new("label-file", TYPE_CHARDEV_FILE, &backend,
+    chr = qemu_chardev_new("label-file", TYPE_FILE_CHARDEV, &backend,
                            NULL, &error_abort);
 
     qemu_chr_fe_init(&be, chr, &error_abort);
@@ -1286,7 +1286,7 @@ static void char_file_test_internal(Chardev *ext_chr, const char *filepath)
     } else {
         out = g_build_filename(tmp_path, "out", NULL);
         file.out = out;
-        chr = qemu_chardev_new(NULL, TYPE_CHARDEV_FILE, &backend,
+        chr = qemu_chardev_new(NULL, TYPE_FILE_CHARDEV, &backend,
                                NULL, &error_abort);
     }
     ret = qemu_chr_write_all(chr, (uint8_t *)"hello!", 6);
ui/console.c +4 -4
index f8d7643fe4..965f01e804 100644
@@ -1089,9 +1089,9 @@ struct VCChardev {
 };
 typedef struct VCChardev VCChardev;
 
-#define TYPE_CHARDEV_VC "chardev-vc"
+#define TYPE_VC_CHARDEV "chardev-vc"
 DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
-                         TYPE_CHARDEV_VC)
+                         TYPE_VC_CHARDEV)
 
 static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
 {
@@ -2403,7 +2403,7 @@ static void char_vc_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_vc_type_info = {
-    .name = TYPE_CHARDEV_VC,
+    .name = TYPE_VC_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(VCChardev),
     .class_init = char_vc_class_init,
@@ -2412,7 +2412,7 @@ static const TypeInfo char_vc_type_info = {
 void qemu_console_early_init(void)
 {
     /* set the default vc driver */
-    if (!object_class_by_name(TYPE_CHARDEV_VC)) {
+    if (!object_class_by_name(TYPE_VC_CHARDEV)) {
         type_register(&char_vc_type_info);
     }
 }
ui/gtk.c +3 -3
index d28d7545d3..ecaa9527fc 100644
@@ -178,9 +178,9 @@ struct VCChardev {
 };
 typedef struct VCChardev VCChardev;
 
-#define TYPE_CHARDEV_VC "chardev-vc"
+#define TYPE_VC_CHARDEV "chardev-vc"
 DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
-                         TYPE_CHARDEV_VC)
+                         TYPE_VC_CHARDEV)
 
 bool gtk_use_gl_area;
 
@@ -1717,7 +1717,7 @@ static void char_gd_vc_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_gd_vc_type_info = {
-    .name = TYPE_CHARDEV_VC,
+    .name = TYPE_VC_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(VCChardev),
     .class_init = char_gd_vc_class_init,
ui/spice-app.c +5 -5
index 93e105c6ee..e69dc21c78 100644
@@ -46,9 +46,9 @@ struct VCChardev {
 };
 typedef struct VCChardev VCChardev;
 
-#define TYPE_CHARDEV_VC "chardev-vc"
+#define TYPE_VC_CHARDEV "chardev-vc"
 DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
-                         TYPE_CHARDEV_VC)
+                         TYPE_VC_CHARDEV)
 
 static ChardevBackend *
 chr_spice_backend_new(void)
@@ -99,8 +99,8 @@ static void char_vc_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_vc_type_info = {
-    .name = TYPE_CHARDEV_VC,
-    .parent = TYPE_CHARDEV_SPICEPORT,
+    .name = TYPE_VC_CHARDEV,
+    .parent = TYPE_SPICEPORT_CHARDEV,
     .instance_size = sizeof(VCChardev),
     .class_init = char_vc_class_init,
 };
@@ -166,7 +166,7 @@ static void spice_app_display_early_init(DisplayOptions *opts)
     display_opengl = opts->has_gl;
 #endif
     be->u.spiceport.data->fqdn = g_strdup("org.qemu.monitor.qmp.0");
-    qemu_chardev_new("org.qemu.monitor.qmp", TYPE_CHARDEV_SPICEPORT,
+    qemu_chardev_new("org.qemu.monitor.qmp", TYPE_SPICEPORT_CHARDEV,
                      be, NULL, &error_abort);
     qopts = qemu_opts_create(qemu_find_opts("mon"),
                              NULL, 0, &error_fatal);
Signature · 1 line
2.26.2
Reviewed-by on v1 2/63
#4 lore raw

Re: [PATCH 02/63] chardev: Rename TYPE_CHARDEV_* to TYPE_*_CHARDEV

Quoted 40 lines · Eduardo Habkost

This will make the TYPE_* constants consistent with the name of most type checking macros we have today.

---
Cc: Samuel Thibault <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 chardev/chardev-internal.h       |  4 ++--
 include/chardev/char-fd.h        |  4 ++--
 include/chardev/char-win-stdio.h |  2 +-
 include/chardev/char-win.h       |  4 ++--
 include/chardev/char.h           | 30 +++++++++++++++---------------
 include/chardev/spice.h          |  8 ++++----
 chardev/baum.c                   |  6 +++---
 chardev/char-console.c           |  4 ++--
 chardev/char-fd.c                |  2 +-
 chardev/char-file.c              |  6 +++---
 chardev/char-mux.c               |  2 +-
 chardev/char-null.c              |  2 +-
 chardev/char-parallel.c          |  4 ++--
 chardev/char-pipe.c              |  6 +++---
 chardev/char-pty.c               |  4 ++--
 chardev/char-ringbuf.c           |  8 ++++----
 chardev/char-serial.c            |  6 +++---
 chardev/char-socket.c            |  4 ++--
 chardev/char-stdio.c             |  6 +++---
 chardev/char-udp.c               |  4 ++--
 chardev/char-win-stdio.c         |  4 ++--
 chardev/char-win.c               |  2 +-
 chardev/char.c                   |  2 +-
 chardev/msmouse.c                |  6 +++---
 chardev/spice.c                  | 10 +++++-----
 chardev/testdev.c                |  6 +++---
Quoted 8 lines
 chardev/wctablet.c               |  6 +++---
 gdbstub.c                        |  6 +++---
 hw/display/vhost-user-gpu.c      |  2 +-
 tests/test-char.c                |  4 ++--
 ui/console.c                     |  8 ++++----
 ui/gtk.c                         |  6 +++---
 ui/spice-app.c                   | 10 +++++-----
 33 files changed, 94 insertions(+), 94 deletions(-)
#5 lore raw

Re: [PATCH 02/63] chardev: Rename TYPE_CHARDEV_* to TYPE_*_CHARDEV

In reply to Eduardo Habkost
Quoted 4 lines · Eduardo Habkost

This will make the TYPE_* constants consistent with the name of most type checking macros we have today.

I will drop this and send a separate patch to rename the type checking macros instead, because that would make all identifiers match the actual QOM type name strings ("chardev-*").

Signature · 1 line
Eduardo
#6 lore raw

PATCH 3/63 chardev: Rename TYPE_BRAILLE_CHARDEV to TYPE_BAUM_CHARDEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Samuel Thibault <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 chardev/baum.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
chardev/baum.c +3 -3
index d6c9f698c1..0cae8373f4 100644
@@ -104,9 +104,9 @@ struct BaumChardev {
 };
 typedef struct BaumChardev BaumChardev;
 
-#define TYPE_BRAILLE_CHARDEV "chardev-braille"
+#define TYPE_BAUM_CHARDEV "chardev-braille"
 DECLARE_INSTANCE_CHECKER(BaumChardev, BAUM_CHARDEV,
-                         TYPE_BRAILLE_CHARDEV)
+                         TYPE_BAUM_CHARDEV)
 
 /* Let's assume NABCC by default */
 enum way {
@@ -674,7 +674,7 @@ static void char_braille_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_braille_type_info = {
-    .name = TYPE_BRAILLE_CHARDEV,
+    .name = TYPE_BAUM_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(BaumChardev),
     .instance_finalize = char_braille_finalize,
Signature · 1 line
2.26.2
#7 lore raw

PATCH 4/63 chardev: Rename TYPE_MSMOUSE_CHARDEV to TYPE_MOUSE_CHARDEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 chardev/msmouse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
chardev/msmouse.c +3 -3
index 4033ca714d..b39a1b85dd 100644
@@ -44,9 +44,9 @@ struct MouseChardev {
 };
 typedef struct MouseChardev MouseChardev;
 
-#define TYPE_MSMOUSE_CHARDEV "chardev-msmouse"
+#define TYPE_MOUSE_CHARDEV "chardev-msmouse"
 DECLARE_INSTANCE_CHECKER(MouseChardev, MOUSE_CHARDEV,
-                         TYPE_MSMOUSE_CHARDEV)
+                         TYPE_MOUSE_CHARDEV)
 
 static void msmouse_chr_accept_input(Chardev *chr)
 {
@@ -178,7 +178,7 @@ static void char_msmouse_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo char_msmouse_type_info = {
-    .name = TYPE_MSMOUSE_CHARDEV,
+    .name = TYPE_MOUSE_CHARDEV,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(MouseChardev),
     .instance_finalize = char_msmouse_finalize,
Signature · 1 line
2.26.2
#8 lore raw

PATCH 5/63 ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/s390x/ap-device.h | 4 ++--
 hw/s390x/ap-device.c         | 2 +-
 hw/vfio/ap.c                 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
include/hw/s390x/ap-device.h +2 -2
index fb250a20f3..e502745de5 100644
@@ -14,7 +14,7 @@
 #include "hw/qdev-core.h"
 #include "qom/object.h"
 
-#define AP_DEVICE_TYPE       "ap-device"
+#define TYPE_AP_DEVICE       "ap-device"
 
 struct APDevice {
     DeviceState parent_obj;
@@ -22,6 +22,6 @@ struct APDevice {
 typedef struct APDevice APDevice;
 
 DECLARE_INSTANCE_CHECKER(APDevice, AP_DEVICE,
-                         AP_DEVICE_TYPE)
+                         TYPE_AP_DEVICE)
 
 #endif /* HW_S390X_AP_DEVICE_H */
hw/s390x/ap-device.c +1 -1
index fc0b41e937..237d1f19c5 100644
@@ -21,7 +21,7 @@ static void ap_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ap_device_info = {
-    .name = AP_DEVICE_TYPE,
+    .name = TYPE_AP_DEVICE,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(APDevice),
     .class_size = sizeof(DeviceClass),
hw/vfio/ap.c +1 -1
index f399ec0a31..68ed059b39 100644
@@ -177,7 +177,7 @@ static void vfio_ap_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo vfio_ap_info = {
     .name = VFIO_AP_DEVICE_TYPE,
-    .parent = AP_DEVICE_TYPE,
+    .parent = TYPE_AP_DEVICE,
     .instance_size = sizeof(VFIOAPDevice),
     .class_init = vfio_ap_class_init,
 };
Signature · 1 line
2.26.2
Reviewed-by on v1 5/63
#9 lore raw

Re: [PATCH 05/63] ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE

Quoted 62 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/s390x/ap-device.h | 4 ++--
 hw/s390x/ap-device.c         | 2 +-
 hw/vfio/ap.c                 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
include/hw/s390x/ap-device.h +2 -2
index fb250a20f3..e502745de5 100644
@@ -14,7 +14,7 @@
 #include "hw/qdev-core.h"
 #include "qom/object.h"
 
-#define AP_DEVICE_TYPE       "ap-device"
+#define TYPE_AP_DEVICE       "ap-device"
 
 struct APDevice {
     DeviceState parent_obj;
@@ -22,6 +22,6 @@ struct APDevice {
 typedef struct APDevice APDevice;
 
 DECLARE_INSTANCE_CHECKER(APDevice, AP_DEVICE,
-                         AP_DEVICE_TYPE)
+                         TYPE_AP_DEVICE)
 
 #endif /* HW_S390X_AP_DEVICE_H */
hw/s390x/ap-device.c +1 -1
index fc0b41e937..237d1f19c5 100644
@@ -21,7 +21,7 @@ static void ap_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ap_device_info = {
-    .name = AP_DEVICE_TYPE,
+    .name = TYPE_AP_DEVICE,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(APDevice),
     .class_size = sizeof(DeviceClass),
hw/vfio/ap.c +0 -0
index f399ec0a31..68ed059b39 100644

hw/vfio/ap.c static void vfio_ap_class_init(ObjectClass *klass, void *data) · line 183

Quoted 8 lines
hw/vfio/ap.c +1 -1
@@ -177,7 +177,7 @@ static void vfio_ap_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo vfio_ap_info = {
     .name = VFIO_AP_DEVICE_TYPE,
-    .parent = AP_DEVICE_TYPE,
+    .parent = TYPE_AP_DEVICE,
     .instance_size = sizeof(VFIOAPDevice),
     .class_init = vfio_ap_class_init,
 };
Acked-by on v1 5/63
#10 lore raw

Re: [PATCH 05/63] ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE

In reply to Eduardo Habkost
Quoted 16 lines · On Wed, 2 Sep 2020 18:42:13 -0400 Eduardo Habkost <[email protected]> wrote:

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 6 lines
---
 include/hw/s390x/ap-device.h | 4 ++--
 hw/s390x/ap-device.c         | 2 +-
 hw/vfio/ap.c                 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
#11 lore raw

PATCH 6/63 dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/dev-smartcard-reader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/usb/dev-smartcard-reader.c +4 -4
index 432508c478..59b2248f34 100644
@@ -60,10 +60,10 @@ do { \
 #define D_MORE_INFO 3
 #define D_VERBOSE 4
 
-#define CCID_DEV_NAME "usb-ccid"
+#define TYPE_USB_CCID_DEV "usb-ccid"
 typedef struct USBCCIDState USBCCIDState;
 DECLARE_INSTANCE_CHECKER(USBCCIDState, USB_CCID_DEV,
-                         CCID_DEV_NAME)
+                         TYPE_USB_CCID_DEV)
 /*
  * The two options for variable sized buffers:
  * make them constant size, for large enough constant,
@@ -1462,7 +1462,7 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ccid_info = {
-    .name          = CCID_DEV_NAME,
+    .name          = TYPE_USB_CCID_DEV,
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBCCIDState),
     .class_init    = ccid_class_initfn,
@@ -1495,7 +1495,7 @@ static void ccid_register_types(void)
     type_register_static(&ccid_bus_info);
     type_register_static(&ccid_card_type_info);
     type_register_static(&ccid_info);
-    usb_legacy_register(CCID_DEV_NAME, "ccid", NULL);
+    usb_legacy_register(TYPE_USB_CCID_DEV, "ccid", NULL);
 }
 
 type_init(ccid_register_types)
Signature · 1 line
2.26.2
Reviewed-by on v1 6/63
#12 lore raw

Re: [PATCH 06/63] dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV

Quoted 4 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

Quoted 43 lines

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/dev-smartcard-reader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/usb/dev-smartcard-reader.c +4 -4
index 432508c478..59b2248f34 100644
@@ -60,10 +60,10 @@ do { \
 #define D_MORE_INFO 3
 #define D_VERBOSE 4
 
-#define CCID_DEV_NAME "usb-ccid"
+#define TYPE_USB_CCID_DEV "usb-ccid"
 typedef struct USBCCIDState USBCCIDState;
 DECLARE_INSTANCE_CHECKER(USBCCIDState, USB_CCID_DEV,
-                         CCID_DEV_NAME)
+                         TYPE_USB_CCID_DEV)
 /*
  * The two options for variable sized buffers:
  * make them constant size, for large enough constant,
@@ -1462,7 +1462,7 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ccid_info = {
-    .name          = CCID_DEV_NAME,
+    .name          = TYPE_USB_CCID_DEV,
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBCCIDState),
     .class_init    = ccid_class_initfn,
@@ -1495,7 +1495,7 @@ static void ccid_register_types(void)
     type_register_static(&ccid_bus_info);
     type_register_static(&ccid_card_type_info);
     type_register_static(&ccid_info);
-    usb_legacy_register(CCID_DEV_NAME, "ccid", NULL);
+    usb_legacy_register(TYPE_USB_CCID_DEV, "ccid", NULL);
 }
 
 type_init(ccid_register_types)
#13 lore raw

PATCH 7/63 rdma: Rename PVRDMA_HW_NAME to TYPE_PVRDMA_DEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Yuval Shaia <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]

---
 hw/rdma/vmw/pvrdma.h      | 4 ++--
 hw/rdma/vmw/pvrdma_main.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/rdma/vmw/pvrdma.h +2 -2
index 1d36a76f1e..e7e610b223 100644
@@ -50,7 +50,7 @@
 #define INTR_VEC_CMD_COMPLETION_Q    2
 
 /* HW attributes */
-#define PVRDMA_HW_NAME       "pvrdma"
+#define TYPE_PVRDMA_DEV       "pvrdma"
 #define PVRDMA_HW_VERSION    17
 #define PVRDMA_FW_VERSION    14
 
@@ -102,7 +102,7 @@ struct PVRDMADev {
 };
 typedef struct PVRDMADev PVRDMADev;
 DECLARE_INSTANCE_CHECKER(PVRDMADev, PVRDMA_DEV,
-                         PVRDMA_HW_NAME)
+                         TYPE_PVRDMA_DEV)
 
 static inline int get_reg_val(PVRDMADev *dev, hwaddr addr, uint32_t *val)
 {
hw/rdma/vmw/pvrdma_main.c +1 -1
index 77b1235a3f..a08f720bfd 100644
@@ -697,7 +697,7 @@ static void pvrdma_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pvrdma_info = {
-    .name = PVRDMA_HW_NAME,
+    .name = TYPE_PVRDMA_DEV,
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PVRDMADev),
     .class_init = pvrdma_class_init,
Signature · 1 line
2.26.2
#14 lore raw

PATCH 8/63 vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/vfio/ap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/vfio/ap.c +4 -4
index 68ed059b39..582c091a24 100644
@@ -30,7 +30,7 @@
 #include "exec/address-spaces.h"
 #include "qom/object.h"
 
-#define VFIO_AP_DEVICE_TYPE      "vfio-ap"
+#define TYPE_VFIO_AP_DEVICE      "vfio-ap"
 
 struct VFIOAPDevice {
     APDevice apdev;
@@ -39,7 +39,7 @@ struct VFIOAPDevice {
 typedef struct VFIOAPDevice VFIOAPDevice;
 
 DECLARE_INSTANCE_CHECKER(VFIOAPDevice, VFIO_AP_DEVICE,
-                         VFIO_AP_DEVICE_TYPE)
+                         TYPE_VFIO_AP_DEVICE)
 
 static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
 {
@@ -72,7 +72,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
 
     if (!group_path) {
         error_setg(errp, "%s: no iommu_group found for %s: %s",
-                   VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
+                   TYPE_VFIO_AP_DEVICE, vapdev->vdev.sysfsdev, gerror->message);
         g_error_free(gerror);
         return NULL;
     }
@@ -176,7 +176,7 @@ static void vfio_ap_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vfio_ap_info = {
-    .name = VFIO_AP_DEVICE_TYPE,
+    .name = TYPE_VFIO_AP_DEVICE,
     .parent = TYPE_AP_DEVICE,
     .instance_size = sizeof(VFIOAPDevice),
     .class_init = vfio_ap_class_init,
Signature · 1 line
2.26.2
Reviewed-by on v1 8/63
#15 lore raw

Re: [PATCH 08/63] vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE

Quoted 51 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/vfio/ap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/vfio/ap.c +3 -3
index 68ed059b39..582c091a24 100644
@@ -30,7 +30,7 @@
 #include "exec/address-spaces.h"
 #include "qom/object.h"
 
-#define VFIO_AP_DEVICE_TYPE      "vfio-ap"
+#define TYPE_VFIO_AP_DEVICE      "vfio-ap"
 
 struct VFIOAPDevice {
     APDevice apdev;
@@ -39,7 +39,7 @@ struct VFIOAPDevice {
 typedef struct VFIOAPDevice VFIOAPDevice;
 
 DECLARE_INSTANCE_CHECKER(VFIOAPDevice, VFIO_AP_DEVICE,
-                         VFIO_AP_DEVICE_TYPE)
+                         TYPE_VFIO_AP_DEVICE)
 
 static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
 {
@@ -72,7 +72,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
 
     if (!group_path) {
         error_setg(errp, "%s: no iommu_group found for %s: %s",
-                   VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
+                   TYPE_VFIO_AP_DEVICE, vapdev->vdev.sysfsdev, gerror->message);
         g_error_free(gerror);
         return NULL;
     }

hw/vfio/ap.c static void vfio_ap_class_init(ObjectClass *klass, void *data) · line 182

Quoted 8 lines
hw/vfio/ap.c +1 -1
@@ -176,7 +176,7 @@ static void vfio_ap_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vfio_ap_info = {
-    .name = VFIO_AP_DEVICE_TYPE,
+    .name = TYPE_VFIO_AP_DEVICE,
     .parent = TYPE_AP_DEVICE,
     .instance_size = sizeof(VFIOAPDevice),
     .class_init = vfio_ap_class_init,
Acked-by on v1 8/63
#16 lore raw

Re: [PATCH 08/63] vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE

In reply to Eduardo Habkost
Quoted 14 lines · On Wed, 2 Sep 2020 18:42:16 -0400 Eduardo Habkost <[email protected]> wrote:

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Tony Krowiak <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
---
 hw/vfio/ap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
#17 lore raw

PATCH 9/63 vmcoreinfo: Rename VMCOREINFO_DEVICE to TYPE_VMCOREINFO

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Marc-André Lureau" <[email protected]>
Cc: [email protected]

---
 include/hw/misc/vmcoreinfo.h | 6 +++---
 hw/misc/vmcoreinfo.c         | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/misc/vmcoreinfo.h +3 -3
index ebada6617a..6e523c3892 100644
@@ -16,10 +16,10 @@
 #include "standard-headers/linux/qemu_fw_cfg.h"
 #include "qom/object.h"
 
-#define VMCOREINFO_DEVICE "vmcoreinfo"
+#define TYPE_VMCOREINFO "vmcoreinfo"
 typedef struct VMCoreInfoState VMCoreInfoState;
 DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO,
-                         VMCOREINFO_DEVICE)
+                         TYPE_VMCOREINFO)
 
 typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo;
 
@@ -33,7 +33,7 @@ struct VMCoreInfoState {
 /* returns NULL unless there is exactly one device */
 static inline VMCoreInfoState *vmcoreinfo_find(void)
 {
-    Object *o = object_resolve_path_type("", VMCOREINFO_DEVICE, NULL);
+    Object *o = object_resolve_path_type("", TYPE_VMCOREINFO, NULL);
 
     return o ? VMCOREINFO(o) : NULL;
 }
hw/misc/vmcoreinfo.c +3 -3
index a9d718fc23..a68e3ad68c 100644
@@ -47,13 +47,13 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
      */
     if (!vmcoreinfo_find()) {
         error_setg(errp, "at most one %s device is permitted",
-                   VMCOREINFO_DEVICE);
+                   TYPE_VMCOREINFO);
         return;
     }
 
     if (!fw_cfg || !fw_cfg->dma_enabled) {
         error_setg(errp, "%s device requires fw_cfg with DMA",
-                   VMCOREINFO_DEVICE);
+                   TYPE_VMCOREINFO);
         return;
     }
 
@@ -94,7 +94,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vmcoreinfo_device_info = {
-    .name          = VMCOREINFO_DEVICE,
+    .name          = TYPE_VMCOREINFO,
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(VMCoreInfoState),
     .class_init    = vmcoreinfo_device_class_init,
Signature · 1 line
2.26.2
#18 lore raw

PATCH 10/63 vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Ben Warren <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 include/hw/acpi/vmgenid.h | 6 +++---
 hw/acpi/vmgenid.c         | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/acpi/vmgenid.h +3 -3
index 86cd1da605..aff574df5f 100644
@@ -6,7 +6,7 @@
 #include "qemu/uuid.h"
 #include "qom/object.h"
 
-#define VMGENID_DEVICE           "vmgenid"
+#define TYPE_VMGENID           "vmgenid"
 #define VMGENID_GUID             "guid"
 #define VMGENID_GUID_FW_CFG_FILE      "etc/vmgenid_guid"
 #define VMGENID_ADDR_FW_CFG_FILE      "etc/vmgenid_addr"
@@ -18,7 +18,7 @@
 
 typedef struct VmGenIdState VmGenIdState;
 DECLARE_INSTANCE_CHECKER(VmGenIdState, VMGENID,
-                         VMGENID_DEVICE)
+                         TYPE_VMGENID)
 
 struct VmGenIdState {
     DeviceClass parent_obj;
@@ -29,7 +29,7 @@ struct VmGenIdState {
 /* returns NULL unless there is exactly one device */
 static inline Object *find_vmgenid_dev(void)
 {
-    return object_resolve_path_type("", VMGENID_DEVICE, NULL);
+    return object_resolve_path_type("", TYPE_VMGENID, NULL);
 }
 
 void vmgenid_build_acpi(VmGenIdState *vms, GArray *table_data, GArray *guid,
hw/acpi/vmgenid.c +3 -3
index 2df7623d74..53db6af75d 100644
@@ -198,7 +198,7 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
 
     if (!bios_linker_loader_can_write_pointer()) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
-                   "which this machine type does not provide", VMGENID_DEVICE);
+                   "which this machine type does not provide", TYPE_VMGENID);
         return;
     }
 
@@ -206,7 +206,7 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
      * device. Check if there are several.
      */
     if (!find_vmgenid_dev()) {
-        error_setg(errp, "at most one %s device is permitted", VMGENID_DEVICE);
+        error_setg(errp, "at most one %s device is permitted", TYPE_VMGENID);
         return;
     }
 
@@ -232,7 +232,7 @@ static void vmgenid_device_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vmgenid_device_info = {
-    .name          = VMGENID_DEVICE,
+    .name          = TYPE_VMGENID,
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(VmGenIdState),
     .class_init    = vmgenid_device_class_init,
Signature · 1 line
2.26.2
Reviewed-by on v1 10/63
#19 lore raw

Re: [PATCH 10/63] vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID

Quoted 4 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

Quoted 73 lines

---
Cc: Ben Warren <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 include/hw/acpi/vmgenid.h | 6 +++---
 hw/acpi/vmgenid.c         | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/acpi/vmgenid.h +3 -3
index 86cd1da605..aff574df5f 100644
@@ -6,7 +6,7 @@
 #include "qemu/uuid.h"
 #include "qom/object.h"
 
-#define VMGENID_DEVICE           "vmgenid"
+#define TYPE_VMGENID           "vmgenid"
 #define VMGENID_GUID             "guid"
 #define VMGENID_GUID_FW_CFG_FILE      "etc/vmgenid_guid"
 #define VMGENID_ADDR_FW_CFG_FILE      "etc/vmgenid_addr"
@@ -18,7 +18,7 @@
 
 typedef struct VmGenIdState VmGenIdState;
 DECLARE_INSTANCE_CHECKER(VmGenIdState, VMGENID,
-                         VMGENID_DEVICE)
+                         TYPE_VMGENID)
 
 struct VmGenIdState {
     DeviceClass parent_obj;
@@ -29,7 +29,7 @@ struct VmGenIdState {
 /* returns NULL unless there is exactly one device */
 static inline Object *find_vmgenid_dev(void)
 {
-    return object_resolve_path_type("", VMGENID_DEVICE, NULL);
+    return object_resolve_path_type("", TYPE_VMGENID, NULL);
 }
 
 void vmgenid_build_acpi(VmGenIdState *vms, GArray *table_data, GArray *guid,
hw/acpi/vmgenid.c +3 -3
index 2df7623d74..53db6af75d 100644
@@ -198,7 +198,7 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
 
     if (!bios_linker_loader_can_write_pointer()) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
-                   "which this machine type does not provide", VMGENID_DEVICE);
+                   "which this machine type does not provide", TYPE_VMGENID);
         return;
     }
 
@@ -206,7 +206,7 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
      * device. Check if there are several.
      */
     if (!find_vmgenid_dev()) {
-        error_setg(errp, "at most one %s device is permitted", VMGENID_DEVICE);
+        error_setg(errp, "at most one %s device is permitted", TYPE_VMGENID);
         return;
     }
 
@@ -232,7 +232,7 @@ static void vmgenid_device_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vmgenid_device_info = {
-    .name          = VMGENID_DEVICE,
+    .name          = TYPE_VMGENID,
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(VmGenIdState),
     .class_init    = vmgenid_device_class_init,
#20 lore raw

PATCH 11/63 edu: Rename TYPE_PCI_EDU_DEVICE to TYPE_EDU

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Jiri Slaby <[email protected]>
Cc: [email protected]

---
 hw/misc/edu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/misc/edu.c +3 -3
index 0ff9d1ac78..b69728838d 100644
@@ -33,10 +33,10 @@
 #include "qemu/module.h"
 #include "qapi/visitor.h"
 
-#define TYPE_PCI_EDU_DEVICE "edu"
+#define TYPE_EDU "edu"
 typedef struct EduState EduState;
 DECLARE_INSTANCE_CHECKER(EduState, EDU,
-                         TYPE_PCI_EDU_DEVICE)
+                         TYPE_EDU)
 
 #define FACT_IRQ        0x00000001
 #define DMA_IRQ         0x00000100
@@ -429,7 +429,7 @@ static void pci_edu_register_types(void)
         { },
     };
     static const TypeInfo edu_info = {
-        .name          = TYPE_PCI_EDU_DEVICE,
+        .name          = TYPE_EDU,
         .parent        = TYPE_PCI_DEVICE,
         .instance_size = sizeof(EduState),
         .instance_init = edu_instance_init,
Signature · 1 line
2.26.2
#21 lore raw

PATCH 12/63 etrax: Rename TYPE_ETRAX_FS_SERIAL to TYPE_ETRAX_SERIAL

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/char/etraxfs_ser.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/char/etraxfs_ser.c +3 -3
index d9fba2ae6c..6bfc6d376d 100644
@@ -49,10 +49,10 @@
 #define STAT_TR_IDLE 22
 #define STAT_TR_RDY  24
 
-#define TYPE_ETRAX_FS_SERIAL "etraxfs,serial"
+#define TYPE_ETRAX_SERIAL "etraxfs,serial"
 typedef struct ETRAXSerial ETRAXSerial;
 DECLARE_INSTANCE_CHECKER(ETRAXSerial, ETRAX_SERIAL,
-                         TYPE_ETRAX_FS_SERIAL)
+                         TYPE_ETRAX_SERIAL)
 
 struct ETRAXSerial {
     SysBusDevice parent_obj;
@@ -251,7 +251,7 @@ static void etraxfs_ser_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo etraxfs_ser_info = {
-    .name          = TYPE_ETRAX_FS_SERIAL,
+    .name          = TYPE_ETRAX_SERIAL,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(ETRAXSerial),
     .instance_init = etraxfs_ser_init,
Signature · 1 line
2.26.2
#22 lore raw

PATCH 13/63 etrax: Rename TYPE_ETRAX_FS_TIMER to TYPE_ETRAX_TIMER

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: [email protected]

---
 hw/timer/etraxfs_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/timer/etraxfs_timer.c +3 -3
index 48f2e3ade2..585e934ed5 100644
@@ -48,10 +48,10 @@
 #define R_INTR        0x50
 #define R_MASKED_INTR 0x54
 
-#define TYPE_ETRAX_FS_TIMER "etraxfs,timer"
+#define TYPE_ETRAX_TIMER "etraxfs,timer"
 typedef struct ETRAXTimerState ETRAXTimerState;
 DECLARE_INSTANCE_CHECKER(ETRAXTimerState, ETRAX_TIMER,
-                         TYPE_ETRAX_FS_TIMER)
+                         TYPE_ETRAX_TIMER)
 
 struct ETRAXTimerState {
     SysBusDevice parent_obj;
@@ -354,7 +354,7 @@ static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo etraxfs_timer_info = {
-    .name          = TYPE_ETRAX_FS_TIMER,
+    .name          = TYPE_ETRAX_TIMER,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(ETRAXTimerState),
     .class_init    = etraxfs_timer_class_init,
Signature · 1 line
2.26.2
#23 lore raw

PATCH 14/63 i8254: Rename TYPE_I8254 to TYPE_PIT

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +2 -2
index 1a522a2457..ddd925074f 100644
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"
 #define TYPE_KVM_I8254 "kvm-pit"
 
 static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
@@ -54,7 +54,7 @@ static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
     DeviceState *dev;
     ISADevice *d;
 
-    d = isa_new(TYPE_I8254);
+    d = isa_new(TYPE_PIT);
     dev = DEVICE(d);
     qdev_prop_set_uint32(dev, "iobase", base);
     isa_realize_and_unref(d, bus, &error_fatal);
hw/timer/i8254.c +2 -2
index c01ee2c72a..86f455f67e 100644
@@ -39,7 +39,7 @@
 
 typedef struct PITClass PITClass;
 DECLARE_CLASS_CHECKERS(PITClass, PIT,
-                       TYPE_I8254)
+                       TYPE_PIT)
 
 struct PITClass {
     PITCommonClass parent_class;
@@ -370,7 +370,7 @@ static void pit_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pit_info = {
-    .name          = TYPE_I8254,
+    .name          = TYPE_PIT,
     .parent        = TYPE_PIT_COMMON,
     .instance_size = sizeof(PITCommonState),
     .class_init    = pit_class_initfn,
Signature · 1 line
2.26.2
#24 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 18 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 5 lines
include/hw/timer/i8254.h +1 -1
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

Quoted 35 lines
include/hw/timer/i8254.h +1 -1
 #define TYPE_KVM_I8254 "kvm-pit"
 
 static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
@@ -54,7 +54,7 @@ static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
     DeviceState *dev;
     ISADevice *d;
 
-    d = isa_new(TYPE_I8254);
+    d = isa_new(TYPE_PIT);
     dev = DEVICE(d);
     qdev_prop_set_uint32(dev, "iobase", base);
     isa_realize_and_unref(d, bus, &error_fatal);
hw/timer/i8254.c +2 -2
index c01ee2c72a..86f455f67e 100644
@@ -39,7 +39,7 @@
 
 typedef struct PITClass PITClass;
 DECLARE_CLASS_CHECKERS(PITClass, PIT,
-                       TYPE_I8254)
+                       TYPE_PIT)
 
 struct PITClass {
     PITCommonClass parent_class;
@@ -370,7 +370,7 @@ static void pit_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pit_info = {
-    .name          = TYPE_I8254,
+    .name          = TYPE_PIT,
     .parent        = TYPE_PIT_COMMON,
     .instance_size = sizeof(PITCommonState),
     .class_init    = pit_class_initfn,
#25 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
Quoted 4 lines

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 2 lines
include/hw/timer/i8254.h +1 -1
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

I was unsure about this, and I agree with your point. I will suggest renaming the PIT macro to I8254 instead.

Signature · 1 line
Eduardo
#26 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
Quoted 7 lines
Quoted 4 lines

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 2 lines
include/hw/timer/i8254.h +1 -1
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

I was unsure about this, and I agree with your point. I will suggest renaming the PIT macro to I8254 instead.

IMHO the macro name should be directly related to the object name string with non-alnum characters replaced by underscore.

ie since the object type is "isa-pit", then the macro should be TYPE_ISA_PIT

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#27 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 29 lines · Daniel P. Berrangé
Quoted 28 lines · Eduardo Habkost
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 5 lines
include/hw/timer/i8254.h +1 -1
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

Quoted 8 lines
Quoted 2 lines

I was unsure about this, and I agree with your point. I will suggest renaming the PIT macro to I8254 instead.

IMHO the macro name should be directly related to the object name string with non-alnum characters replaced by underscore.

ie since the object type is "isa-pit", then the macro should be TYPE_ISA_PIT

I think that's a good idea in this specific case because it's a short name (I will do it). But I don't think we'll be able to always follow that rule, as the QOM type name is user-visible.

Signature · 1 line
Eduardo
#28 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 36 lines · Eduardo Habkost
Quoted 35 lines · Daniel P. Berrangé
Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
Quoted 7 lines
Quoted 4 lines

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 2 lines
include/hw/timer/i8254.h +1 -1
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

I was unsure about this, and I agree with your point. I will suggest renaming the PIT macro to I8254 instead.

IMHO the macro name should be directly related to the object name string with non-alnum characters replaced by underscore.

Quoted 6 lines
Quoted 2 lines

ie since the object type is "isa-pit", then the macro should be TYPE_ISA_PIT

I think that's a good idea in this specific case because it's a short name (I will do it). But I don't think we'll be able to always follow that rule, as the QOM type name is user-visible.

Only user-visible if user-creatable, right?

#29 lore raw

Re: [PATCH 14/63] i8254: Rename TYPE_I8254 to TYPE_PIT

Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 36 lines · Eduardo Habkost
Quoted 35 lines · Daniel P. Berrangé
Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h | 4 ++--
 hw/timer/i8254.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +0 -0
index 1a522a2457..ddd925074f 100644
@@ -45,7 +45,7 @@ typedef struct PITCommonClass PITCommonClass;
 DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
                      PIT_COMMON, TYPE_PIT_COMMON)
 
Quoted 7 lines
Quoted 4 lines

include/hw/timer/i8254.h typedef struct PITCommonClass PITCommonClass; · line 48

Quoted 2 lines
include/hw/timer/i8254.h +1 -1
-#define TYPE_I8254 "isa-pit"
+#define TYPE_PIT "isa-pit"

I disagree with this patch, as we have various PIT and only one I8254.

I was unsure about this, and I agree with your point. I will suggest renaming the PIT macro to I8254 instead.

IMHO the macro name should be directly related to the object name string with non-alnum characters replaced by underscore.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

ie since the object type is "isa-pit", then the macro should be TYPE_ISA_PIT

I think that's a good idea in this specific case because it's a short name (I will do it). But I don't think we'll be able to always follow that rule, as the QOM type name is user-visible.

Only user-visible if user-creatable, right?

All of them are user-visible. All devices have their properties configurable using -global, and are visible in the QOM and qdev trees.

It doesn't mean we can't change them, but it means that changing them is more than just code refactoring.

Signature · 1 line
Eduardo
#30 lore raw

PATCH 15/63 i8259: Rename TYPE_I8259 to TYPE_PIC

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/intc/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/intc/i8259.c +5 -5
index 344fd04db1..e536cc90be 100644
@@ -37,10 +37,10 @@
 
 //#define DEBUG_IRQ_LATENCY
 
-#define TYPE_I8259 "isa-i8259"
+#define TYPE_PIC "isa-i8259"
 typedef struct PICClass PICClass;
 DECLARE_CLASS_CHECKERS(PICClass, PIC,
-                       TYPE_I8259)
+                       TYPE_PIC)
 
 /**
  * PICClass:
@@ -418,7 +418,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, true);
+    isadev = i8259_init_chip(TYPE_PIC, bus, true);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, parent_irq);
@@ -428,7 +428,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     isa_pic = dev;
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, false);
+    isadev = i8259_init_chip(TYPE_PIC, bus, false);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, irq_set[2]);
@@ -451,7 +451,7 @@ static void i8259_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo i8259_info = {
-    .name       = TYPE_I8259,
+    .name       = TYPE_PIC,
     .instance_size = sizeof(PICCommonState),
     .parent     = TYPE_PIC_COMMON,
     .class_init = i8259_class_init,
Signature · 1 line
2.26.2
#31 lore raw

Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC

Quoted 17 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/intc/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/intc/i8259.c +0 -0
index 344fd04db1..e536cc90be 100644

hw/intc/i8259.c line 40

Quoted 5 lines
hw/intc/i8259.c +1 -1
@@ -37,10 +37,10 @@
 
 //#define DEBUG_IRQ_LATENCY
 
-#define TYPE_I8259 "isa-i8259"
+#define TYPE_PIC "isa-i8259"

I disagree with this patch, as we have various PIC and only one I8259.

Quoted 35 lines
hw/intc/i8259.c +4 -4
 typedef struct PICClass PICClass;
 DECLARE_CLASS_CHECKERS(PICClass, PIC,
-                       TYPE_I8259)
+                       TYPE_PIC)
 
 /**
  * PICClass:
@@ -418,7 +418,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, true);
+    isadev = i8259_init_chip(TYPE_PIC, bus, true);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, parent_irq);
@@ -428,7 +428,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     isa_pic = dev;
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, false);
+    isadev = i8259_init_chip(TYPE_PIC, bus, false);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, irq_set[2]);
@@ -451,7 +451,7 @@ static void i8259_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo i8259_info = {
-    .name       = TYPE_I8259,
+    .name       = TYPE_PIC,
     .instance_size = sizeof(PICCommonState),
     .parent     = TYPE_PIC_COMMON,
     .class_init = i8259_class_init,
#32 lore raw

Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC

Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/intc/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/intc/i8259.c +0 -0
index 344fd04db1..e536cc90be 100644
@@ -37,10 +37,10 @@
 
Quoted 6 lines

hw/intc/i8259.c line 40

Quoted 4 lines
hw/intc/i8259.c +1 -1
 //#define DEBUG_IRQ_LATENCY
 
-#define TYPE_I8259 "isa-i8259"
+#define TYPE_PIC "isa-i8259"

I disagree with this patch, as we have various PIC and only one I8259.

Like in the I8254 case, I agree with your point. I will suggest renaming the PIC macro to I8259 instead.

Signature · 1 line
Eduardo
#33 lore raw

Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC

Quoted 22 lines · Eduardo Habkost
Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/intc/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/intc/i8259.c +0 -0
index 344fd04db1..e536cc90be 100644
@@ -37,10 +37,10 @@
 
 //#define DEBUG_IRQ_LATENCY
 
Quoted 7 lines
Quoted 4 lines

hw/intc/i8259.c line 40

Quoted 2 lines
hw/intc/i8259.c +1 -1
-#define TYPE_I8259 "isa-i8259"
+#define TYPE_PIC "isa-i8259"

I disagree with this patch, as we have various PIC and only one I8259.

Like in the I8254 case, I agree with your point. I will suggest renaming the PIC macro to I8259 instead.

I'd suggest it should be TYPE_ISA_I8259 to match the object type name string.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#34 lore raw

PATCH 16/63 i8259: Rename TYPE_KVM_I8259 to TYPE_KVM_PIC

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 hw/i386/kvm/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/i386/kvm/i8259.c +5 -5
index 3f8bf69e9c..687c0cd536 100644
@@ -19,10 +19,10 @@
 #include "sysemu/kvm.h"
 #include "qom/object.h"
 
-#define TYPE_KVM_I8259 "kvm-i8259"
+#define TYPE_KVM_PIC "kvm-i8259"
 typedef struct KVMPICClass KVMPICClass;
 DECLARE_CLASS_CHECKERS(KVMPICClass, KVM_PIC,
-                       TYPE_KVM_I8259)
+                       TYPE_KVM_PIC)
 
 /**
  * KVMPICClass:
@@ -133,8 +133,8 @@ static void kvm_pic_realize(DeviceState *dev, Error **errp)
 
 qemu_irq *kvm_i8259_init(ISABus *bus)
 {
-    i8259_init_chip(TYPE_KVM_I8259, bus, true);
-    i8259_init_chip(TYPE_KVM_I8259, bus, false);
+    i8259_init_chip(TYPE_KVM_PIC, bus, true);
+    i8259_init_chip(TYPE_KVM_PIC, bus, false);
 
     return qemu_allocate_irqs(kvm_pic_set_irq, NULL, ISA_NUM_IRQS);
 }
@@ -152,7 +152,7 @@ static void kvm_i8259_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo kvm_i8259_info = {
-    .name = TYPE_KVM_I8259,
+    .name = TYPE_KVM_PIC,
     .parent = TYPE_PIC_COMMON,
     .instance_size = sizeof(PICCommonState),
     .class_init = kvm_i8259_class_init,
Signature · 1 line
2.26.2
#35 lore raw

Re: [PATCH 16/63] i8259: Rename TYPE_KVM_I8259 to TYPE_KVM_PIC

Quoted 20 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 hw/i386/kvm/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/i386/kvm/i8259.c +0 -0
index 3f8bf69e9c..687c0cd536 100644

hw/i386/kvm/i8259.c line 22

Quoted 5 lines
hw/i386/kvm/i8259.c +1 -1
@@ -19,10 +19,10 @@
 #include "sysemu/kvm.h"
 #include "qom/object.h"
 
-#define TYPE_KVM_I8259 "kvm-i8259"
+#define TYPE_KVM_PIC "kvm-i8259"

I disagree with this patch, as we have various KVM INTC and only one KVM_I8259.

TYPE_KVM_ARM_GIC and TYPE_KVM_S390_FLIC are kind of TYPE_KVM_INTC ...

Can we rename it KVM_I8259_PIC?

Quoted 28 lines
hw/i386/kvm/i8259.c +4 -4
 typedef struct KVMPICClass KVMPICClass;
 DECLARE_CLASS_CHECKERS(KVMPICClass, KVM_PIC,
-                       TYPE_KVM_I8259)
+                       TYPE_KVM_PIC)
 
 /**
  * KVMPICClass:
@@ -133,8 +133,8 @@ static void kvm_pic_realize(DeviceState *dev, Error **errp)
 
 qemu_irq *kvm_i8259_init(ISABus *bus)
 {
-    i8259_init_chip(TYPE_KVM_I8259, bus, true);
-    i8259_init_chip(TYPE_KVM_I8259, bus, false);
+    i8259_init_chip(TYPE_KVM_PIC, bus, true);
+    i8259_init_chip(TYPE_KVM_PIC, bus, false);
 
     return qemu_allocate_irqs(kvm_pic_set_irq, NULL, ISA_NUM_IRQS);
 }
@@ -152,7 +152,7 @@ static void kvm_i8259_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo kvm_i8259_info = {
-    .name = TYPE_KVM_I8259,
+    .name = TYPE_KVM_PIC,
     .parent = TYPE_PIC_COMMON,
     .instance_size = sizeof(PICCommonState),
     .class_init = kvm_i8259_class_init,
#36 lore raw

Re: [PATCH 16/63] i8259: Rename TYPE_KVM_I8259 to TYPE_KVM_PIC

Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 hw/i386/kvm/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/i386/kvm/i8259.c +0 -0
index 3f8bf69e9c..687c0cd536 100644

hw/i386/kvm/i8259.c line 22

Quoted 5 lines
hw/i386/kvm/i8259.c +1 -1
@@ -19,10 +19,10 @@
 #include "sysemu/kvm.h"
 #include "qom/object.h"
 
-#define TYPE_KVM_I8259 "kvm-i8259"
+#define TYPE_KVM_PIC "kvm-i8259"

I disagree with this patch, as we have various KVM INTC and only one KVM_I8259.

Quoted 3 lines

TYPE_KVM_ARM_GIC and TYPE_KVM_S390_FLIC are kind of TYPE_KVM_INTC ...

Can we rename it KVM_I8259_PIC?

I'm inclined to agree, but I'm not completely sure.

Why is it OK to have a macro named KVM_PIC, a struct named KVMPICClass, a struct named PICCommonState, but not OK to have a constant named TYPE_KVM_PIC? What about the TYPE_PIC_COMMON constant?

All these symbols are internal to the i8259 code and aren't expected to be unique globally. Are TYPE_* names more special and expected to be unique globally? If yes, why?

Signature · 1 line
Eduardo
#37 lore raw

PATCH 17/63 intel-hda: Rename TYPE_INTEL_HDA_GENERIC to TYPE_INTEL_HDA

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/audio/intel-hda.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/audio/intel-hda.c +5 -5
index 4330213fff..28c4edeece 100644
@@ -202,10 +202,10 @@ struct IntelHDAState {
     bool old_msi_addr;
 };
 
-#define TYPE_INTEL_HDA_GENERIC "intel-hda-generic"
+#define TYPE_INTEL_HDA "intel-hda-generic"
 
 DECLARE_INSTANCE_CHECKER(IntelHDAState, INTEL_HDA,
-                         TYPE_INTEL_HDA_GENERIC)
+                         TYPE_INTEL_HDA)
 
 struct IntelHDAReg {
     const char *name;      /* register name */
@@ -1257,7 +1257,7 @@ static void intel_hda_class_init_ich9(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo intel_hda_info = {
-    .name          = TYPE_INTEL_HDA_GENERIC,
+    .name          = TYPE_INTEL_HDA,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(IntelHDAState),
     .class_init    = intel_hda_class_init,
@@ -1270,13 +1270,13 @@ static const TypeInfo intel_hda_info = {
 
 static const TypeInfo intel_hda_info_ich6 = {
     .name          = "intel-hda",
-    .parent        = TYPE_INTEL_HDA_GENERIC,
+    .parent        = TYPE_INTEL_HDA,
     .class_init    = intel_hda_class_init_ich6,
 };
 
 static const TypeInfo intel_hda_info_ich9 = {
     .name          = "ich9-intel-hda",
-    .parent        = TYPE_INTEL_HDA_GENERIC,
+    .parent        = TYPE_INTEL_HDA,
     .class_init    = intel_hda_class_init_ich9,
 };
 
Signature · 1 line
2.26.2
#38 lore raw

PATCH 18/63 mips: Rename TYPE_MIPS_BOSTON to TYPE_BOSTON

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paul Burton <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected]

---
 hw/mips/boston.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/mips/boston.c +4 -4
index 1b3f69e949..17720a08c2 100644
@@ -43,10 +43,10 @@
 #include <libfdt.h>
 #include "qom/object.h"
 
-#define TYPE_MIPS_BOSTON "mips-boston"
+#define TYPE_BOSTON "mips-boston"
 typedef struct BostonState BostonState;
 DECLARE_INSTANCE_CHECKER(BostonState, BOSTON,
-                         TYPE_MIPS_BOSTON)
+                         TYPE_BOSTON)
 
 struct BostonState {
     SysBusDevice parent_obj;
@@ -252,7 +252,7 @@ static const MemoryRegionOps boston_platreg_ops = {
 };
 
 static const TypeInfo boston_device = {
-    .name          = TYPE_MIPS_BOSTON,
+    .name          = TYPE_BOSTON,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BostonState),
 };
@@ -444,7 +444,7 @@ static void boston_mach_init(MachineState *machine)
         exit(1);
     }
 
-    dev = qdev_new(TYPE_MIPS_BOSTON);
+    dev = qdev_new(TYPE_BOSTON);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
 
     s = BOSTON(dev);
Signature · 1 line
2.26.2
Reviewed-by Tested-by on v1 18/63
#39 lore raw

Re: [PATCH 18/63] mips: Rename TYPE_MIPS_BOSTON to TYPE_BOSTON

Quoted 11 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paul Burton <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected]

Quoted 3 lines
---
  hw/mips/boston.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

And queued to mips-next, thanks.

Phil.

#40 lore raw

PATCH 19/63 mptsas: Rename TYPE_MPTSAS1068 to TYPE_MPT_SAS

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/mptsas.h | 4 ++--
 hw/scsi/mptsas.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/scsi/mptsas.h +2 -2
index b85ac1a5fc..c618f686a3 100644
@@ -14,10 +14,10 @@
 
 typedef struct MPTSASRequest MPTSASRequest;
 
-#define TYPE_MPTSAS1068 "mptsas1068"
+#define TYPE_MPT_SAS "mptsas1068"
 typedef struct MPTSASState MPTSASState;
 DECLARE_INSTANCE_CHECKER(MPTSASState, MPT_SAS,
-                         TYPE_MPTSAS1068)
+                         TYPE_MPT_SAS)
 
 enum {
     DOORBELL_NONE,
hw/scsi/mptsas.c +1 -1
index 135e7d96e4..0dbb70c17b 100644
@@ -1434,7 +1434,7 @@ static void mptsas1068_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo mptsas_info = {
-    .name = TYPE_MPTSAS1068,
+    .name = TYPE_MPT_SAS,
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(MPTSASState),
     .class_init = mptsas1068_class_init,
Signature · 1 line
2.26.2
#41 lore raw

PATCH 20/63 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/isa/pc87312.h | 4 ++--
 hw/isa/pc87312.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +2 -2
index a65168a157..da8dc5ddf5 100644
@@ -29,10 +29,10 @@
 #include "qom/object.h"
 
 
-#define TYPE_PC87312_SUPERIO "pc87312"
+#define TYPE_PC87312 "pc87312"
 typedef struct PC87312State PC87312State;
 DECLARE_INSTANCE_CHECKER(PC87312State, PC87312,
-                         TYPE_PC87312_SUPERIO)
+                         TYPE_PC87312)
 
 struct PC87312State {
     /*< private >*/
hw/isa/pc87312.c +1 -1
index 0cacbbc91b..8d7b8d3db2 100644
@@ -371,7 +371,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pc87312_type_info = {
-    .name          = TYPE_PC87312_SUPERIO,
+    .name          = TYPE_PC87312,
     .parent        = TYPE_ISA_SUPERIO,
     .instance_size = sizeof(PC87312State),
     .instance_init = pc87312_initfn,
Signature · 1 line
2.26.2
Reviewed-by on v1 20/63
#42 lore raw

Re: [PATCH 20/63] pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

Le 03/09/2020 à 00:42, Eduardo Habkost a écrit :

Quoted 4 lines

This will make the type name constant consistent with the name of the type checking macro.

Quoted 8 lines

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  include/hw/isa/pc87312.h | 4 ++--
  hw/isa/pc87312.c         | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
#43 lore raw

Re: [PATCH 20/63] pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

In reply to Eduardo Habkost
Quoted 18 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/isa/pc87312.h | 4 ++--
 hw/isa/pc87312.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +0 -0
index a65168a157..da8dc5ddf5 100644

include/hw/isa/pc87312.h line 32

Quoted 5 lines
include/hw/isa/pc87312.h +1 -1
@@ -29,10 +29,10 @@
 #include "qom/object.h"
 
 
-#define TYPE_PC87312_SUPERIO "pc87312"
+#define TYPE_PC87312 "pc87312"

We loose self-documentation. What is a TYPE_PC87312 when reviewing a board setup code? Should we add a comment /* Create the Super I/O */? The current name is self-describing...

Is it easier to rename the type as 'pc87312-superio'?

   #define TYPE_PC87312_SUPERIO "pc87312-superio"
Quoted 21 lines
include/hw/isa/pc87312.h +1 -1
 typedef struct PC87312State PC87312State;
 DECLARE_INSTANCE_CHECKER(PC87312State, PC87312,
-                         TYPE_PC87312_SUPERIO)
+                         TYPE_PC87312)
 
 struct PC87312State {
     /*< private >*/
hw/isa/pc87312.c +1 -1
index 0cacbbc91b..8d7b8d3db2 100644
@@ -371,7 +371,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pc87312_type_info = {
-    .name          = TYPE_PC87312_SUPERIO,
+    .name          = TYPE_PC87312,
     .parent        = TYPE_ISA_SUPERIO,
     .instance_size = sizeof(PC87312State),
     .instance_init = pc87312_initfn,
#44 lore raw

Re: [PATCH 20/63] pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/isa/pc87312.h | 4 ++--
 hw/isa/pc87312.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +0 -0
index a65168a157..da8dc5ddf5 100644

include/hw/isa/pc87312.h line 32

Quoted 5 lines
include/hw/isa/pc87312.h +1 -1
@@ -29,10 +29,10 @@
 #include "qom/object.h"
 
 
-#define TYPE_PC87312_SUPERIO "pc87312"
+#define TYPE_PC87312 "pc87312"

We loose self-documentation. What is a TYPE_PC87312 when reviewing a board setup code? Should we add a comment /* Create the Super I/O */? The current name is self-describing...

Quoted 1 line

Is it easier to rename the type as 'pc87312-superio'?

This is an option. In that case, I would like to rename the PC87312 type checking macro to PC87312_SUPERIO, if that's OK.

The actual string name doesn't matter for the QOM macros, by the way. We can still rename it if you want to, but we don't have to.

Signature · 1 line
Eduardo
#45 lore raw

Re: [PATCH 20/63] pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/isa/pc87312.h | 4 ++--
 hw/isa/pc87312.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +0 -0
index a65168a157..da8dc5ddf5 100644
@@ -29,10 +29,10 @@
 #include "qom/object.h"
 
 
Quoted 7 lines
Quoted 7 lines

include/hw/isa/pc87312.h line 32

Quoted 2 lines
include/hw/isa/pc87312.h +1 -1
-#define TYPE_PC87312_SUPERIO "pc87312"
+#define TYPE_PC87312 "pc87312"

We loose self-documentation. What is a TYPE_PC87312 when reviewing a board setup code? Should we add a comment /* Create the Super I/O */? The current name is self-describing...

I've just realized that TYPE_PC87312_SUPERIO is not used anywhere in the code, so I don't understand where exactly this comment applies.

Quoted 9 lines
Quoted 2 lines

Is it easier to rename the type as 'pc87312-superio'?

This is an option. In that case, I would like to rename the PC87312 type checking macro to PC87312_SUPERIO, if that's OK.

The actual string name doesn't matter for the QOM macros, by the way. We can still rename it if you want to, but we don't have to.

Based on Daniel's suggestion of keeping the macro names consistent with the QOM type name string, I'd like to keep the original color of the bike shed and keep this patch as is.

I will queue this patch on machine-next with Hervé's Reviewed-by line.

If anybody wants to rename the user-visible QOM type name string later, that's OK. But I don't think this should be done as part of the QOM boilerplate cleanup work.

Signature · 1 line
Eduardo
#46 lore raw

Re: [PATCH 20/63] pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

Quoted 50 lines · Eduardo Habkost
Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/isa/pc87312.h | 4 ++--
 hw/isa/pc87312.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +0 -0
index a65168a157..da8dc5ddf5 100644
@@ -29,10 +29,10 @@
 #include "qom/object.h"
 
 
Quoted 7 lines
Quoted 7 lines

include/hw/isa/pc87312.h line 32

Quoted 2 lines
include/hw/isa/pc87312.h +1 -1
-#define TYPE_PC87312_SUPERIO "pc87312"
+#define TYPE_PC87312 "pc87312"

We loose self-documentation. What is a TYPE_PC87312 when reviewing a board setup code? Should we add a comment /* Create the Super I/O */? The current name is self-describing...

I've just realized that TYPE_PC87312_SUPERIO is not used anywhere in the code, so I don't understand where exactly this comment applies.

Quoted 9 lines
Quoted 2 lines

Is it easier to rename the type as 'pc87312-superio'?

This is an option. In that case, I would like to rename the PC87312 type checking macro to PC87312_SUPERIO, if that's OK.

The actual string name doesn't matter for the QOM macros, by the way. We can still rename it if you want to, but we don't have to.

Based on Daniel's suggestion of keeping the macro names consistent with the QOM type name string, I'd like to keep the original color of the bike shed and keep this patch as is.

Quoted 6 lines

I will queue this patch on machine-next with Hervé's Reviewed-by line.

If anybody wants to rename the user-visible QOM type name string later, that's OK. But I don't think this should be done as part of the QOM boilerplate cleanup work.

Understood, no problem.

#47 lore raw

PATCH 21/63 pxb: Rename TYPE_PXB_DEVICE to TYPE_PXB_DEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

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

---
 hw/pci-bridge/pci_expander_bridge.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/pci-bridge/pci_expander_bridge.c +3 -3
index aedded1064..42e58d5850 100644
@@ -41,10 +41,10 @@ struct PXBBus {
     char bus_path[8];
 };
 
-#define TYPE_PXB_DEVICE "pxb"
+#define TYPE_PXB_DEV "pxb"
 typedef struct PXBDev PXBDev;
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV,
-                         TYPE_PXB_DEVICE)
+                         TYPE_PXB_DEV)
 
 #define TYPE_PXB_PCIE_DEVICE "pxb-pcie"
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV,
@@ -322,7 +322,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pxb_dev_info = {
-    .name          = TYPE_PXB_DEVICE,
+    .name          = TYPE_PXB_DEV,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PXBDev),
     .class_init    = pxb_dev_class_init,
Signature · 1 line
2.26.2
#48 lore raw

PATCH 22/63 pxb: Rename TYPE_PXB_PCIE_DEVICE to TYPE_PXB_PCIE_DEV

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

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

---
 hw/pci-bridge/pci_expander_bridge.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/pci-bridge/pci_expander_bridge.c +3 -3
index 42e58d5850..1517ae5fa2 100644
@@ -46,9 +46,9 @@ typedef struct PXBDev PXBDev;
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV,
                          TYPE_PXB_DEV)
 
-#define TYPE_PXB_PCIE_DEVICE "pxb-pcie"
+#define TYPE_PXB_PCIE_DEV "pxb-pcie"
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV,
-                         TYPE_PXB_PCIE_DEVICE)
+                         TYPE_PXB_PCIE_DEV)
 
 struct PXBDev {
     /*< private >*/
@@ -360,7 +360,7 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pxb_pcie_dev_info = {
-    .name          = TYPE_PXB_PCIE_DEVICE,
+    .name          = TYPE_PXB_PCIE_DEV,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PXBDev),
     .class_init    = pxb_pcie_dev_class_init,
Signature · 1 line
2.26.2
#49 lore raw

PATCH 23/63 ramfb: Rename TYPE_RAMFB_DEVICE to TYPE_RAMFB

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Peter Maydell <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/display/ramfb.h    | 2 +-
 hw/arm/sysbus-fdt.c           | 2 +-
 hw/arm/virt.c                 | 2 +-
 hw/display/ramfb-standalone.c | 4 ++--
 hw/i386/pc_piix.c             | 2 +-
 hw/i386/pc_q35.c              | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)
include/hw/display/ramfb.h +1 -1
index b33a2c467b..c4b0150c88 100644
@@ -7,6 +7,6 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s);
 RAMFBState *ramfb_setup(Error **errp);
 
 /* ramfb-standalone.c */
-#define TYPE_RAMFB_DEVICE "ramfb"
+#define TYPE_RAMFB "ramfb"
 
 #endif /* RAMFB_H */
hw/arm/sysbus-fdt.c +1 -1
index 6b6906f4cf..e8baa118a6 100644
@@ -489,7 +489,7 @@ static const BindingEntry bindings[] = {
     VFIO_PLATFORM_BINDING("amd,xgbe-seattle-v1a", add_amd_xgbe_fdt_node),
 #endif
     TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node),
-    TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node),
+    TYPE_BINDING(TYPE_RAMFB, no_fdt_node),
     TYPE_BINDING("", NULL), /* last element */
 };
 
hw/arm/virt.c +1 -1
index acf9bfbece..bf81b5a373 100644
@@ -2414,7 +2414,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = 512;
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC);
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE);
-    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB);
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM);
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
     mc->block_default_type = IF_VIRTIO;
hw/display/ramfb-standalone.c +2 -2
index 8c0094397f..a86730393b 100644
@@ -9,7 +9,7 @@
 
 typedef struct RAMFBStandaloneState RAMFBStandaloneState;
 DECLARE_INSTANCE_CHECKER(RAMFBStandaloneState, RAMFB,
-                         TYPE_RAMFB_DEVICE)
+                         TYPE_RAMFB)
 
 struct RAMFBStandaloneState {
     SysBusDevice parent_obj;
@@ -51,7 +51,7 @@ static void ramfb_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ramfb_info = {
-    .name          = TYPE_RAMFB_DEVICE,
+    .name          = TYPE_RAMFB,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(RAMFBStandaloneState),
     .class_init    = ramfb_class_initfn,
hw/i386/pc_piix.c +1 -1
index 32b1453e6a..7ac4e65820 100644
@@ -422,7 +422,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
     m->desc = "Standard PC (i440FX + PIIX, 1996)";
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
-    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
 }
 
hw/i386/pc_q35.c +1 -1
index 0cb9c18cd4..dd2223b659 100644
@@ -348,7 +348,7 @@ static void pc_q35_machine_options(MachineClass *m)
     m->no_floppy = 1;
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
-    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
     m->max_cpus = 288;
 }
Signature · 1 line
2.26.2
#50 lore raw

PATCH 24/63 scsi: Rename TYPE_AM53C974_DEVICE to TYPE_PCI_ESP

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/esp-pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/scsi/esp-pci.c +4 -4
index 2ce96dc56e..2b1198380b 100644
@@ -35,11 +35,11 @@
 #include "qemu/module.h"
 #include "qom/object.h"
 
-#define TYPE_AM53C974_DEVICE "am53c974"
+#define TYPE_PCI_ESP "am53c974"
 
 typedef struct PCIESPState PCIESPState;
 DECLARE_INSTANCE_CHECKER(PCIESPState, PCI_ESP,
-                         TYPE_AM53C974_DEVICE)
+                         TYPE_PCI_ESP)
 
 #define DMA_CMD   0x0
 #define DMA_STC   0x1
@@ -400,7 +400,7 @@ static void esp_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo esp_pci_info = {
-    .name = TYPE_AM53C974_DEVICE,
+    .name = TYPE_PCI_ESP,
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIESPState),
     .class_init = esp_pci_class_init,
@@ -525,7 +525,7 @@ static void dc390_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo dc390_info = {
     .name = TYPE_DC390_DEVICE,
-    .parent = TYPE_AM53C974_DEVICE,
+    .parent = TYPE_PCI_ESP,
     .instance_size = sizeof(DC390State),
     .class_init = dc390_class_init,
 };
Signature · 1 line
2.26.2
#51 lore raw

Re: [PATCH 24/63] scsi: Rename TYPE_AM53C974_DEVICE to TYPE_PCI_ESP

Quoted 17 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/esp-pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/scsi/esp-pci.c +0 -0
index 2ce96dc56e..2b1198380b 100644

hw/scsi/esp-pci.c line 38

Quoted 5 lines
hw/scsi/esp-pci.c +1 -1
@@ -35,11 +35,11 @@
 #include "qemu/module.h"
 #include "qom/object.h"
 
-#define TYPE_AM53C974_DEVICE "am53c974"
+#define TYPE_PCI_ESP "am53c974"

We are loosing information helpful to reviewers :(

#52 lore raw

Re: [PATCH 24/63] scsi: Rename TYPE_AM53C974_DEVICE to TYPE_PCI_ESP

Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/esp-pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/scsi/esp-pci.c +0 -0
index 2ce96dc56e..2b1198380b 100644
@@ -35,11 +35,11 @@
 #include "qemu/module.h"
 #include "qom/object.h"
 
Quoted 4 lines

hw/scsi/esp-pci.c line 38

Quoted 2 lines
hw/scsi/esp-pci.c +1 -1
-#define TYPE_AM53C974_DEVICE "am53c974"
+#define TYPE_PCI_ESP "am53c974"

We are loosing information helpful to reviewers :(

Considering that the PCI_ESP macro is used in very few places, we can use TYPE_AM53C974 and amAM53C974(). I will do it instead.

Signature · 1 line
Eduardo
#53 lore raw

PATCH 25/63 scsi: Rename TYPE_DC390_DEVICE to TYPE_DC390

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/esp-pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/scsi/esp-pci.c +3 -3
index 2b1198380b..58398609be 100644
@@ -416,9 +416,9 @@ struct DC390State {
 };
 typedef struct DC390State DC390State;
 
-#define TYPE_DC390_DEVICE "dc390"
+#define TYPE_DC390 "dc390"
 DECLARE_INSTANCE_CHECKER(DC390State, DC390,
-                         TYPE_DC390_DEVICE)
+                         TYPE_DC390)
 
 #define EE_ADAPT_SCSI_ID 64
 #define EE_MODE2         65
@@ -524,7 +524,7 @@ static void dc390_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo dc390_info = {
-    .name = TYPE_DC390_DEVICE,
+    .name = TYPE_DC390,
     .parent = TYPE_PCI_ESP,
     .instance_size = sizeof(DC390State),
     .class_init = dc390_class_init,
Signature · 1 line
2.26.2
#54 lore raw

PATCH 26/63 sun4m: Rename TYPE_SUN4M_MEMORY to TYPE_SUN4M_RAM

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 hw/sparc/sun4m.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/sparc/sun4m.c +3 -3
index 5ed922d436..3410d8db6c 100644
@@ -779,10 +779,10 @@ static const TypeInfo prom_info = {
     .class_init    = prom_class_init,
 };
 
-#define TYPE_SUN4M_MEMORY "memory"
+#define TYPE_SUN4M_RAM "memory"
 typedef struct RamDevice RamDevice;
 DECLARE_INSTANCE_CHECKER(RamDevice, SUN4M_RAM,
-                         TYPE_SUN4M_MEMORY)
+                         TYPE_SUN4M_RAM)
 
 struct RamDevice {
     SysBusDevice parent_obj;
@@ -817,7 +817,7 @@ static void ram_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ram_info = {
-    .name          = TYPE_SUN4M_MEMORY,
+    .name          = TYPE_SUN4M_RAM,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(RamDevice),
     .instance_init = ram_initfn,
Signature · 1 line
2.26.2
#55 lore raw

PATCH 27/63 sun4u: Rename TYPE_SUN4U_MEMORY to TYPE_SUN4U_RAM

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 hw/sparc64/sun4u.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/sparc64/sun4u.c +4 -4
index 67985414e2..fe0d84bf6c 100644
@@ -493,10 +493,10 @@ static const TypeInfo prom_info = {
 };
 
 
-#define TYPE_SUN4U_MEMORY "memory"
+#define TYPE_SUN4U_RAM "memory"
 typedef struct RamDevice RamDevice;
 DECLARE_INSTANCE_CHECKER(RamDevice, SUN4U_RAM,
-                         TYPE_SUN4U_MEMORY)
+                         TYPE_SUN4U_RAM)
 
 struct RamDevice {
     SysBusDevice parent_obj;
@@ -524,7 +524,7 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size)
     RamDevice *d;
 
     /* allocate RAM */
-    dev = qdev_new(TYPE_SUN4U_MEMORY);
+    dev = qdev_new(TYPE_SUN4U_RAM);
     s = SYS_BUS_DEVICE(dev);
 
     d = SUN4U_RAM(dev);
@@ -548,7 +548,7 @@ static void ram_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ram_info = {
-    .name          = TYPE_SUN4U_MEMORY,
+    .name          = TYPE_SUN4U_RAM,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(RamDevice),
     .class_init    = ram_class_init,
Signature · 1 line
2.26.2
#56 lore raw

PATCH 28/63 tusb6010: Rename TYPE_TUSB6010 to TYPE_TUSB

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/tusb6010.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/usb/tusb6010.c +3 -3
index 2bee3ae59f..9b35c1d4b8 100644
@@ -30,10 +30,10 @@
 #include "hw/sysbus.h"
 #include "qom/object.h"
 
-#define TYPE_TUSB6010 "tusb6010"
+#define TYPE_TUSB "tusb6010"
 typedef struct TUSBState TUSBState;
 DECLARE_INSTANCE_CHECKER(TUSBState, TUSB,
-                         TYPE_TUSB6010)
+                         TYPE_TUSB)
 
 struct TUSBState {
     SysBusDevice parent_obj;
@@ -838,7 +838,7 @@ static void tusb6010_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo tusb6010_info = {
-    .name          = TYPE_TUSB6010,
+    .name          = TYPE_TUSB,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(TUSBState),
     .class_init    = tusb6010_class_init,
Signature · 1 line
2.26.2
#57 lore raw

Re: [PATCH 28/63] tusb6010: Rename TYPE_TUSB6010 to TYPE_TUSB

Quoted 16 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/tusb6010.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/usb/tusb6010.c +0 -0
index 2bee3ae59f..9b35c1d4b8 100644

hw/usb/tusb6010.c line 33

Quoted 5 lines
hw/usb/tusb6010.c +1 -1
@@ -30,10 +30,10 @@
 #include "hw/sysbus.h"
 #include "qom/object.h"
 
-#define TYPE_TUSB6010 "tusb6010"
+#define TYPE_TUSB "tusb6010"

We are loosing information helpful to reviewers.
Can we rename the type macro TUSB6010() instead?

Quoted 17 lines
hw/usb/tusb6010.c +2 -2
 typedef struct TUSBState TUSBState;
 DECLARE_INSTANCE_CHECKER(TUSBState, TUSB,
-                         TYPE_TUSB6010)
+                         TYPE_TUSB)
 
 struct TUSBState {
     SysBusDevice parent_obj;
@@ -838,7 +838,7 @@ static void tusb6010_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo tusb6010_info = {
-    .name          = TYPE_TUSB6010,
+    .name          = TYPE_TUSB,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(TUSBState),
     .class_init    = tusb6010_class_init,
#58 lore raw

Re: [PATCH 28/63] tusb6010: Rename TYPE_TUSB6010 to TYPE_TUSB

Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/tusb6010.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/usb/tusb6010.c +0 -0
index 2bee3ae59f..9b35c1d4b8 100644
@@ -30,10 +30,10 @@
 #include "hw/sysbus.h"
 #include "qom/object.h"
 
Quoted 5 lines

hw/usb/tusb6010.c line 33

Quoted 2 lines
hw/usb/tusb6010.c +1 -1
-#define TYPE_TUSB6010 "tusb6010"
+#define TYPE_TUSB "tusb6010"

We are loosing information helpful to reviewers.
Can we rename the type macro TUSB6010() instead?

We can. I will do it instead.

Signature · 1 line
Eduardo
#59 lore raw

PATCH 29/63 versatile: Rename TYPE_VERSATILE_PCI_HOST to TYPE_PCI_VPB_HOST

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

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

---
 hw/pci-host/versatile.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/pci-host/versatile.c +4 -4
index 3553277f94..7b6a754b8b 100644
@@ -161,9 +161,9 @@ static const VMStateDescription pci_vpb_vmstate = {
 DECLARE_INSTANCE_CHECKER(PCIVPBState, PCI_VPB,
                          TYPE_VERSATILE_PCI)
 
-#define TYPE_VERSATILE_PCI_HOST "versatile_pci_host"
+#define TYPE_PCI_VPB_HOST "versatile_pci_host"
 DECLARE_INSTANCE_CHECKER(PCIDevice, PCI_VPB_HOST,
-                         TYPE_VERSATILE_PCI_HOST)
+                         TYPE_PCI_VPB_HOST)
 
 typedef enum {
     PCI_IMAP0 = 0x0,
@@ -410,7 +410,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)
                              PCI_DEVFN(11, 0), TYPE_PCI_BUS);
     h->bus = &s->pci_bus;
 
-    object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_HOST);
+    object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_PCI_VPB_HOST);
 
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(sbd, &s->irq[i]);
@@ -487,7 +487,7 @@ static void versatile_pci_host_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo versatile_pci_host_info = {
-    .name          = TYPE_VERSATILE_PCI_HOST,
+    .name          = TYPE_PCI_VPB_HOST,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = versatile_pci_host_class_init,
Signature · 1 line
2.26.2
#60 lore raw

PATCH 30/63 versatile: Rename TYPE_VERSATILE_PCI to TYPE_PCI_VPB

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

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

---
 hw/pci-host/versatile.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/pci-host/versatile.c +4 -4
index 7b6a754b8b..9da352c070 100644
@@ -157,9 +157,9 @@ static const VMStateDescription pci_vpb_vmstate = {
     }
 };
 
-#define TYPE_VERSATILE_PCI "versatile_pci"
+#define TYPE_PCI_VPB "versatile_pci"
 DECLARE_INSTANCE_CHECKER(PCIVPBState, PCI_VPB,
-                         TYPE_VERSATILE_PCI)
+                         TYPE_PCI_VPB)
 
 #define TYPE_PCI_VPB_HOST "versatile_pci_host"
 DECLARE_INSTANCE_CHECKER(PCIDevice, PCI_VPB_HOST,
@@ -514,7 +514,7 @@ static void pci_vpb_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pci_vpb_info = {
-    .name          = TYPE_VERSATILE_PCI,
+    .name          = TYPE_PCI_VPB,
     .parent        = TYPE_PCI_HOST_BRIDGE,
     .instance_size = sizeof(PCIVPBState),
     .instance_init = pci_vpb_init,
@@ -534,7 +534,7 @@ static void pci_realview_init(Object *obj)
 
 static const TypeInfo pci_realview_info = {
     .name          = "realview_pci",
-    .parent        = TYPE_VERSATILE_PCI,
+    .parent        = TYPE_PCI_VPB,
     .instance_init = pci_realview_init,
 };
 
Signature · 1 line
2.26.2
#61 lore raw

PATCH 31/63 virtio-console: Rename TYPE_VIRTIO_CONSOLE_SERIAL_PORT to TYPE_VIRTIO_CONSOLE

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Laurent Vivier <[email protected]>
Cc: Amit Shah <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 hw/char/virtio-console.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/char/virtio-console.c +4 -4
index bc752cf90f..cf4c0a0a95 100644
@@ -21,10 +21,10 @@
 #include "qapi/qapi-events-char.h"
 #include "qom/object.h"
 
-#define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"
+#define TYPE_VIRTIO_CONSOLE "virtserialport"
 typedef struct VirtConsole VirtConsole;
 DECLARE_INSTANCE_CHECKER(VirtConsole, VIRTIO_CONSOLE,
-                         TYPE_VIRTIO_CONSOLE_SERIAL_PORT)
+                         TYPE_VIRTIO_CONSOLE)
 
 struct VirtConsole {
     VirtIOSerialPort parent_obj;
@@ -269,7 +269,7 @@ static void virtconsole_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo virtconsole_info = {
     .name          = "virtconsole",
-    .parent        = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
+    .parent        = TYPE_VIRTIO_CONSOLE,
     .class_init    = virtconsole_class_init,
 };
 
@@ -293,7 +293,7 @@ static void virtserialport_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo virtserialport_info = {
-    .name          = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
+    .name          = TYPE_VIRTIO_CONSOLE,
     .parent        = TYPE_VIRTIO_SERIAL_PORT,
     .instance_size = sizeof(VirtConsole),
     .class_init    = virtserialport_class_init,
Signature · 1 line
2.26.2
#62 lore raw

PATCH 32/63 ahci: Rename ICH_AHCI to ICH9_AHCI

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: John Snow <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/ide/ahci.h | 2 +-
 hw/ide/ahci.c         | 4 ++--
 hw/ide/ich.c          | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
include/hw/ide/ahci.h +1 -1
index 4cf6813d80..da3cddcc65 100644
@@ -54,7 +54,7 @@ typedef struct AHCIState {
 typedef struct AHCIPCIState AHCIPCIState;
 
 #define TYPE_ICH9_AHCI "ich9-ahci"
-DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH_AHCI,
+DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH9_AHCI,
                          TYPE_ICH9_AHCI)
 
 int32_t ahci_get_num_ports(PCIDevice *dev);
hw/ide/ahci.c +2 -2
index b696c6291a..ee1d47ff75 100644
@@ -1819,7 +1819,7 @@ type_init(sysbus_ahci_register_types)
 
 int32_t ahci_get_num_ports(PCIDevice *dev)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
     AHCIState *ahci = &d->ahci;
 
     return ahci->ports;
@@ -1827,7 +1827,7 @@ int32_t ahci_get_num_ports(PCIDevice *dev)
 
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
     AHCIState *ahci = &d->ahci;
     int i;
 
hw/ide/ich.c +4 -4
index eff3188fff..51cd2f38b7 100644
@@ -91,14 +91,14 @@ static const VMStateDescription vmstate_ich9_ahci = {
 
 static void pci_ich9_reset(DeviceState *dev)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
 
     ahci_reset(&d->ahci);
 }
 
 static void pci_ich9_ahci_init(Object *obj)
 {
-    struct AHCIPCIState *d = ICH_AHCI(obj);
+    struct AHCIPCIState *d = ICH9_AHCI(obj);
 
     ahci_init(&d->ahci, DEVICE(obj));
 }
@@ -108,7 +108,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
     struct AHCIPCIState *d;
     int sata_cap_offset;
     uint8_t *sata_cap;
-    d = ICH_AHCI(dev);
+    d = ICH9_AHCI(dev);
     int ret;
 
     ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
@@ -154,7 +154,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
 static void pci_ich9_uninit(PCIDevice *dev)
 {
     struct AHCIPCIState *d;
-    d = ICH_AHCI(dev);
+    d = ICH9_AHCI(dev);
 
     msi_uninit(dev);
     ahci_uninit(&d->ahci);
Signature · 1 line
2.26.2
Reviewed-by on v1 32/63
#63 lore raw

Re: [PATCH 32/63] ahci: Rename ICH_AHCI to ICH9_AHCI

Quoted 4 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Quoted 85 lines

---
Cc: John Snow <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/ide/ahci.h | 2 +-
 hw/ide/ahci.c         | 4 ++--
 hw/ide/ich.c          | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
include/hw/ide/ahci.h +1 -1
index 4cf6813d80..da3cddcc65 100644
@@ -54,7 +54,7 @@ typedef struct AHCIState {
 typedef struct AHCIPCIState AHCIPCIState;
 
 #define TYPE_ICH9_AHCI "ich9-ahci"
-DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH_AHCI,
+DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH9_AHCI,
                          TYPE_ICH9_AHCI)
 
 int32_t ahci_get_num_ports(PCIDevice *dev);
hw/ide/ahci.c +2 -2
index b696c6291a..ee1d47ff75 100644
@@ -1819,7 +1819,7 @@ type_init(sysbus_ahci_register_types)
 
 int32_t ahci_get_num_ports(PCIDevice *dev)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
     AHCIState *ahci = &d->ahci;
 
     return ahci->ports;
@@ -1827,7 +1827,7 @@ int32_t ahci_get_num_ports(PCIDevice *dev)
 
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
     AHCIState *ahci = &d->ahci;
     int i;
 
hw/ide/ich.c +4 -4
index eff3188fff..51cd2f38b7 100644
@@ -91,14 +91,14 @@ static const VMStateDescription vmstate_ich9_ahci = {
 
 static void pci_ich9_reset(DeviceState *dev)
 {
-    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIPCIState *d = ICH9_AHCI(dev);
 
     ahci_reset(&d->ahci);
 }
 
 static void pci_ich9_ahci_init(Object *obj)
 {
-    struct AHCIPCIState *d = ICH_AHCI(obj);
+    struct AHCIPCIState *d = ICH9_AHCI(obj);
 
     ahci_init(&d->ahci, DEVICE(obj));
 }
@@ -108,7 +108,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
     struct AHCIPCIState *d;
     int sata_cap_offset;
     uint8_t *sata_cap;
-    d = ICH_AHCI(dev);
+    d = ICH9_AHCI(dev);
     int ret;
 
     ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
@@ -154,7 +154,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
 static void pci_ich9_uninit(PCIDevice *dev)
 {
     struct AHCIPCIState *d;
-    d = ICH_AHCI(dev);
+    d = ICH9_AHCI(dev);
 
     msi_uninit(dev);
     ahci_uninit(&d->ahci);
#64 lore raw

PATCH 33/63 net/can: Rename TYPE_CAN_CPI constants

In reply to Eduardo Habkost

Rename macros to names that are unique in the source tree, to reduce confusion and make automated conversion of the code easier.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_kvaser_pci.c   | 6 +++---
 hw/net/can/can_mioe3680_pci.c | 6 +++---
 hw/net/can/can_pcm3680_pci.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
hw/net/can/can_kvaser_pci.c +3 -3
index 168b3a620d..12d4f8df33 100644
@@ -45,11 +45,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "kvaser_pci"
+#define TYPE_KVASER_PCI "kvaser_pci"
 
 typedef struct KvaserPCIState KvaserPCIState;
 DECLARE_INSTANCE_CHECKER(KvaserPCIState, KVASER_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_KVASER_PCI)
 
 #ifndef KVASER_PCI_VENDOR_ID1
 #define KVASER_PCI_VENDOR_ID1     0x10e8    /* the PCI device and vendor IDs */
@@ -305,7 +305,7 @@ static void kvaser_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo kvaser_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_KVASER_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(KvaserPCIState),
     .class_init    = kvaser_pci_class_init,
hw/net/can/can_mioe3680_pci.c +3 -3
index 7a79e2605a..b20e5451bf 100644
@@ -41,11 +41,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "mioe3680_pci"
+#define TYPE_MIOE3680_PCI "mioe3680_pci"
 
 typedef struct Mioe3680PCIState Mioe3680PCIState;
 DECLARE_INSTANCE_CHECKER(Mioe3680PCIState, MIOe3680_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_MIOE3680_PCI)
 
 /* the PCI device and vendor IDs */
 #ifndef MIOe3680_PCI_VENDOR_ID1
@@ -248,7 +248,7 @@ static void mioe3680_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo mioe3680_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_MIOE3680_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(Mioe3680PCIState),
     .class_init    = mioe3680_pci_class_init,
hw/net/can/can_pcm3680_pci.c +3 -3
index 8ef4e74af0..530cd04a5d 100644
@@ -41,11 +41,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "pcm3680_pci"
+#define TYPE_PCM3680_PCI "pcm3680_pci"
 
 typedef struct Pcm3680iPCIState Pcm3680iPCIState;
 DECLARE_INSTANCE_CHECKER(Pcm3680iPCIState, PCM3680i_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_PCM3680_PCI)
 
 /* the PCI device and vendor IDs */
 #ifndef PCM3680i_PCI_VENDOR_ID1
@@ -249,7 +249,7 @@ static void pcm3680i_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pcm3680i_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_PCM3680_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(Pcm3680iPCIState),
     .class_init    = pcm3680i_pci_class_init,
Signature · 1 line
2.26.2
#65 lore raw

Re: [PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants

Quoted 19 lines · Eduardo Habkost

Rename macros to names that are unique in the source tree, to reduce confusion and make automated conversion of the code easier.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_kvaser_pci.c   | 6 +++---
 hw/net/can/can_mioe3680_pci.c | 6 +++---
 hw/net/can/can_pcm3680_pci.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
hw/net/can/can_kvaser_pci.c +0 -0
index 168b3a620d..12d4f8df33 100644

hw/net/can/can_kvaser_pci.c line 48

Quoted 5 lines
hw/net/can/can_kvaser_pci.c +1 -1
@@ -45,11 +45,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "kvaser_pci"
+#define TYPE_KVASER_PCI "kvaser_pci"

Why keep "PCI" and not keep the "CAN" part? To be consistent we should use both busses or none.

[...]

#66 lore raw

Re: [PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants

Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Eduardo Habkost

Rename macros to names that are unique in the source tree, to reduce confusion and make automated conversion of the code easier.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_kvaser_pci.c   | 6 +++---
 hw/net/can/can_mioe3680_pci.c | 6 +++---
 hw/net/can/can_pcm3680_pci.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
hw/net/can/can_kvaser_pci.c +0 -0
index 168b3a620d..12d4f8df33 100644
@@ -45,11 +45,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
Quoted 5 lines

hw/net/can/can_kvaser_pci.c line 48

Quoted 2 lines
hw/net/can/can_kvaser_pci.c +1 -1
-#define TYPE_CAN_PCI_DEV "kvaser_pci"
+#define TYPE_KVASER_PCI "kvaser_pci"

Why keep "PCI" and not keep the "CAN" part? To be consistent we should use both busses or none.

Because the type name is "kvaser_pci", the device state struct is called KVaserPCIState, the type checking macro is called KVASER_PCI_DEV, and most functions inside that file are called kvaser_pci_*().

Signature · 1 line
Eduardo
#67 lore raw

PATCH 34/63 can: Rename KVASER_PCI_DEV to KVASER_PCI

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_kvaser_pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/net/can/can_kvaser_pci.c +5 -5
index 12d4f8df33..2143ed83f3 100644
@@ -48,7 +48,7 @@
 #define TYPE_KVASER_PCI "kvaser_pci"
 
 typedef struct KvaserPCIState KvaserPCIState;
-DECLARE_INSTANCE_CHECKER(KvaserPCIState, KVASER_PCI_DEV,
+DECLARE_INSTANCE_CHECKER(KvaserPCIState, KVASER_PCI,
                          TYPE_KVASER_PCI)
 
 #ifndef KVASER_PCI_VENDOR_ID1
@@ -109,7 +109,7 @@ static void kvaser_pci_irq_handler(void *opaque, int irq_num, int level)
 
 static void kvaser_pci_reset(DeviceState *dev)
 {
-    KvaserPCIState *d = KVASER_PCI_DEV(dev);
+    KvaserPCIState *d = KVASER_PCI(dev);
     CanSJA1000State *s = &d->sja_state;
 
     can_sja_hardware_reset(s);
@@ -221,7 +221,7 @@ static const MemoryRegionOps kvaser_pci_xilinx_io_ops = {
 
 static void kvaser_pci_realize(PCIDevice *pci_dev, Error **errp)
 {
-    KvaserPCIState *d = KVASER_PCI_DEV(pci_dev);
+    KvaserPCIState *d = KVASER_PCI(pci_dev);
     CanSJA1000State *s = &d->sja_state;
     uint8_t *pci_conf;
 
@@ -254,7 +254,7 @@ static void kvaser_pci_realize(PCIDevice *pci_dev, Error **errp)
 
 static void kvaser_pci_exit(PCIDevice *pci_dev)
 {
-    KvaserPCIState *d = KVASER_PCI_DEV(pci_dev);
+    KvaserPCIState *d = KVASER_PCI(pci_dev);
     CanSJA1000State *s = &d->sja_state;
 
     can_sja_disconnect(s);
@@ -279,7 +279,7 @@ static const VMStateDescription vmstate_kvaser_pci = {
 
 static void kvaser_pci_instance_init(Object *obj)
 {
-    KvaserPCIState *d = KVASER_PCI_DEV(obj);
+    KvaserPCIState *d = KVASER_PCI(obj);
 
     object_property_add_link(obj, "canbus", TYPE_CAN_BUS,
                              (Object **)&d->canbus,
Signature · 1 line
2.26.2
#68 lore raw

PATCH 35/63 can: Rename MIOe3680_PCI_DEV to MIOE3680_PCI

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_mioe3680_pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/net/can/can_mioe3680_pci.c +5 -5
index b20e5451bf..9aaa9503c4 100644
@@ -44,7 +44,7 @@
 #define TYPE_MIOE3680_PCI "mioe3680_pci"
 
 typedef struct Mioe3680PCIState Mioe3680PCIState;
-DECLARE_INSTANCE_CHECKER(Mioe3680PCIState, MIOe3680_PCI_DEV,
+DECLARE_INSTANCE_CHECKER(Mioe3680PCIState, MIOE3680_PCI,
                          TYPE_MIOE3680_PCI)
 
 /* the PCI device and vendor IDs */
@@ -76,7 +76,7 @@ struct Mioe3680PCIState {
 
 static void mioe3680_pci_reset(DeviceState *dev)
 {
-    Mioe3680PCIState *d = MIOe3680_PCI_DEV(dev);
+    Mioe3680PCIState *d = MIOE3680_PCI(dev);
     int i;
 
     for (i = 0 ; i < MIOe3680_PCI_SJA_COUNT; i++) {
@@ -156,7 +156,7 @@ static const MemoryRegionOps mioe3680_pci_sja2_io_ops = {
 
 static void mioe3680_pci_realize(PCIDevice *pci_dev, Error **errp)
 {
-    Mioe3680PCIState *d = MIOe3680_PCI_DEV(pci_dev);
+    Mioe3680PCIState *d = MIOE3680_PCI(pci_dev);
     uint8_t *pci_conf;
     int i;
 
@@ -189,7 +189,7 @@ static void mioe3680_pci_realize(PCIDevice *pci_dev, Error **errp)
 
 static void mioe3680_pci_exit(PCIDevice *pci_dev)
 {
-    Mioe3680PCIState *d = MIOe3680_PCI_DEV(pci_dev);
+    Mioe3680PCIState *d = MIOE3680_PCI(pci_dev);
     int i;
 
     for (i = 0 ; i < MIOe3680_PCI_SJA_COUNT; i++) {
@@ -216,7 +216,7 @@ static const VMStateDescription vmstate_mioe3680_pci = {
 
 static void mioe3680_pci_instance_init(Object *obj)
 {
-    Mioe3680PCIState *d = MIOe3680_PCI_DEV(obj);
+    Mioe3680PCIState *d = MIOE3680_PCI(obj);
 
     object_property_add_link(obj, "canbus0", TYPE_CAN_BUS,
                              (Object **)&d->canbus[0],
Signature · 1 line
2.26.2
#69 lore raw

PATCH 36/63 can: Rename PCM3680i_PCI_DEV to PCM3680_PCI

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/can/can_pcm3680_pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/net/can/can_pcm3680_pci.c +5 -5
index 530cd04a5d..cb9db3c322 100644
@@ -44,7 +44,7 @@
 #define TYPE_PCM3680_PCI "pcm3680_pci"
 
 typedef struct Pcm3680iPCIState Pcm3680iPCIState;
-DECLARE_INSTANCE_CHECKER(Pcm3680iPCIState, PCM3680i_PCI_DEV,
+DECLARE_INSTANCE_CHECKER(Pcm3680iPCIState, PCM3680_PCI,
                          TYPE_PCM3680_PCI)
 
 /* the PCI device and vendor IDs */
@@ -76,7 +76,7 @@ struct Pcm3680iPCIState {
 
 static void pcm3680i_pci_reset(DeviceState *dev)
 {
-    Pcm3680iPCIState *d = PCM3680i_PCI_DEV(dev);
+    Pcm3680iPCIState *d = PCM3680_PCI(dev);
     int i;
 
     for (i = 0; i < PCM3680i_PCI_SJA_COUNT; i++) {
@@ -156,7 +156,7 @@ static const MemoryRegionOps pcm3680i_pci_sja2_io_ops = {
 
 static void pcm3680i_pci_realize(PCIDevice *pci_dev, Error **errp)
 {
-    Pcm3680iPCIState *d = PCM3680i_PCI_DEV(pci_dev);
+    Pcm3680iPCIState *d = PCM3680_PCI(pci_dev);
     uint8_t *pci_conf;
     int i;
 
@@ -190,7 +190,7 @@ static void pcm3680i_pci_realize(PCIDevice *pci_dev, Error **errp)
 
 static void pcm3680i_pci_exit(PCIDevice *pci_dev)
 {
-    Pcm3680iPCIState *d = PCM3680i_PCI_DEV(pci_dev);
+    Pcm3680iPCIState *d = PCM3680_PCI(pci_dev);
     int i;
 
     for (i = 0; i < PCM3680i_PCI_SJA_COUNT; i++) {
@@ -217,7 +217,7 @@ static const VMStateDescription vmstate_pcm3680i_pci = {
 
 static void pcm3680i_pci_instance_init(Object *obj)
 {
-    Pcm3680iPCIState *d = PCM3680i_PCI_DEV(obj);
+    Pcm3680iPCIState *d = PCM3680_PCI(obj);
 
     object_property_add_link(obj, "canbus0", TYPE_CAN_BUS,
                              (Object **)&d->canbus[0],
Signature · 1 line
2.26.2
#70 lore raw

PATCH 37/63 ccid-card-emulated: Rename EMULATED_CCID_CARD to EMULATED_CCID

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/ccid-card-emulated.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/usb/ccid-card-emulated.c +5 -5
index 5e4649d367..9803dac5b7 100644
@@ -47,7 +47,7 @@ do {\
 
 #define TYPE_EMULATED_CCID "ccid-card-emulated"
 typedef struct EmulatedState EmulatedState;
-DECLARE_INSTANCE_CHECKER(EmulatedState, EMULATED_CCID_CARD,
+DECLARE_INSTANCE_CHECKER(EmulatedState, EMULATED_CCID,
                          TYPE_EMULATED_CCID)
 
 #define BACKEND_NSS_EMULATED_NAME "nss-emulated"
@@ -138,7 +138,7 @@ struct EmulatedState {
 static void emulated_apdu_from_guest(CCIDCardState *base,
     const uint8_t *apdu, uint32_t len)
 {
-    EmulatedState *card = EMULATED_CCID_CARD(base);
+    EmulatedState *card = EMULATED_CCID(base);
     EmulEvent *event = (EmulEvent *)g_malloc(sizeof(EmulEvent) + len);
 
     assert(event);
@@ -155,7 +155,7 @@ static void emulated_apdu_from_guest(CCIDCardState *base,
 
 static const uint8_t *emulated_get_atr(CCIDCardState *base, uint32_t *len)
 {
-    EmulatedState *card = EMULATED_CCID_CARD(base);
+    EmulatedState *card = EMULATED_CCID(base);
 
     *len = card->atr_length;
     return card->atr;
@@ -488,7 +488,7 @@ static uint32_t parse_enumeration(char *str,
 
 static void emulated_realize(CCIDCardState *base, Error **errp)
 {
-    EmulatedState *card = EMULATED_CCID_CARD(base);
+    EmulatedState *card = EMULATED_CCID(base);
     VCardEmulError ret;
     const EnumTable *ptable;
 
@@ -564,7 +564,7 @@ out1:
 
 static void emulated_unrealize(CCIDCardState *base)
 {
-    EmulatedState *card = EMULATED_CCID_CARD(base);
+    EmulatedState *card = EMULATED_CCID(base);
     VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL);
 
     vevent_queue_vevent(vevent); /* stop vevent thread */
Signature · 1 line
2.26.2
#71 lore raw

PATCH 38/63 ccid-card-passthru: Rename PASSTHRU_CCID_CARD to CCID_PASSTHRU

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/ccid-card-passthru.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/usb/ccid-card-passthru.c +4 -4
index e8e9d37e88..d9f569e201 100644
@@ -65,7 +65,7 @@ struct PassthruState {
 };
 
 #define TYPE_CCID_PASSTHRU "ccid-card-passthru"
-DECLARE_INSTANCE_CHECKER(PassthruState, PASSTHRU_CCID_CARD,
+DECLARE_INSTANCE_CHECKER(PassthruState, CCID_PASSTHRU,
                          TYPE_CCID_PASSTHRU)
 
 /*
@@ -332,7 +332,7 @@ static void ccid_card_vscard_event(void *opaque, QEMUChrEvent event)
 static void passthru_apdu_from_guest(
     CCIDCardState *base, const uint8_t *apdu, uint32_t len)
 {
-    PassthruState *card = PASSTHRU_CCID_CARD(base);
+    PassthruState *card = CCID_PASSTHRU(base);
 
     if (!qemu_chr_fe_backend_connected(&card->cs)) {
         printf("ccid-passthru: no chardev, discarding apdu length %d\n", len);
@@ -343,7 +343,7 @@ static void passthru_apdu_from_guest(
 
 static const uint8_t *passthru_get_atr(CCIDCardState *base, uint32_t *len)
 {
-    PassthruState *card = PASSTHRU_CCID_CARD(base);
+    PassthruState *card = CCID_PASSTHRU(base);
 
     *len = card->atr_length;
     return card->atr;
@@ -351,7 +351,7 @@ static const uint8_t *passthru_get_atr(CCIDCardState *base, uint32_t *len)
 
 static void passthru_realize(CCIDCardState *base, Error **errp)
 {
-    PassthruState *card = PASSTHRU_CCID_CARD(base);
+    PassthruState *card = CCID_PASSTHRU(base);
 
     card->vscard_in_pos = 0;
     card->vscard_in_hdr = 0;
Signature · 1 line
2.26.2
#72 lore raw

PATCH 39/63 esp: Rename ESP_STATE to ESP

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 include/hw/scsi/esp.h | 2 +-
 hw/dma/sparc32_dma.c  | 2 +-
 hw/m68k/q800.c        | 2 +-
 hw/mips/jazz.c        | 2 +-
 hw/scsi/esp.c         | 6 +++---
 hw/sparc/sun4m.c      | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
include/hw/scsi/esp.h +1 -1
index f281625dd5..20800dbf5b 100644
@@ -67,7 +67,7 @@ struct ESPState {
 
 #define TYPE_ESP "esp"
 typedef struct SysBusESPState SysBusESPState;
-DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP_STATE,
+DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP,
                          TYPE_ESP)
 
 struct SysBusESPState {
hw/dma/sparc32_dma.c +1 -1
index bcd1626fbd..d20a5bc065 100644
@@ -303,7 +303,7 @@ static void sparc32_espdma_device_realize(DeviceState *dev, Error **errp)
 
     d = qdev_new(TYPE_ESP);
     object_property_add_child(OBJECT(dev), "esp", OBJECT(d));
-    sysbus = ESP_STATE(d);
+    sysbus = ESP(d);
     esp = &sysbus->esp;
     esp->dma_memory_read = espdma_memory_read;
     esp->dma_memory_write = espdma_memory_write;
hw/m68k/q800.c +1 -1
index 1ca482ad81..ce4b47c3e3 100644
@@ -290,7 +290,7 @@ static void q800_init(MachineState *machine)
     /* SCSI */
 
     dev = qdev_new(TYPE_ESP);
-    sysbus_esp = ESP_STATE(dev);
+    sysbus_esp = ESP(dev);
     esp = &sysbus_esp->esp;
     esp->dma_memory_read = NULL;
     esp->dma_memory_write = NULL;
hw/mips/jazz.c +1 -1
index 82a6e3220e..47723093b6 100644
@@ -309,7 +309,7 @@ static void mips_jazz_init(MachineState *machine,
 
     /* SCSI adapter */
     dev = qdev_new(TYPE_ESP);
-    sysbus_esp = ESP_STATE(dev);
+    sysbus_esp = ESP(dev);
     esp = &sysbus_esp->esp;
     esp->dma_memory_read = rc4030_dma_read;
     esp->dma_memory_write = rc4030_dma_write;
hw/scsi/esp.c +3 -3
index 405f8b7cbc..b84e0fe33e 100644
@@ -929,7 +929,7 @@ static const struct SCSIBusInfo esp_scsi_info = {
 
 static void sysbus_esp_gpio_demux(void *opaque, int irq, int level)
 {
-    SysBusESPState *sysbus = ESP_STATE(opaque);
+    SysBusESPState *sysbus = ESP(opaque);
     ESPState *s = &sysbus->esp;
 
     switch (irq) {
@@ -945,7 +945,7 @@ static void sysbus_esp_gpio_demux(void *opaque, int irq, int level)
 static void sysbus_esp_realize(DeviceState *dev, Error **errp)
 {
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
-    SysBusESPState *sysbus = ESP_STATE(dev);
+    SysBusESPState *sysbus = ESP(dev);
     ESPState *s = &sysbus->esp;
 
     sysbus_init_irq(sbd, &s->irq);
@@ -967,7 +967,7 @@ static void sysbus_esp_realize(DeviceState *dev, Error **errp)
 
 static void sysbus_esp_hard_reset(DeviceState *dev)
 {
-    SysBusESPState *sysbus = ESP_STATE(dev);
+    SysBusESPState *sysbus = ESP(dev);
     esp_hard_reset(&sysbus->esp);
 }
 
hw/sparc/sun4m.c +1 -1
index 3410d8db6c..3ee7ef4590 100644
@@ -345,7 +345,7 @@ static void *sparc32_dma_init(hwaddr dma_base,
                                    OBJECT(dma), "espdma"));
     sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);
 
-    esp = ESP_STATE(object_resolve_path_component(OBJECT(espdma), "esp"));
+    esp = ESP(object_resolve_path_component(OBJECT(espdma), "esp"));
     sysbus_mmio_map(SYS_BUS_DEVICE(esp), 0, esp_base);
     scsi_bus_legacy_handle_cmdline(&esp->esp.bus);
 
Signature · 1 line
2.26.2
Reviewed-by on v1 39/63
#73 lore raw

Re: [PATCH 39/63] esp: Rename ESP_STATE to ESP

Le 03/09/2020 à 00:42, Eduardo Habkost a écrit :

Quoted 16 lines

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

Quoted 8 lines
---
  include/hw/scsi/esp.h | 2 +-
  hw/dma/sparc32_dma.c  | 2 +-
  hw/m68k/q800.c        | 2 +-
  hw/mips/jazz.c        | 2 +-
  hw/scsi/esp.c         | 6 +++---
  hw/sparc/sun4m.c      | 2 +-
  6 files changed, 8 insertions(+), 8 deletions(-)
#74 lore raw

Re: [PATCH 39/63] esp: Rename ESP_STATE to ESP

In reply to Eduardo Habkost
Quoted 30 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 include/hw/scsi/esp.h | 2 +-
 hw/dma/sparc32_dma.c  | 2 +-
 hw/m68k/q800.c        | 2 +-
 hw/mips/jazz.c        | 2 +-
 hw/scsi/esp.c         | 6 +++---
 hw/sparc/sun4m.c      | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
include/hw/scsi/esp.h +0 -0
index f281625dd5..20800dbf5b 100644

include/hw/scsi/esp.h struct ESPState { · line 71

Quoted 6 lines
include/hw/scsi/esp.h +1 -1
@@ -67,7 +67,7 @@ struct ESPState {
 
 #define TYPE_ESP "esp"
 typedef struct SysBusESPState SysBusESPState;
-DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP_STATE,
+DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP,
                          TYPE_ESP)

"ESPDMA" would less likely clash with eventual 'ESP' definition.

My 2 cents.

#75 lore raw

Re: [PATCH 39/63] esp: Rename ESP_STATE to ESP

Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 31 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 include/hw/scsi/esp.h | 2 +-
 hw/dma/sparc32_dma.c  | 2 +-
 hw/m68k/q800.c        | 2 +-
 hw/mips/jazz.c        | 2 +-
 hw/scsi/esp.c         | 6 +++---
 hw/sparc/sun4m.c      | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
include/hw/scsi/esp.h +0 -0
index f281625dd5..20800dbf5b 100644
@@ -67,7 +67,7 @@ struct ESPState {
 
Quoted 7 lines

include/hw/scsi/esp.h struct ESPState { · line 71

Quoted 5 lines
include/hw/scsi/esp.h +1 -1
 #define TYPE_ESP "esp"
 typedef struct SysBusESPState SysBusESPState;
-DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP_STATE,
+DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP,
                          TYPE_ESP)

"ESPDMA" would less likely clash with eventual 'ESP' definition.

I want to make the changes less intrusive as possible. If the macro is already called ESP and the type name string is already "esp", I will just keep the existing naming.

Signature · 1 line
Eduardo
#76 lore raw

PATCH 40/63 filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Zhang Chen <[email protected]>
Cc: Li Zhijian <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 net/filter-rewriter.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
net/filter-rewriter.c +9 -9
index 113e293207..44f6021dd8 100644
@@ -25,7 +25,7 @@
 
 #define TYPE_FILTER_REWRITER "filter-rewriter"
 typedef struct RewriterState RewriterState;
-DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_COLO_REWRITER,
+DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_REWRITER,
                          TYPE_FILTER_REWRITER)
 
 #define FAILOVER_MODE_ON  true
@@ -47,7 +47,7 @@ static void filter_rewriter_failover_mode(RewriterState *s)
 
 static void filter_rewriter_flush(NetFilterState *nf)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     if (!qemu_net_queue_flush(s->incoming_queue)) {
         /* Unable to empty the queue, purge remaining packets */
@@ -252,7 +252,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
                                          int iovcnt,
                                          NetPacketSent *sent_cb)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
     Connection *conn;
     ConnectionKey key;
     Packet *pkt;
@@ -350,7 +350,7 @@ static gboolean offset_is_nonzero(gpointer key,
 static void colo_rewriter_handle_event(NetFilterState *nf, int event,
                                        Error **errp)
 {
-    RewriterState *rs = FILTER_COLO_REWRITER(nf);
+    RewriterState *rs = FILTER_REWRITER(nf);
 
     switch (event) {
     case COLO_EVENT_CHECKPOINT:
@@ -370,7 +370,7 @@ static void colo_rewriter_handle_event(NetFilterState *nf, int event,
 
 static void colo_rewriter_cleanup(NetFilterState *nf)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     /* flush packets */
     if (s->incoming_queue) {
@@ -381,7 +381,7 @@ static void colo_rewriter_cleanup(NetFilterState *nf)
 
 static void colo_rewriter_setup(NetFilterState *nf, Error **errp)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     s->connection_track_table = g_hash_table_new_full(connection_key_hash,
                                                       connection_key_equal,
@@ -392,7 +392,7 @@ static void colo_rewriter_setup(NetFilterState *nf, Error **errp)
 
 static bool filter_rewriter_get_vnet_hdr(Object *obj, Error **errp)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     return s->vnet_hdr;
 }
@@ -401,14 +401,14 @@ static void filter_rewriter_set_vnet_hdr(Object *obj,
                                          bool value,
                                          Error **errp)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     s->vnet_hdr = value;
 }
 
 static void filter_rewriter_init(Object *obj)
 {
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     s->vnet_hdr = false;
     s->failover_mode = FAILOVER_MODE_OFF;
Signature · 1 line
2.26.2
Reviewed-by on v1 40/63
#77 lore raw

RE: [PATCH 40/63] filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER

Quoted 11 lines

-----Original Message-----
From: Eduardo Habkost <[email protected]>
Sent: Thursday, September 3, 2020 6:43 AM
To: [email protected]
Cc: [email protected]; Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 40/63] filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER

Quoted 3 lines

Make the type checking macro name consistent with the TYPE_* constant.

Thanks
Zhang Chen

Quoted 91 lines

---
Cc: Zhang Chen <[email protected]>
Cc: Li Zhijian <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 net/filter-rewriter.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
net/filter-rewriter.c index renamed from net/filter-rewriter.c +0 -0

113e293207..44f6021dd8 100644

net/filter-rewriter.c +7 -5
@@ -25,7 +25,7 @@
 
 #define TYPE_FILTER_REWRITER "filter-rewriter"
 typedef struct RewriterState RewriterState; -
 DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_COLO_REWRITER,
+DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_REWRITER,
                          TYPE_FILTER_REWRITER)
 
 #define FAILOVER_MODE_ON  true
@@ -47,7 +47,7 @@ static void filter_rewriter_failover_mode(RewriterState
 *s)
 
 static void filter_rewriter_flush(NetFilterState *nf)  {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     if (!qemu_net_queue_flush(s->incoming_queue)) {
         /* Unable to empty the queue, purge remaining packets */ @@ -252,7
+252,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
                                          int iovcnt,
                                          NetPacketSent *sent_cb)  {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
     Connection *conn;
     ConnectionKey key;
     Packet *pkt;
@@ -350,7 +350,7 @@ static gboolean offset_is_nonzero(gpointer key,
 static void colo_rewriter_handle_event(NetFilterState *nf, int event,
                                        Error **errp)  {
-    RewriterState *rs = FILTER_COLO_REWRITER(nf);
+    RewriterState *rs = FILTER_REWRITER(nf);
 
     switch (event) {
     case COLO_EVENT_CHECKPOINT:
@@ -370,7 +370,7 @@ static void
 colo_rewriter_handle_event(NetFilterState *nf, int event,
 
 static void colo_rewriter_cleanup(NetFilterState *nf)  {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     /* flush packets */
     if (s->incoming_queue) {
@@ -381,7 +381,7 @@ static void colo_rewriter_cleanup(NetFilterState *nf)
 
 static void colo_rewriter_setup(NetFilterState *nf, Error **errp)  {
-    RewriterState *s = FILTER_COLO_REWRITER(nf);
+    RewriterState *s = FILTER_REWRITER(nf);
 
     s->connection_track_table =
 g_hash_table_new_full(connection_key_hash,
                                                       connection_key_equal, @@ -392,7 +392,7 @@

static void colo_rewriter_setup(NetFilterState *nf, Error **errp)

static bool filter_rewriter_get_vnet_hdr(Object *obj, Error **errp) {

net/filter-rewriter.c +3 -4
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     return s->vnet_hdr;
 }
@@ -401,14 +401,14 @@ static void filter_rewriter_set_vnet_hdr(Object
 *obj,
                                          bool value,
                                          Error **errp)  {
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     s->vnet_hdr = value;
 }
 
 static void filter_rewriter_init(Object *obj)  {
-    RewriterState *s = FILTER_COLO_REWRITER(obj);
+    RewriterState *s = FILTER_REWRITER(obj);
 
     s->vnet_hdr = false;
     s->failover_mode = FAILOVER_MODE_OFF;
--

2.26.2

#78 lore raw

PATCH 41/63 lance: Rename SYSBUS_PCNET to LANCE

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Jason Wang <[email protected]>
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 include/hw/net/lance.h | 2 +-
 hw/net/lance.c         | 6 +++---
 hw/sparc/sun4m.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
include/hw/net/lance.h +1 -1
index f645d6af67..a0434f1254 100644
@@ -36,7 +36,7 @@
 
 #define TYPE_LANCE "lance"
 typedef struct SysBusPCNetState SysBusPCNetState;
-DECLARE_INSTANCE_CHECKER(SysBusPCNetState, SYSBUS_PCNET,
+DECLARE_INSTANCE_CHECKER(SysBusPCNetState, LANCE,
                          TYPE_LANCE)
 
 struct SysBusPCNetState {
hw/net/lance.c +3 -3
index 4c5f01baad..47ab7e1847 100644
@@ -103,7 +103,7 @@ static const VMStateDescription vmstate_lance = {
 static void lance_realize(DeviceState *dev, Error **errp)
 {
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
-    SysBusPCNetState *d = SYSBUS_PCNET(dev);
+    SysBusPCNetState *d = LANCE(dev);
     PCNetState *s = &d->state;
 
     memory_region_init_io(&s->mmio, OBJECT(d), &lance_mem_ops, d,
@@ -122,14 +122,14 @@ static void lance_realize(DeviceState *dev, Error **errp)
 
 static void lance_reset(DeviceState *dev)
 {
-    SysBusPCNetState *d = SYSBUS_PCNET(dev);
+    SysBusPCNetState *d = LANCE(dev);
 
     pcnet_h_reset(&d->state);
 }
 
 static void lance_instance_init(Object *obj)
 {
-    SysBusPCNetState *d = SYSBUS_PCNET(obj);
+    SysBusPCNetState *d = LANCE(obj);
     PCNetState *s = &d->state;
 
     device_add_bootindex_property(obj, &s->conf.bootindex,
hw/sparc/sun4m.c +1 -1
index 3ee7ef4590..192cb87658 100644
@@ -353,7 +353,7 @@ static void *sparc32_dma_init(hwaddr dma_base,
                                  OBJECT(dma), "ledma"));
     sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);
 
-    lance = SYSBUS_PCNET(object_resolve_path_component(
+    lance = LANCE(object_resolve_path_component(
                          OBJECT(ledma), "lance"));
     sysbus_mmio_map(SYS_BUS_DEVICE(lance), 0, le_base);
 
Signature · 1 line
2.26.2
#79 lore raw

PATCH 42/63 lasi_i82596: Rename SYSBUS_I82596 to LASI_82596

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Richard Henderson <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 include/hw/net/lasi_82596.h | 2 +-
 hw/net/lasi_i82596.c        | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
include/hw/net/lasi_82596.h +1 -1
index 7b62b04833..6b94726652 100644
@@ -14,7 +14,7 @@
 
 #define TYPE_LASI_82596 "lasi_82596"
 typedef struct SysBusI82596State SysBusI82596State;
-DECLARE_INSTANCE_CHECKER(SysBusI82596State, SYSBUS_I82596,
+DECLARE_INSTANCE_CHECKER(SysBusI82596State, LASI_82596,
                          TYPE_LASI_82596)
 
 struct SysBusI82596State {
hw/net/lasi_i82596.c +4 -4
index 820b63f350..20f85946a1 100644
@@ -109,7 +109,7 @@ static const VMStateDescription vmstate_lasi_82596 = {
 
 static void lasi_82596_realize(DeviceState *dev, Error **errp)
 {
-    SysBusI82596State *d = SYSBUS_I82596(dev);
+    SysBusI82596State *d = LASI_82596(dev);
     I82596State *s = &d->state;
 
     memory_region_init_io(&s->mmio, OBJECT(d), &lasi_82596_mem_ops, d,
@@ -128,7 +128,7 @@ SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space,
 
     qemu_check_nic_model(&nd_table[0], TYPE_LASI_82596);
     dev = qdev_new(TYPE_LASI_82596);
-    s = SYSBUS_I82596(dev);
+    s = LASI_82596(dev);
     s->state.irq = lan_irq;
     qdev_set_nic_properties(dev, &nd_table[0]);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -141,14 +141,14 @@ SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space,
 
 static void lasi_82596_reset(DeviceState *dev)
 {
-    SysBusI82596State *d = SYSBUS_I82596(dev);
+    SysBusI82596State *d = LASI_82596(dev);
 
     i82596_h_reset(&d->state);
 }
 
 static void lasi_82596_instance_init(Object *obj)
 {
-    SysBusI82596State *d = SYSBUS_I82596(obj);
+    SysBusI82596State *d = LASI_82596(obj);
     I82596State *s = &d->state;
 
     device_add_bootindex_property(obj, &s->conf.bootindex,
Signature · 1 line
2.26.2
#80 lore raw

PATCH 43/63 pvpanic: Rename ISA_PVPANIC_DEVICE to PVPANIC

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: [email protected]

---
 hw/misc/pvpanic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/misc/pvpanic.c +3 -3
index 598d5471a4..871be27c19 100644
@@ -31,7 +31,7 @@
 #define PVPANIC_CRASHLOADED     (1 << PVPANIC_F_CRASHLOADED)
 
 typedef struct PVPanicState PVPanicState;
-DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE,
+DECLARE_INSTANCE_CHECKER(PVPanicState, PVPANIC,
                          TYPE_PVPANIC)
 
 static void handle_event(int event)
@@ -86,7 +86,7 @@ static const MemoryRegionOps pvpanic_ops = {
 
 static void pvpanic_isa_initfn(Object *obj)
 {
-    PVPanicState *s = ISA_PVPANIC_DEVICE(obj);
+    PVPanicState *s = PVPANIC(obj);
 
     memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1);
 }
@@ -94,7 +94,7 @@ static void pvpanic_isa_initfn(Object *obj)
 static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
 {
     ISADevice *d = ISA_DEVICE(dev);
-    PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
+    PVPanicState *s = PVPANIC(dev);
     FWCfgState *fw_cfg = fw_cfg_find();
     uint16_t *pvpanic_port;
 
Signature · 1 line
2.26.2
#81 lore raw

PATCH 44/63 renesas: Rename RCMT to RENESAS_CMT

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Yoshinori Sato <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: [email protected]

---
 include/hw/timer/renesas_cmt.h | 2 +-
 hw/timer/renesas_cmt.c         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/hw/timer/renesas_cmt.h +1 -1
index 1c0b65c1d5..89e83df374 100644
@@ -15,7 +15,7 @@
 
 #define TYPE_RENESAS_CMT "renesas-cmt"
 typedef struct RCMTState RCMTState;
-DECLARE_INSTANCE_CHECKER(RCMTState, RCMT,
+DECLARE_INSTANCE_CHECKER(RCMTState, RENESAS_CMT,
                          TYPE_RENESAS_CMT)
 
 enum {
hw/timer/renesas_cmt.c +2 -2
index 2e0fd21a36..5700980057 100644
@@ -214,7 +214,7 @@ static void timer_event1(void *opaque)
 
 static void rcmt_reset(DeviceState *dev)
 {
-    RCMTState *cmt = RCMT(dev);
+    RCMTState *cmt = RENESAS_CMT(dev);
     cmt->cmstr = 0;
     cmt->cmcr[0] = cmt->cmcr[1] = 0;
     cmt->cmcnt[0] = cmt->cmcnt[1] = 0;
@@ -224,7 +224,7 @@ static void rcmt_reset(DeviceState *dev)
 static void rcmt_init(Object *obj)
 {
     SysBusDevice *d = SYS_BUS_DEVICE(obj);
-    RCMTState *cmt = RCMT(obj);
+    RCMTState *cmt = RENESAS_CMT(obj);
     int i;
 
     memory_region_init_io(&cmt->memory, OBJECT(cmt), &cmt_ops,
Signature · 1 line
2.26.2
#82 lore raw

PATCH 45/63 renesas: Rename RSCI to RENESAS_SCI

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Yoshinori Sato <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/char/renesas_sci.h |  2 +-
 hw/char/renesas_sci.c         | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
include/hw/char/renesas_sci.h +1 -1
index a4764e3eee..1349d2d003 100644
@@ -15,7 +15,7 @@
 
 #define TYPE_RENESAS_SCI "renesas-sci"
 typedef struct RSCIState RSCIState;
-DECLARE_INSTANCE_CHECKER(RSCIState, RSCI,
+DECLARE_INSTANCE_CHECKER(RSCIState, RENESAS_SCI,
                          TYPE_RENESAS_SCI)
 
 enum {
hw/char/renesas_sci.c +9 -9
index 5d7c6e6523..286fd28a39 100644
@@ -70,7 +70,7 @@ REG8(SEMR, 7)
 
 static int can_receive(void *opaque)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
     if (sci->rx_next > qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)) {
         return 0;
     } else {
@@ -80,7 +80,7 @@ static int can_receive(void *opaque)
 
 static void receive(void *opaque, const uint8_t *buf, int size)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
     sci->rx_next = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + sci->trtime;
     if (FIELD_EX8(sci->ssr, SSR, RDRF) || size > 1) {
         sci->ssr = FIELD_DP8(sci->ssr, SSR, ORER, 1);
@@ -112,7 +112,7 @@ static void send_byte(RSCIState *sci)
 
 static void txend(void *opaque)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
     if (!FIELD_EX8(sci->ssr, SSR, TDRE)) {
         send_byte(sci);
     } else {
@@ -143,7 +143,7 @@ static bool sci_is_tr_enabled(RSCIState *sci)
 
 static void sci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
 
     switch (offset) {
     case A_SMR:
@@ -208,7 +208,7 @@ static void sci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
 
 static uint64_t sci_read(void *opaque, hwaddr offset, unsigned size)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
 
     switch (offset) {
     case A_SMR:
@@ -246,7 +246,7 @@ static const MemoryRegionOps sci_ops = {
 
 static void rsci_reset(DeviceState *dev)
 {
-    RSCIState *sci = RSCI(dev);
+    RSCIState *sci = RENESAS_SCI(dev);
     sci->smr = sci->scr = 0x00;
     sci->brr = 0xff;
     sci->tdr = 0xff;
@@ -259,7 +259,7 @@ static void rsci_reset(DeviceState *dev)
 
 static void sci_event(void *opaque, QEMUChrEvent event)
 {
-    RSCIState *sci = RSCI(opaque);
+    RSCIState *sci = RENESAS_SCI(opaque);
     if (event == CHR_EVENT_BREAK) {
         sci->ssr = FIELD_DP8(sci->ssr, SSR, FER, 1);
         if (FIELD_EX8(sci->scr, SCR, RIE)) {
@@ -270,7 +270,7 @@ static void sci_event(void *opaque, QEMUChrEvent event)
 
 static void rsci_realize(DeviceState *dev, Error **errp)
 {
-    RSCIState *sci = RSCI(dev);
+    RSCIState *sci = RENESAS_SCI(dev);
 
     if (sci->input_freq == 0) {
         qemu_log_mask(LOG_GUEST_ERROR,
@@ -284,7 +284,7 @@ static void rsci_realize(DeviceState *dev, Error **errp)
 static void rsci_init(Object *obj)
 {
     SysBusDevice *d = SYS_BUS_DEVICE(obj);
-    RSCIState *sci = RSCI(obj);
+    RSCIState *sci = RENESAS_SCI(obj);
     int i;
 
     memory_region_init_io(&sci->memory, OBJECT(sci), &sci_ops,
Signature · 1 line
2.26.2
#83 lore raw

PATCH 46/63 renesas: Rename RTMR to RENESAS_TMR

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Yoshinori Sato <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: [email protected]

---
 include/hw/timer/renesas_tmr.h | 6 +++---
 hw/rx/rx62n.c                  | 2 +-
 hw/timer/renesas_tmr.c         | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)
include/hw/timer/renesas_tmr.h +3 -3
index caf7eec0dc..5f2f156160 100644
@@ -13,10 +13,10 @@
 #include "hw/sysbus.h"
 #include "qom/object.h"
 
-#define TYPE_RENESAS_TMR "renesas-tmr"
+#define TYPE_RTMR "renesas-tmr"
 typedef struct RTMRState RTMRState;
-DECLARE_INSTANCE_CHECKER(RTMRState, RTMR,
-                         TYPE_RENESAS_TMR)
+DECLARE_INSTANCE_CHECKER(RTMRState, RENESAS_TMR,
+                         TYPE_RTMR)
 
 enum timer_event {
     cmia = 0,
hw/rx/rx62n.c +1 -1
index 6eb4eea700..0f564c4dfb 100644
@@ -166,7 +166,7 @@ static void register_tmr(RX62NState *s, int unit)
     int i, irqbase;
 
     object_initialize_child(OBJECT(s), "tmr[*]",
-                            &s->tmr[unit], TYPE_RENESAS_TMR);
+                            &s->tmr[unit], TYPE_RTMR);
     tmr = SYS_BUS_DEVICE(&s->tmr[unit]);
     qdev_prop_set_uint64(DEVICE(tmr), "input-freq", s->pclk_freq_hz);
     sysbus_realize(tmr, &error_abort);
hw/timer/renesas_tmr.c +3 -3
index 446f2eacdd..53733586c2 100644
@@ -396,7 +396,7 @@ static void timer_event1(void *opaque)
 
 static void rtmr_reset(DeviceState *dev)
 {
-    RTMRState *tmr = RTMR(dev);
+    RTMRState *tmr = RENESAS_TMR(dev);
     tmr->tcr[0]   = tmr->tcr[1]   = 0x00;
     tmr->tcsr[0]  = 0x00;
     tmr->tcsr[1]  = 0x10;
@@ -411,7 +411,7 @@ static void rtmr_reset(DeviceState *dev)
 static void rtmr_init(Object *obj)
 {
     SysBusDevice *d = SYS_BUS_DEVICE(obj);
-    RTMRState *tmr = RTMR(obj);
+    RTMRState *tmr = RENESAS_TMR(obj);
     int i;
 
     memory_region_init_io(&tmr->memory, OBJECT(tmr), &tmr_ops,
@@ -462,7 +462,7 @@ static void rtmr_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo rtmr_info = {
-    .name = TYPE_RENESAS_TMR,
+    .name = TYPE_RTMR,
     .parent = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(RTMRState),
     .instance_init = rtmr_init,
Signature · 1 line
2.26.2
#84 lore raw

Re: [PATCH 46/63] renesas: Rename RTMR to RENESAS_TMR

Quoted 9 lines · Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Yoshinori Sato <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: [email protected]
---

[...]

include/hw/timer/renesas_tmr.h line 19

Quoted 7 lines
include/hw/timer/renesas_tmr.h +3 -3
-#define TYPE_RENESAS_TMR "renesas-tmr"
+#define TYPE_RTMR "renesas-tmr"
 typedef struct RTMRState RTMRState;
-DECLARE_INSTANCE_CHECKER(RTMRState, RTMR,
-                         TYPE_RENESAS_TMR)
+DECLARE_INSTANCE_CHECKER(RTMRState, RENESAS_TMR,
+                         TYPE_RTMR)

Please ignore this patch. I've made a mistake while rebasing the series and accidentally squashed in a commit that renamed TYPE_RENESAS_TMR to TYPE_RTMR.

Signature · 1 line
Eduardo
#85 lore raw

PATCH 47/63 rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: David Gibson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/ppc/rs6000_mc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/rs6000_mc.c +2 -2
index 56e96010b8..8611ffa96d 100644
@@ -30,7 +30,7 @@
 
 #define TYPE_RS6000MC "rs6000-mc"
 typedef struct RS6000MCState RS6000MCState;
-DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC_DEVICE,
+DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC,
                          TYPE_RS6000MC)
 
 struct RS6000MCState {
@@ -143,7 +143,7 @@ static const MemoryRegionPortio rs6000mc_port_list[] = {
 
 static void rs6000mc_realize(DeviceState *dev, Error **errp)
 {
-    RS6000MCState *s = RS6000MC_DEVICE(dev);
+    RS6000MCState *s = RS6000MC(dev);
     int socket = 0;
     unsigned int ram_size = s->ram_size / MiB;
     Error *local_err = NULL;
Signature · 1 line
2.26.2
Reviewed-by on v1 47/63
#86 lore raw

Re: [PATCH 47/63] rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC

Le 03/09/2020 à 00:42, Eduardo Habkost a écrit :

Quoted 4 lines

Make the type checking macro name consistent with the TYPE_* constant.

Quoted 8 lines

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: David Gibson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  hw/ppc/rs6000_mc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by on v1 47/63
#87 lore raw

Re: [PATCH 47/63] rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC

In reply to Eduardo Habkost
Quoted 28 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: "Hervé Poussineau" <[email protected]>
Cc: David Gibson <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/ppc/rs6000_mc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/rs6000_mc.c +1 -1
index 56e96010b8..8611ffa96d 100644
@@ -30,7 +30,7 @@
 
 #define TYPE_RS6000MC "rs6000-mc"
 typedef struct RS6000MCState RS6000MCState;
-DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC_DEVICE,
+DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC,
                          TYPE_RS6000MC)
 
 struct RS6000MCState {

hw/ppc/rs6000_mc.c static const MemoryRegionPortio rs6000mc_port_list[] = { · line 149

Quoted 8 lines
hw/ppc/rs6000_mc.c +1 -1
@@ -143,7 +143,7 @@ static const MemoryRegionPortio rs6000mc_port_list[] = {
 
 static void rs6000mc_realize(DeviceState *dev, Error **errp)
 {
-    RS6000MCState *s = RS6000MC_DEVICE(dev);
+    RS6000MCState *s = RS6000MC(dev);
     int socket = 0;
     unsigned int ram_size = s->ram_size / MiB;
     Error *local_err = NULL;
#88 lore raw

PATCH 48/63 sabre: Rename SABRE_DEVICE to SABRE

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

---
 include/hw/pci-host/sabre.h | 2 +-
 hw/pci-host/sabre.c         | 8 ++++----
 hw/sparc64/sun4u.c          | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
include/hw/pci-host/sabre.h +1 -1
index 597bf70d69..7a76de4b9e 100644
@@ -51,7 +51,7 @@ struct SabreState {
 typedef struct SabreState SabreState;
 
 #define TYPE_SABRE "sabre"
-DECLARE_INSTANCE_CHECKER(SabreState, SABRE_DEVICE,
+DECLARE_INSTANCE_CHECKER(SabreState, SABRE,
                          TYPE_SABRE)
 
 #endif
hw/pci-host/sabre.c +4 -4
index 0cc68585f8..5ac6283623 100644
@@ -338,7 +338,7 @@ static void pci_sabre_set_irq(void *opaque, int irq_num, int level)
 
 static void sabre_reset(DeviceState *d)
 {
-    SabreState *s = SABRE_DEVICE(d);
+    SabreState *s = SABRE(d);
     PCIDevice *pci_dev;
     unsigned int i;
     uint16_t cmd;
@@ -376,7 +376,7 @@ static const MemoryRegionOps pci_config_ops = {
 
 static void sabre_realize(DeviceState *dev, Error **errp)
 {
-    SabreState *s = SABRE_DEVICE(dev);
+    SabreState *s = SABRE(dev);
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(s);
     PCIDevice *pci_dev;
@@ -421,7 +421,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
 
 static void sabre_init(Object *obj)
 {
-    SabreState *s = SABRE_DEVICE(obj);
+    SabreState *s = SABRE(obj);
     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
     unsigned int i;
 
@@ -502,7 +502,7 @@ static const TypeInfo sabre_pci_info = {
 
 static char *sabre_ofw_unit_address(const SysBusDevice *dev)
 {
-    SabreState *s = SABRE_DEVICE(dev);
+    SabreState *s = SABRE(dev);
 
     return g_strdup_printf("%x,%x",
                (uint32_t)((s->special_base >> 32) & 0xffffffff),
hw/sparc64/sun4u.c +1 -1
index fe0d84bf6c..b746c3bf38 100644
@@ -585,7 +585,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     prom_init(hwdef->prom_addr, bios_name);
 
     /* Init sabre (PCI host bridge) */
-    sabre = SABRE_DEVICE(qdev_new(TYPE_SABRE));
+    sabre = SABRE(qdev_new(TYPE_SABRE));
     qdev_prop_set_uint64(DEVICE(sabre), "special-base", PBM_SPECIAL_BASE);
     qdev_prop_set_uint64(DEVICE(sabre), "mem-base", PBM_MEM_BASE);
     object_property_set_link(OBJECT(sabre), "iommu", OBJECT(iommu),
Signature · 1 line
2.26.2
Reviewed-by on v1 48/63
#89 lore raw

Re: [PATCH 48/63] sabre: Rename SABRE_DEVICE to SABRE

Quoted 8 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: [email protected]

Quoted 5 lines
---
 include/hw/pci-host/sabre.h | 2 +-
 hw/pci-host/sabre.c         | 8 ++++----
 hw/sparc64/sun4u.c          | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
#90 lore raw

PATCH 49/63 stm32f205: Rename STM32F2XXTIMER to STM32F2XX_TIMER

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

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

---
 include/hw/timer/stm32f2xx_timer.h | 2 +-
 hw/timer/stm32f2xx_timer.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/stm32f2xx_timer.h +1 -1
index 90f40f1746..70ef426afc 100644
@@ -63,7 +63,7 @@
 
 #define TYPE_STM32F2XX_TIMER "stm32f2xx-timer"
 typedef struct STM32F2XXTimerState STM32F2XXTimerState;
-DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XXTIMER,
+DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XX_TIMER,
                          TYPE_STM32F2XX_TIMER)
 
 struct STM32F2XXTimerState {
hw/timer/stm32f2xx_timer.c +3 -3
index ba8694dcd3..d880c0b4d5 100644
@@ -96,7 +96,7 @@ static void stm32f2xx_timer_set_alarm(STM32F2XXTimerState *s, int64_t now)
 
 static void stm32f2xx_timer_reset(DeviceState *dev)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(dev);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(dev);
     int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
 
     s->tim_cr1 = 0;
@@ -306,7 +306,7 @@ static Property stm32f2xx_timer_properties[] = {
 
 static void stm32f2xx_timer_init(Object *obj)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(obj);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(obj);
 
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
@@ -317,7 +317,7 @@ static void stm32f2xx_timer_init(Object *obj)
 
 static void stm32f2xx_timer_realize(DeviceState *dev, Error **errp)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(dev);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(dev);
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, stm32f2xx_timer_interrupt, s);
 }
 
Signature · 1 line
2.26.2
Reviewed-by on v1 49/63
#91 lore raw

Re: [PATCH 49/63] stm32f205: Rename STM32F2XXTIMER to STM32F2XX_TIMER

Quoted 5 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Alistair

Quoted 58 lines

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

---
 include/hw/timer/stm32f2xx_timer.h | 2 +-
 hw/timer/stm32f2xx_timer.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/timer/stm32f2xx_timer.h +1 -1
index 90f40f1746..70ef426afc 100644
@@ -63,7 +63,7 @@
 
 #define TYPE_STM32F2XX_TIMER "stm32f2xx-timer"
 typedef struct STM32F2XXTimerState STM32F2XXTimerState;
-DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XXTIMER,
+DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XX_TIMER,
                          TYPE_STM32F2XX_TIMER)
 
 struct STM32F2XXTimerState {
hw/timer/stm32f2xx_timer.c +3 -4
index ba8694dcd3..d880c0b4d5 100644
@@ -96,7 +96,7 @@ static void stm32f2xx_timer_set_alarm(STM32F2XXTimerState *s, int64_t now)
 
 static void stm32f2xx_timer_reset(DeviceState *dev)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(dev);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(dev);
     int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
 
     s->tim_cr1 = 0;
@@ -306,7 +306,7 @@ static Property stm32f2xx_timer_properties[] = {
 
 static void stm32f2xx_timer_init(Object *obj)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(obj);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(obj);
 
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
@@ -317,7 +317,7 @@ static void stm32f2xx_timer_init(Object *obj)
 
 static void stm32f2xx_timer_realize(DeviceState *dev, Error **errp)
 {
-    STM32F2XXTimerState *s = STM32F2XXTIMER(dev);
+    STM32F2XXTimerState *s = STM32F2XX_TIMER(dev);
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, stm32f2xx_timer_interrupt, s);
 }
 
--

2.26.2

#92 lore raw

PATCH 50/63 tpm_crb: Rename CRB to TPM_CRB

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Stefan Berger <[email protected]>
Cc: [email protected]

---
 hw/tpm/tpm_crb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
hw/tpm/tpm_crb.c +7 -7
index aa9c00aad3..f4e3f0abbc 100644
@@ -47,7 +47,7 @@ struct CRBState {
 };
 typedef struct CRBState CRBState;
 
-DECLARE_INSTANCE_CHECKER(CRBState, CRB,
+DECLARE_INSTANCE_CHECKER(CRBState, TPM_CRB,
                          TYPE_TPM_CRB)
 
 #define CRB_INTF_TYPE_CRB_ACTIVE 0b1
@@ -86,7 +86,7 @@ enum crb_cancel {
 static uint64_t tpm_crb_mmio_read(void *opaque, hwaddr addr,
                                   unsigned size)
 {
-    CRBState *s = CRB(opaque);
+    CRBState *s = TPM_CRB(opaque);
     void *regs = (void *)&s->regs + (addr & ~3);
     unsigned offset = addr & 3;
     uint32_t val = *(uint32_t *)regs >> (8 * offset);
@@ -113,7 +113,7 @@ static uint8_t tpm_crb_get_active_locty(CRBState *s)
 static void tpm_crb_mmio_write(void *opaque, hwaddr addr,
                                uint64_t val, unsigned size)
 {
-    CRBState *s = CRB(opaque);
+    CRBState *s = TPM_CRB(opaque);
     uint8_t locty =  addr >> 12;
 
     trace_tpm_crb_mmio_write(addr, size, val);
@@ -190,7 +190,7 @@ static const MemoryRegionOps tpm_crb_memory_ops = {
 
 static void tpm_crb_request_completed(TPMIf *ti, int ret)
 {
-    CRBState *s = CRB(ti);
+    CRBState *s = TPM_CRB(ti);
 
     s->regs[R_CRB_CTRL_START] &= ~CRB_START_INVOKE;
     if (ret != 0) {
@@ -201,7 +201,7 @@ static void tpm_crb_request_completed(TPMIf *ti, int ret)
 
 static enum TPMVersion tpm_crb_get_version(TPMIf *ti)
 {
-    CRBState *s = CRB(ti);
+    CRBState *s = TPM_CRB(ti);
 
     return tpm_backend_get_tpm_version(s->tpmbe);
 }
@@ -232,7 +232,7 @@ static Property tpm_crb_properties[] = {
 
 static void tpm_crb_reset(void *dev)
 {
-    CRBState *s = CRB(dev);
+    CRBState *s = TPM_CRB(dev);
 
     if (s->ppi_enabled) {
         tpm_ppi_reset(&s->ppi);
@@ -281,7 +281,7 @@ static void tpm_crb_reset(void *dev)
 
 static void tpm_crb_realize(DeviceState *dev, Error **errp)
 {
-    CRBState *s = CRB(dev);
+    CRBState *s = TPM_CRB(dev);
 
     if (!tpm_find()) {
         error_setg(errp, "at most one TPM device is permitted");
Signature · 1 line
2.26.2
Reviewed-by on v1 50/63
#93 lore raw

Re: [PATCH 50/63] tpm_crb: Rename CRB to TPM_CRB

Quoted 4 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Quoted 74 lines

---
Cc: Stefan Berger <[email protected]>
Cc: [email protected]

---
  hw/tpm/tpm_crb.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
hw/tpm/tpm_crb.c +7 -7
index aa9c00aad3..f4e3f0abbc 100644
@@ -47,7 +47,7 @@ struct CRBState {
  };
  typedef struct CRBState CRBState;
 
-DECLARE_INSTANCE_CHECKER(CRBState, CRB,
+DECLARE_INSTANCE_CHECKER(CRBState, TPM_CRB,
                           TYPE_TPM_CRB)
 
  #define CRB_INTF_TYPE_CRB_ACTIVE 0b1
@@ -86,7 +86,7 @@ enum crb_cancel {
  static uint64_t tpm_crb_mmio_read(void *opaque, hwaddr addr,
                                    unsigned size)
  {
-    CRBState *s = CRB(opaque);
+    CRBState *s = TPM_CRB(opaque);
      void *regs = (void *)&s->regs + (addr & ~3);
      unsigned offset = addr & 3;
      uint32_t val = *(uint32_t *)regs >> (8 * offset);
@@ -113,7 +113,7 @@ static uint8_t tpm_crb_get_active_locty(CRBState *s)
  static void tpm_crb_mmio_write(void *opaque, hwaddr addr,
                                 uint64_t val, unsigned size)
  {
-    CRBState *s = CRB(opaque);
+    CRBState *s = TPM_CRB(opaque);
      uint8_t locty =  addr >> 12;
 
      trace_tpm_crb_mmio_write(addr, size, val);
@@ -190,7 +190,7 @@ static const MemoryRegionOps tpm_crb_memory_ops = {
 
  static void tpm_crb_request_completed(TPMIf *ti, int ret)
  {
-    CRBState *s = CRB(ti);
+    CRBState *s = TPM_CRB(ti);
 
      s->regs[R_CRB_CTRL_START] &= ~CRB_START_INVOKE;
      if (ret != 0) {
@@ -201,7 +201,7 @@ static void tpm_crb_request_completed(TPMIf *ti, int ret)
 
  static enum TPMVersion tpm_crb_get_version(TPMIf *ti)
  {
-    CRBState *s = CRB(ti);
+    CRBState *s = TPM_CRB(ti);
 
      return tpm_backend_get_tpm_version(s->tpmbe);
  }
@@ -232,7 +232,7 @@ static Property tpm_crb_properties[] = {
 
  static void tpm_crb_reset(void *dev)
  {
-    CRBState *s = CRB(dev);
+    CRBState *s = TPM_CRB(dev);
 
      if (s->ppi_enabled) {
          tpm_ppi_reset(&s->ppi);
@@ -281,7 +281,7 @@ static void tpm_crb_reset(void *dev)
 
  static void tpm_crb_realize(DeviceState *dev, Error **errp)
  {
-    CRBState *s = CRB(dev);
+    CRBState *s = TPM_CRB(dev);
 
      if (!tpm_find()) {
          error_setg(errp, "at most one TPM device is permitted");
#94 lore raw

PATCH 51/63 tpm_spapr: Rename VIO_SPAPR_VTPM to TPM_SPAPR

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Stefan Berger <[email protected]>
Cc: [email protected]

---
 hw/tpm/tpm_spapr.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
hw/tpm/tpm_spapr.c +7 -7
index e3775adc57..aa86d5f943 100644
@@ -31,7 +31,7 @@
 #define DEBUG_SPAPR 0
 
 typedef struct SpaprTpmState SpaprTpmState;
-DECLARE_INSTANCE_CHECKER(SpaprTpmState, VIO_SPAPR_VTPM,
+DECLARE_INSTANCE_CHECKER(SpaprTpmState, TPM_SPAPR,
                          TYPE_TPM_SPAPR)
 
 typedef struct TpmCrq {
@@ -132,7 +132,7 @@ static inline int spapr_tpm_send_crq(struct SpaprVioDevice *dev, TpmCrq *crq)
 
 static int tpm_spapr_do_crq(struct SpaprVioDevice *dev, uint8_t *crq_data)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
     TpmCrq local_crq;
     TpmCrq *crq = &s->crq; /* requests only */
     int rc;
@@ -235,7 +235,7 @@ static int tpm_spapr_do_crq(struct SpaprVioDevice *dev, uint8_t *crq_data)
 
 static void tpm_spapr_request_completed(TPMIf *ti, int ret)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(ti);
+    SpaprTpmState *s = TPM_SPAPR(ti);
     TpmCrq *crq = &s->crq;
     uint32_t len;
     int rc;
@@ -283,7 +283,7 @@ static int tpm_spapr_do_startup_tpm(SpaprTpmState *s, size_t buffersize)
 
 static const char *tpm_spapr_get_dt_compatible(SpaprVioDevice *dev)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
     switch (s->be_tpm_version) {
     case TPM_VERSION_1_2:
@@ -297,7 +297,7 @@ static const char *tpm_spapr_get_dt_compatible(SpaprVioDevice *dev)
 
 static void tpm_spapr_reset(SpaprVioDevice *dev)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
     s->state = SPAPR_VTPM_STATE_NONE;
     s->numbytes = 0;
@@ -316,7 +316,7 @@ static void tpm_spapr_reset(SpaprVioDevice *dev)
 
 static enum TPMVersion tpm_spapr_get_version(TPMIf *ti)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(ti);
+    SpaprTpmState *s = TPM_SPAPR(ti);
 
     if (tpm_backend_had_startup_error(s->be_driver)) {
         return TPM_VERSION_UNSPEC;
@@ -377,7 +377,7 @@ static Property tpm_spapr_properties[] = {
 
 static void tpm_spapr_realizefn(SpaprVioDevice *dev, Error **errp)
 {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
     if (!tpm_find()) {
         error_setg(errp, "at most one TPM device is permitted");
Signature · 1 line
2.26.2
Reviewed-by on v1 51/63
#95 lore raw

Re: [PATCH 51/63] tpm_spapr: Rename VIO_SPAPR_VTPM to TPM_SPAPR

Quoted 4 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Quoted 74 lines

---
Cc: Stefan Berger <[email protected]>
Cc: [email protected]

---
  hw/tpm/tpm_spapr.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
hw/tpm/tpm_spapr.c +7 -7
index e3775adc57..aa86d5f943 100644
@@ -31,7 +31,7 @@
  #define DEBUG_SPAPR 0
 
  typedef struct SpaprTpmState SpaprTpmState;
-DECLARE_INSTANCE_CHECKER(SpaprTpmState, VIO_SPAPR_VTPM,
+DECLARE_INSTANCE_CHECKER(SpaprTpmState, TPM_SPAPR,
                           TYPE_TPM_SPAPR)
 
  typedef struct TpmCrq {
@@ -132,7 +132,7 @@ static inline int spapr_tpm_send_crq(struct SpaprVioDevice *dev, TpmCrq *crq)
 
  static int tpm_spapr_do_crq(struct SpaprVioDevice *dev, uint8_t *crq_data)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
      TpmCrq local_crq;
      TpmCrq *crq = &s->crq; /* requests only */
      int rc;
@@ -235,7 +235,7 @@ static int tpm_spapr_do_crq(struct SpaprVioDevice *dev, uint8_t *crq_data)
 
  static void tpm_spapr_request_completed(TPMIf *ti, int ret)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(ti);
+    SpaprTpmState *s = TPM_SPAPR(ti);
      TpmCrq *crq = &s->crq;
      uint32_t len;
      int rc;
@@ -283,7 +283,7 @@ static int tpm_spapr_do_startup_tpm(SpaprTpmState *s, size_t buffersize)
 
  static const char *tpm_spapr_get_dt_compatible(SpaprVioDevice *dev)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
      switch (s->be_tpm_version) {
      case TPM_VERSION_1_2:
@@ -297,7 +297,7 @@ static const char *tpm_spapr_get_dt_compatible(SpaprVioDevice *dev)
 
  static void tpm_spapr_reset(SpaprVioDevice *dev)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
      s->state = SPAPR_VTPM_STATE_NONE;
      s->numbytes = 0;
@@ -316,7 +316,7 @@ static void tpm_spapr_reset(SpaprVioDevice *dev)
 
  static enum TPMVersion tpm_spapr_get_version(TPMIf *ti)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(ti);
+    SpaprTpmState *s = TPM_SPAPR(ti);
 
      if (tpm_backend_had_startup_error(s->be_driver)) {
          return TPM_VERSION_UNSPEC;
@@ -377,7 +377,7 @@ static Property tpm_spapr_properties[] = {
 
  static void tpm_spapr_realizefn(SpaprVioDevice *dev, Error **errp)
  {
-    SpaprTpmState *s = VIO_SPAPR_VTPM(dev);
+    SpaprTpmState *s = TPM_SPAPR(dev);
 
      if (!tpm_find()) {
          error_setg(errp, "at most one TPM device is permitted");
#96 lore raw

PATCH 52/63 usb: Rename USB_REDIRECT to USB_REDIR

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/redirect.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
hw/usb/redirect.c +11 -11
index a079ecd50c..721af75da4 100644
@@ -145,7 +145,7 @@ struct USBRedirDevice {
 };
 
 #define TYPE_USB_REDIR "usb-redir"
-DECLARE_INSTANCE_CHECKER(USBRedirDevice, USB_REDIRECT,
+DECLARE_INSTANCE_CHECKER(USBRedirDevice, USB_REDIR,
                          TYPE_USB_REDIR)
 
 static void usbredir_hello(void *priv, struct usb_redir_hello_header *h);
@@ -375,7 +375,7 @@ static void packet_id_queue_empty(struct PacketIdQueue *q)
 
 static void usbredir_cancel_packet(USBDevice *udev, USBPacket *p)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
     int i = USBEP2I(p->ep);
 
     if (p->combined) {
@@ -516,7 +516,7 @@ static void usbredir_free_bufpq(USBRedirDevice *dev, uint8_t ep)
 
 static void usbredir_handle_reset(USBDevice *udev)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
 
     DPRINTF("reset device\n");
     usbredirparser_send_reset(dev->parser);
@@ -955,7 +955,7 @@ static void usbredir_stop_interrupt_receiving(USBRedirDevice *dev,
 
 static void usbredir_handle_data(USBDevice *udev, USBPacket *p)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
     uint8_t ep;
 
     ep = p->ep->nr;
@@ -1024,7 +1024,7 @@ static void usbredir_stop_ep(USBRedirDevice *dev, int i)
 
 static void usbredir_ep_stopped(USBDevice *udev, USBEndpoint *uep)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
 
     usbredir_stop_ep(dev, USBEP2I(uep));
     usbredirparser_do_write(dev->parser);
@@ -1094,7 +1094,7 @@ static void usbredir_get_interface(USBRedirDevice *dev, USBPacket *p,
 static void usbredir_handle_control(USBDevice *udev, USBPacket *p,
         int request, int value, int index, int length, uint8_t *data)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
     struct usb_redir_control_packet_header control_packet;
 
     if (usbredir_already_in_flight(dev, p->id)) {
@@ -1149,7 +1149,7 @@ static void usbredir_handle_control(USBDevice *udev, USBPacket *p,
 static int usbredir_alloc_streams(USBDevice *udev, USBEndpoint **eps,
                                   int nr_eps, int streams)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
 #if USBREDIR_VERSION >= 0x000700
     struct usb_redir_alloc_bulk_streams_header alloc_streams;
     int i;
@@ -1188,7 +1188,7 @@ static void usbredir_free_streams(USBDevice *udev, USBEndpoint **eps,
                                   int nr_eps)
 {
 #if USBREDIR_VERSION >= 0x000700
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
     struct usb_redir_free_bulk_streams_header free_streams;
     int i;
 
@@ -1417,7 +1417,7 @@ static void usbredir_init_endpoints(USBRedirDevice *dev)
 
 static void usbredir_realize(USBDevice *udev, Error **errp)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
     int i;
 
     if (!qemu_chr_fe_backend_connected(&dev->cs)) {
@@ -1472,7 +1472,7 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev)
 
 static void usbredir_unrealize(USBDevice *udev)
 {
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
 
     qemu_chr_fe_deinit(&dev->cs, true);
 
@@ -2593,7 +2593,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
 static void usbredir_instance_init(Object *obj)
 {
     USBDevice *udev = USB_DEVICE(obj);
-    USBRedirDevice *dev = USB_REDIRECT(udev);
+    USBRedirDevice *dev = USB_REDIR(udev);
 
     device_add_bootindex_property(obj, &dev->bootindex,
                                   "bootindex", NULL,
Signature · 1 line
2.26.2
#97 lore raw

PATCH 53/63 usb: Rename USB_SERIAL_DEV to USB_SERIAL

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: Samuel Thibault <[email protected]>
Cc: [email protected]

---
 hw/usb/dev-serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/dev-serial.c +2 -2
index 1a58851d4b..1a038a222e 100644
@@ -113,7 +113,7 @@ struct USBSerialState {
 typedef struct USBSerialState USBSerialState;
 
 #define TYPE_USB_SERIAL "usb-serial-dev"
-DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL_DEV,
+DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL,
                          TYPE_USB_SERIAL)
 
 enum {
@@ -517,7 +517,7 @@ static void usb_serial_event(void *opaque, QEMUChrEvent event)
 
 static void usb_serial_realize(USBDevice *dev, Error **errp)
 {
-    USBSerialState *s = USB_SERIAL_DEV(dev);
+    USBSerialState *s = USB_SERIAL(dev);
     Error *local_err = NULL;
 
     usb_desc_create_serial(dev);
Signature · 1 line
2.26.2
Reviewed-by on v1 53/63
#98 lore raw

Re: [PATCH 53/63] usb: Rename USB_SERIAL_DEV to USB_SERIAL

Quoted 4 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Quoted 31 lines

---
Cc: Gerd Hoffmann <[email protected]>
Cc: Samuel Thibault <[email protected]>
Cc: [email protected]

---
 hw/usb/dev-serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/dev-serial.c +2 -2
index 1a58851d4b..1a038a222e 100644
@@ -113,7 +113,7 @@ struct USBSerialState {
 typedef struct USBSerialState USBSerialState;
 
 #define TYPE_USB_SERIAL "usb-serial-dev"
-DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL_DEV,
+DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL,
                          TYPE_USB_SERIAL)
 
 enum {
@@ -517,7 +517,7 @@ static void usb_serial_event(void *opaque, QEMUChrEvent event)
 
 static void usb_serial_realize(USBDevice *dev, Error **errp)
 {
-    USBSerialState *s = USB_SERIAL_DEV(dev);
+    USBSerialState *s = USB_SERIAL(dev);
     Error *local_err = NULL;
 
     usb_desc_create_serial(dev);
#99 lore raw

PATCH 54/63 usb: Rename USB_STORAGE_DEV to USB_STORAGE

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/dev-storage.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/usb/dev-storage.c +6 -6
index 648340323f..bbc5d904bf 100644
@@ -70,7 +70,7 @@ struct MSDState {
 typedef struct MSDState MSDState;
 
 #define TYPE_USB_STORAGE "usb-storage-dev"
-DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE_DEV,
+DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE,
                          TYPE_USB_STORAGE)
 
 struct usb_msd_cbw {
@@ -400,7 +400,7 @@ static void usb_msd_handle_control(USBDevice *dev, USBPacket *p,
 
 static void usb_msd_cancel_io(USBDevice *dev, USBPacket *p)
 {
-    MSDState *s = USB_STORAGE_DEV(dev);
+    MSDState *s = USB_STORAGE(dev);
 
     assert(s->packet == p);
     s->packet = NULL;
@@ -605,7 +605,7 @@ static const struct SCSIBusInfo usb_msd_scsi_info_bot = {
 
 static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
 {
-    MSDState *s = USB_STORAGE_DEV(dev);
+    MSDState *s = USB_STORAGE(dev);
     BlockBackend *blk = s->conf.blk;
     SCSIDevice *scsi_dev;
 
@@ -656,7 +656,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
 
 static void usb_msd_bot_realize(USBDevice *dev, Error **errp)
 {
-    MSDState *s = USB_STORAGE_DEV(dev);
+    MSDState *s = USB_STORAGE(dev);
     DeviceState *d = DEVICE(dev);
 
     usb_desc_create_serial(dev);
@@ -725,7 +725,7 @@ static void usb_msd_get_bootindex(Object *obj, Visitor *v, const char *name,
                                   void *opaque, Error **errp)
 {
     USBDevice *dev = USB_DEVICE(obj);
-    MSDState *s = USB_STORAGE_DEV(dev);
+    MSDState *s = USB_STORAGE(dev);
 
     visit_type_int32(v, name, &s->conf.bootindex, errp);
 }
@@ -734,7 +734,7 @@ static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *name,
                                   void *opaque, Error **errp)
 {
     USBDevice *dev = USB_DEVICE(obj);
-    MSDState *s = USB_STORAGE_DEV(dev);
+    MSDState *s = USB_STORAGE(dev);
     int32_t boot_index;
     Error *local_err = NULL;
 
Signature · 1 line
2.26.2
#100 lore raw

PATCH 55/63 vfio: Rename PCI_VFIO to VFIO_PCI

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Alex Williamson <[email protected]>
Cc: [email protected]

---
 hw/vfio/pci.h |  2 +-
 hw/vfio/pci.c | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)
hw/vfio/pci.h +1 -1
index 846d60e56c..5e53d5b863 100644
@@ -116,7 +116,7 @@ typedef struct VFIOMSIXInfo {
 
 #define TYPE_VFIO_PCI "vfio-pci"
 typedef struct VFIOPCIDevice VFIOPCIDevice;
-DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, PCI_VFIO,
+DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, VFIO_PCI,
                          TYPE_VFIO_PCI)
 
 struct VFIOPCIDevice {
hw/vfio/pci.c +11 -11
index 3611dcd38b..0d83eb0e47 100644
@@ -230,7 +230,7 @@ static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route)
 
 static void vfio_intx_routing_notifier(PCIDevice *pdev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     PCIINTxRoute route;
 
     if (vdev->interrupt != VFIO_INT_INTx) {
@@ -456,7 +456,7 @@ static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg,
 static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
                                    MSIMessage *msg, IOHandler *handler)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIOMSIVector *vector;
     int ret;
 
@@ -541,7 +541,7 @@ static int vfio_msix_vector_use(PCIDevice *pdev,
 
 static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIOMSIVector *vector = &vdev->msi_vectors[nr];
 
     trace_vfio_msix_vector_release(vdev->vbasedev.name, nr);
@@ -1048,7 +1048,7 @@ static const MemoryRegionOps vfio_vga_ops = {
  */
 static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIORegion *region = &vdev->bars[bar].region;
     MemoryRegion *mmap_mr, *region_mr, *base_mr;
     PCIIORegion *r;
@@ -1094,7 +1094,7 @@ static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
  */
 uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val;
 
     memcpy(&emu_bits, vdev->emulated_config_bits + addr, len);
@@ -1127,7 +1127,7 @@ uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
 void vfio_pci_write_config(PCIDevice *pdev,
                            uint32_t addr, uint32_t val, int len)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     uint32_t val_le = cpu_to_le32(val);
 
     trace_vfio_pci_write_config(vdev->vbasedev.name, addr, val, len);
@@ -2701,7 +2701,7 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
 
 static void vfio_realize(PCIDevice *pdev, Error **errp)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIODevice *vbasedev_iter;
     VFIOGroup *group;
     char *tmp, *subsys, group_path[PATH_MAX], *group_name;
@@ -3033,7 +3033,7 @@ error:
 
 static void vfio_instance_finalize(Object *obj)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(obj);
+    VFIOPCIDevice *vdev = VFIO_PCI(obj);
     VFIOGroup *group = vdev->vbasedev.group;
 
     vfio_display_finalize(vdev);
@@ -3057,7 +3057,7 @@ static void vfio_instance_finalize(Object *obj)
 
 static void vfio_exitfn(PCIDevice *pdev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
 
     vfio_unregister_req_notifier(vdev);
     vfio_unregister_err_notifier(vdev);
@@ -3075,7 +3075,7 @@ static void vfio_exitfn(PCIDevice *pdev)
 
 static void vfio_pci_reset(DeviceState *dev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(dev);
+    VFIOPCIDevice *vdev = VFIO_PCI(dev);
 
     trace_vfio_pci_reset(vdev->vbasedev.name);
 
@@ -3115,7 +3115,7 @@ post_reset:
 static void vfio_instance_init(Object *obj)
 {
     PCIDevice *pci_dev = PCI_DEVICE(obj);
-    VFIOPCIDevice *vdev = PCI_VFIO(obj);
+    VFIOPCIDevice *vdev = VFIO_PCI(obj);
 
     device_add_bootindex_property(obj, &vdev->bootindex,
                                   "bootindex", NULL,
Signature · 1 line
2.26.2
Reviewed-by on v1 55/63
#101 lore raw

Re: [PATCH 55/63] vfio: Rename PCI_VFIO to VFIO_PCI

Eduardo,

Quoted 4 lines · Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

Thanks

Eric

Quoted 125 lines

---
Cc: Alex Williamson <[email protected]>
Cc: [email protected]

---
 hw/vfio/pci.h |  2 +-
 hw/vfio/pci.c | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)
hw/vfio/pci.h +1 -1
index 846d60e56c..5e53d5b863 100644
@@ -116,7 +116,7 @@ typedef struct VFIOMSIXInfo {
 
 #define TYPE_VFIO_PCI "vfio-pci"
 typedef struct VFIOPCIDevice VFIOPCIDevice;
-DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, PCI_VFIO,
+DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, VFIO_PCI,
                          TYPE_VFIO_PCI)
 
 struct VFIOPCIDevice {
hw/vfio/pci.c +11 -11
index 3611dcd38b..0d83eb0e47 100644
@@ -230,7 +230,7 @@ static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route)
 
 static void vfio_intx_routing_notifier(PCIDevice *pdev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     PCIINTxRoute route;
 
     if (vdev->interrupt != VFIO_INT_INTx) {
@@ -456,7 +456,7 @@ static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg,
 static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
                                    MSIMessage *msg, IOHandler *handler)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIOMSIVector *vector;
     int ret;
 
@@ -541,7 +541,7 @@ static int vfio_msix_vector_use(PCIDevice *pdev,
 
 static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIOMSIVector *vector = &vdev->msi_vectors[nr];
 
     trace_vfio_msix_vector_release(vdev->vbasedev.name, nr);
@@ -1048,7 +1048,7 @@ static const MemoryRegionOps vfio_vga_ops = {
  */
 static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIORegion *region = &vdev->bars[bar].region;
     MemoryRegion *mmap_mr, *region_mr, *base_mr;
     PCIIORegion *r;
@@ -1094,7 +1094,7 @@ static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
  */
 uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val;
 
     memcpy(&emu_bits, vdev->emulated_config_bits + addr, len);
@@ -1127,7 +1127,7 @@ uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
 void vfio_pci_write_config(PCIDevice *pdev,
                            uint32_t addr, uint32_t val, int len)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     uint32_t val_le = cpu_to_le32(val);
 
     trace_vfio_pci_write_config(vdev->vbasedev.name, addr, val, len);
@@ -2701,7 +2701,7 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
 
 static void vfio_realize(PCIDevice *pdev, Error **errp)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIODevice *vbasedev_iter;
     VFIOGroup *group;
     char *tmp, *subsys, group_path[PATH_MAX], *group_name;
@@ -3033,7 +3033,7 @@ error:
 
 static void vfio_instance_finalize(Object *obj)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(obj);
+    VFIOPCIDevice *vdev = VFIO_PCI(obj);
     VFIOGroup *group = vdev->vbasedev.group;
 
     vfio_display_finalize(vdev);
@@ -3057,7 +3057,7 @@ static void vfio_instance_finalize(Object *obj)
 
 static void vfio_exitfn(PCIDevice *pdev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(pdev);
+    VFIOPCIDevice *vdev = VFIO_PCI(pdev);
 
     vfio_unregister_req_notifier(vdev);
     vfio_unregister_err_notifier(vdev);
@@ -3075,7 +3075,7 @@ static void vfio_exitfn(PCIDevice *pdev)
 
 static void vfio_pci_reset(DeviceState *dev)
 {
-    VFIOPCIDevice *vdev = PCI_VFIO(dev);
+    VFIOPCIDevice *vdev = VFIO_PCI(dev);
 
     trace_vfio_pci_reset(vdev->vbasedev.name);
 
@@ -3115,7 +3115,7 @@ post_reset:
 static void vfio_instance_init(Object *obj)
 {
     PCIDevice *pci_dev = PCI_DEVICE(obj);
-    VFIOPCIDevice *vdev = PCI_VFIO(obj);
+    VFIOPCIDevice *vdev = VFIO_PCI(obj);
 
     device_add_bootindex_property(obj, &vdev->bootindex,
                                   "bootindex", NULL,
#102 lore raw

PATCH 56/63 vmxnet3: Rename VMXNET3_DEVICE* to VMXNET3*

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Dmitry Fleytman <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/vmxnet3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/net/vmxnet3.c +3 -3
index eff299f629..100e5982d0 100644
@@ -135,7 +135,7 @@ struct VMXNET3Class {
 };
 typedef struct VMXNET3Class VMXNET3Class;
 
-DECLARE_CLASS_CHECKERS(VMXNET3Class, VMXNET3_DEVICE,
+DECLARE_CLASS_CHECKERS(VMXNET3Class, VMXNET3,
                        TYPE_VMXNET3)
 
 static inline void vmxnet3_ring_init(PCIDevice *d,
@@ -2475,7 +2475,7 @@ static Property vmxnet3_properties[] = {
 
 static void vmxnet3_realize(DeviceState *qdev, Error **errp)
 {
-    VMXNET3Class *vc = VMXNET3_DEVICE_GET_CLASS(qdev);
+    VMXNET3Class *vc = VMXNET3_GET_CLASS(qdev);
     PCIDevice *pci_dev = PCI_DEVICE(qdev);
     VMXNET3State *s = VMXNET3(qdev);
 
@@ -2490,7 +2490,7 @@ static void vmxnet3_class_init(ObjectClass *class, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(class);
     PCIDeviceClass *c = PCI_DEVICE_CLASS(class);
-    VMXNET3Class *vc = VMXNET3_DEVICE_CLASS(class);
+    VMXNET3Class *vc = VMXNET3_CLASS(class);
 
     c->realize = vmxnet3_pci_realize;
     c->exit = vmxnet3_pci_uninit;
Signature · 1 line
2.26.2
#103 lore raw

PATCH 57/63 xen: Rename XENBACKEND_DEVICE to XENBACKEND

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/xen/xen-legacy-backend.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/xen/xen-legacy-backend.h +1 -1
index ba7a3c59bb..be281e1f38 100644
@@ -11,7 +11,7 @@
 #define TYPE_XENBACKEND "xen-backend"
 
 typedef struct XenLegacyDevice XenLegacyDevice;
-DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND_DEVICE,
+DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND,
                          TYPE_XENBACKEND)
 
 /* variables */
Signature · 1 line
2.26.2
#105 lore raw

PATCH 58/63 hvf: Rename HVF_STATE to HVF_ACCEL

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sysemu/hvf.h +1 -1
index 1398679458..195795e857 100644
@@ -37,7 +37,7 @@ void hvf_vcpu_destroy(CPUState *);
 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
 
 typedef struct HVFState HVFState;
-DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
+DECLARE_INSTANCE_CHECKER(HVFState, HVF_ACCEL,
                          TYPE_HVF_ACCEL)
 
 #endif
Signature · 1 line
2.26.2
#106 lore raw

PATCH 59/63 kvm: Rename KVM_STATE to KVM_ACCEL

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Aleksandar Markovic <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: David Gibson <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 include/sysemu/kvm.h |  2 +-
 accel/kvm/kvm-all.c  | 18 +++++++++---------
 target/arm/kvm.c     |  2 +-
 target/i386/kvm.c    |  2 +-
 target/mips/kvm.c    |  2 +-
 target/ppc/kvm.c     |  4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)
include/sysemu/kvm.h +1 -1
index 5bbea53883..89c422e1e7 100644
@@ -204,7 +204,7 @@ struct KVMState;
 
 #define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm")
 typedef struct KVMState KVMState;
-DECLARE_INSTANCE_CHECKER(KVMState, KVM_STATE,
+DECLARE_INSTANCE_CHECKER(KVMState, KVM_ACCEL,
                          TYPE_KVM_ACCEL)
 
 extern KVMState *kvm_state;
accel/kvm/kvm-all.c +9 -9
index 63ef6af9a1..bdf63ca3a3 100644
@@ -214,7 +214,7 @@ void kvm_resample_fd_notify(int gsi)
 
 int kvm_get_max_memslots(void)
 {
-    KVMState *s = KVM_STATE(current_accel());
+    KVMState *s = KVM_ACCEL(current_accel());
 
     return s->nr_slots;
 }
@@ -256,7 +256,7 @@ static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml)
 
 bool kvm_has_free_slot(MachineState *ms)
 {
-    KVMState *s = KVM_STATE(ms->accelerator);
+    KVMState *s = KVM_ACCEL(ms->accelerator);
     bool result;
     KVMMemoryListener *kml = &s->memory_listener;
 
@@ -1970,7 +1970,7 @@ static int kvm_max_vcpu_id(KVMState *s)
 
 bool kvm_vcpu_id_is_valid(int vcpu_id)
 {
-    KVMState *s = KVM_STATE(current_accel());
+    KVMState *s = KVM_ACCEL(current_accel());
     return vcpu_id >= 0 && vcpu_id < kvm_max_vcpu_id(s);
 }
 
@@ -1996,7 +1996,7 @@ static int kvm_init(MachineState *ms)
     const char *kvm_type;
     uint64_t dirty_log_manual_caps;
 
-    s = KVM_STATE(ms->accelerator);
+    s = KVM_ACCEL(ms->accelerator);
 
     /*
      * On systems where the kernel can support different base page
@@ -3084,7 +3084,7 @@ int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target)
 static bool kvm_accel_has_memory(MachineState *ms, AddressSpace *as,
                                  hwaddr start_addr, hwaddr size)
 {
-    KVMState *kvm = KVM_STATE(ms->accelerator);
+    KVMState *kvm = KVM_ACCEL(ms->accelerator);
     int i;
 
     for (i = 0; i < kvm->nr_as; ++i) {
@@ -3102,7 +3102,7 @@ static void kvm_get_kvm_shadow_mem(Object *obj, Visitor *v,
                                    const char *name, void *opaque,
                                    Error **errp)
 {
-    KVMState *s = KVM_STATE(obj);
+    KVMState *s = KVM_ACCEL(obj);
     int64_t value = s->kvm_shadow_mem;
 
     visit_type_int(v, name, &value, errp);
@@ -3112,7 +3112,7 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v,
                                    const char *name, void *opaque,
                                    Error **errp)
 {
-    KVMState *s = KVM_STATE(obj);
+    KVMState *s = KVM_ACCEL(obj);
     int64_t value;
 
     if (!visit_type_int(v, name, &value, errp)) {
@@ -3126,7 +3126,7 @@ static void kvm_set_kernel_irqchip(Object *obj, Visitor *v,
                                    const char *name, void *opaque,
                                    Error **errp)
 {
-    KVMState *s = KVM_STATE(obj);
+    KVMState *s = KVM_ACCEL(obj);
     OnOffSplit mode;
 
     if (!visit_type_OnOffSplit(v, name, &mode, errp)) {
@@ -3173,7 +3173,7 @@ bool kvm_kernel_irqchip_split(void)
 
 static void kvm_accel_instance_init(Object *obj)
 {
-    KVMState *s = KVM_STATE(obj);
+    KVMState *s = KVM_ACCEL(obj);
 
     s->kvm_shadow_mem = -1;
     s->kernel_irqchip_allowed = true;
target/arm/kvm.c +1 -1
index 8bb7318378..55583075f3 100644
@@ -216,7 +216,7 @@ bool kvm_arm_pmu_supported(void)
 
 int kvm_arm_get_max_vm_ipa_size(MachineState *ms)
 {
-    KVMState *s = KVM_STATE(ms->accelerator);
+    KVMState *s = KVM_ACCEL(ms->accelerator);
     int ret;
 
     ret = kvm_check_extension(s, KVM_CAP_ARM_VM_IPA_SIZE);
target/i386/kvm.c +1 -1
index 205b68bc0c..2949c5f048 100644
@@ -155,7 +155,7 @@ bool kvm_allows_irq0_override(void)
 
 static bool kvm_x2apic_api_set_flags(uint64_t flags)
 {
-    KVMState *s = KVM_STATE(current_accel());
+    KVMState *s = KVM_ACCEL(current_accel());
 
     return !kvm_vm_enable_cap(s, KVM_CAP_X2APIC_API, 0, flags);
 }
target/mips/kvm.c +1 -1
index 72637a1e02..30f9c0349a 100644
@@ -1277,7 +1277,7 @@ int mips_kvm_type(MachineState *machine, const char *vm_type)
 {
 #if defined(KVM_CAP_MIPS_VZ) || defined(KVM_CAP_MIPS_TE)
     int r;
-    KVMState *s = KVM_STATE(machine->accelerator);
+    KVMState *s = KVM_ACCEL(machine->accelerator);
 #endif
 
 #if defined(KVM_CAP_MIPS_VZ)
target/ppc/kvm.c +2 -2
index d85ba8ffe0..e446637137 100644
@@ -263,7 +263,7 @@ static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
 
 struct ppc_radix_page_info *kvm_get_radix_page_info(void)
 {
-    KVMState *s = KVM_STATE(current_accel());
+    KVMState *s = KVM_ACCEL(current_accel());
     struct ppc_radix_page_info *radix_page_info;
     struct kvm_ppc_rmmu_info rmmu_info;
     int i;
@@ -2943,7 +2943,7 @@ void kvmppc_svm_off(Error **errp)
         return;
     }
 
-    rc = kvm_vm_ioctl(KVM_STATE(current_accel()), KVM_PPC_SVM_OFF);
+    rc = kvm_vm_ioctl(KVM_ACCEL(current_accel()), KVM_PPC_SVM_OFF);
     if (rc && rc != -ENOTTY) {
         error_setg_errno(errp, -rc, "KVM_PPC_SVM_OFF ioctl failed");
     }
Signature · 1 line
2.26.2
#107 lore raw

PATCH 60/63 tcg: Rename TCG_STATE to TCG_ACCEL

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 accel/tcg/tcg-all.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
accel/tcg/tcg-all.c +7 -7
index 7098ad96c3..08d82e5c03 100644
@@ -46,7 +46,7 @@ typedef struct TCGState TCGState;
 
 #define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
 
-DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
+DECLARE_INSTANCE_CHECKER(TCGState, TCG_ACCEL,
                          TYPE_TCG_ACCEL)
 
 /* mask must never be zero, except for A20 change call */
@@ -118,14 +118,14 @@ static bool default_mttcg_enabled(void)
 
 static void tcg_accel_instance_init(Object *obj)
 {
-    TCGState *s = TCG_STATE(obj);
+    TCGState *s = TCG_ACCEL(obj);
 
     s->mttcg_enabled = default_mttcg_enabled();
 }
 
 static int tcg_init(MachineState *ms)
 {
-    TCGState *s = TCG_STATE(current_accel());
+    TCGState *s = TCG_ACCEL(current_accel());
 
     tcg_exec_init(s->tb_size * 1024 * 1024);
     cpu_interrupt_handler = tcg_handle_interrupt;
@@ -135,14 +135,14 @@ static int tcg_init(MachineState *ms)
 
 static char *tcg_get_thread(Object *obj, Error **errp)
 {
-    TCGState *s = TCG_STATE(obj);
+    TCGState *s = TCG_ACCEL(obj);
 
     return g_strdup(s->mttcg_enabled ? "multi" : "single");
 }
 
 static void tcg_set_thread(Object *obj, const char *value, Error **errp)
 {
-    TCGState *s = TCG_STATE(obj);
+    TCGState *s = TCG_ACCEL(obj);
 
     if (strcmp(value, "multi") == 0) {
         if (TCG_OVERSIZED_GUEST) {
@@ -172,7 +172,7 @@ static void tcg_get_tb_size(Object *obj, Visitor *v,
                             const char *name, void *opaque,
                             Error **errp)
 {
-    TCGState *s = TCG_STATE(obj);
+    TCGState *s = TCG_ACCEL(obj);
     uint32_t value = s->tb_size;
 
     visit_type_uint32(v, name, &value, errp);
@@ -182,7 +182,7 @@ static void tcg_set_tb_size(Object *obj, Visitor *v,
                             const char *name, void *opaque,
                             Error **errp)
 {
-    TCGState *s = TCG_STATE(obj);
+    TCGState *s = TCG_ACCEL(obj);
     uint32_t value;
 
     if (!visit_type_uint32(v, name, &value, errp)) {
Signature · 1 line
2.26.2
#108 lore raw

PATCH 61/63 tests: Rename TYPE_DUMMY to TYPE_DUMMY_OBJECT

In reply to Eduardo Habkost

This will make the type name constant consistent with the name of the type checking macro.

---
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 tests/check-qom-proplist.c | 30 +++++++++++++++---------------
 tests/test-io-task.c       | 14 +++++++-------
 2 files changed, 22 insertions(+), 22 deletions(-)
tests/check-qom-proplist.c +15 -15
index 1571606c1c..b4b31c57d3 100644
@@ -28,13 +28,13 @@
 #include "qom/object_interfaces.h"
 
 
-#define TYPE_DUMMY "qemu-dummy"
+#define TYPE_DUMMY_OBJECT "qemu-dummy"
 
 typedef struct DummyObject DummyObject;
 typedef struct DummyObjectClass DummyObjectClass;
 
 DECLARE_INSTANCE_CHECKER(DummyObject, DUMMY_OBJECT,
-                         TYPE_DUMMY)
+                         TYPE_DUMMY_OBJECT)
 
 typedef enum DummyAnimal DummyAnimal;
 
@@ -153,7 +153,7 @@ static void dummy_finalize(Object *obj)
 
 
 static const TypeInfo dummy_info = {
-    .name          = TYPE_DUMMY,
+    .name          = TYPE_DUMMY_OBJECT,
     .parent        = TYPE_OBJECT,
     .instance_size = sizeof(DummyObject),
     .instance_init = dummy_init,
@@ -337,7 +337,7 @@ static void test_dummy_createv(void)
     Error *err = NULL;
     Object *parent = object_get_objects_root();
     DummyObject *dobj = DUMMY_OBJECT(
-        object_new_with_props(TYPE_DUMMY,
+        object_new_with_props(TYPE_DUMMY_OBJECT,
                               parent,
                               "dummy0",
                               &err,
@@ -366,7 +366,7 @@ static Object *new_helper(Error **errp,
     Object *obj;
 
     va_start(vargs, parent);
-    obj = object_new_with_propv(TYPE_DUMMY,
+    obj = object_new_with_propv(TYPE_DUMMY_OBJECT,
                                 parent,
                                 "dummy0",
                                 errp,
@@ -403,7 +403,7 @@ static void test_dummy_createcmdl(void)
     QemuOpts *opts;
     DummyObject *dobj;
     Error *err = NULL;
-    const char *params = TYPE_DUMMY \
+    const char *params = TYPE_DUMMY_OBJECT \
                          ",id=dev0," \
                          "bv=yes,sv=Hiss hiss hiss,av=platypus";
 
@@ -443,7 +443,7 @@ static void test_dummy_badenum(void)
     Error *err = NULL;
     Object *parent = object_get_objects_root();
     Object *dobj =
-        object_new_with_props(TYPE_DUMMY,
+        object_new_with_props(TYPE_DUMMY_OBJECT,
                               parent,
                               "dummy0",
                               &err,
@@ -470,7 +470,7 @@ static void test_dummy_getenum(void)
     int val;
     Object *parent = object_get_objects_root();
     DummyObject *dobj = DUMMY_OBJECT(
-        object_new_with_props(TYPE_DUMMY,
+        object_new_with_props(TYPE_DUMMY_OBJECT,
                          parent,
                          "dummy0",
                          &err,
@@ -533,7 +533,7 @@ static void test_dummy_iterator(void)
         "bv"};                  /* instance property */
     Object *parent = object_get_objects_root();
     DummyObject *dobj = DUMMY_OBJECT(
-        object_new_with_props(TYPE_DUMMY,
+        object_new_with_props(TYPE_DUMMY_OBJECT,
                               parent,
                               "dummy0",
                               &error_abort,
@@ -552,7 +552,7 @@ static void test_dummy_class_iterator(void)
 {
     const char *expected[] = { "type", "av", "sv" };
     ObjectPropertyIterator iter;
-    ObjectClass *klass = object_class_by_name(TYPE_DUMMY);
+    ObjectClass *klass = object_class_by_name(TYPE_DUMMY_OBJECT);
 
     object_class_property_iter_init(&iter, klass);
     test_dummy_prop_iterator(&iter, expected, ARRAY_SIZE(expected));
@@ -575,9 +575,9 @@ static void test_qom_partial_path(void)
 {
     Object *root  = object_get_objects_root();
     Object *cont1 = container_get(root, "/cont1");
-    Object *obj1  = object_new(TYPE_DUMMY);
-    Object *obj2a = object_new(TYPE_DUMMY);
-    Object *obj2b = object_new(TYPE_DUMMY);
+    Object *obj1  = object_new(TYPE_DUMMY_OBJECT);
+    Object *obj2a = object_new(TYPE_DUMMY_OBJECT);
+    Object *obj2b = object_new(TYPE_DUMMY_OBJECT);
     bool ambiguous;
 
     /* Objects created:
@@ -594,9 +594,9 @@ static void test_qom_partial_path(void)
     object_unref(obj2b);
 
     ambiguous = false;
-    g_assert(!object_resolve_path_type("", TYPE_DUMMY, &ambiguous));
+    g_assert(!object_resolve_path_type("", TYPE_DUMMY_OBJECT, &ambiguous));
     g_assert(ambiguous);
-    g_assert(!object_resolve_path_type("", TYPE_DUMMY, NULL));
+    g_assert(!object_resolve_path_type("", TYPE_DUMMY_OBJECT, NULL));
 
     ambiguous = false;
     g_assert(!object_resolve_path("obj2", &ambiguous));
tests/test-io-task.c +7 -7
index 85e7a98da5..74b60f951a 100644
@@ -25,7 +25,7 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 
-#define TYPE_DUMMY "qemu:dummy"
+#define TYPE_DUMMY_OBJECT "qemu:dummy"
 
 typedef struct DummyObject DummyObject;
 typedef struct DummyObjectClass DummyObjectClass;
@@ -40,7 +40,7 @@ struct DummyObjectClass {
 
 static const TypeInfo dummy_info = {
     .parent = TYPE_OBJECT,
-    .name = TYPE_DUMMY,
+    .name = TYPE_DUMMY_OBJECT,
     .instance_size = sizeof(DummyObject),
     .class_size = sizeof(DummyObjectClass),
 };
@@ -65,7 +65,7 @@ static void task_callback(QIOTask *task,
 static void test_task_complete(void)
 {
     QIOTask *task;
-    Object *obj = object_new(TYPE_DUMMY);
+    Object *obj = object_new(TYPE_DUMMY_OBJECT);
     Object *src;
     struct TestTaskData data = { NULL, NULL, false };
 
@@ -95,7 +95,7 @@ static void task_data_free(gpointer opaque)
 static void test_task_data_free(void)
 {
     QIOTask *task;
-    Object *obj = object_new(TYPE_DUMMY);
+    Object *obj = object_new(TYPE_DUMMY_OBJECT);
     struct TestTaskData data = { NULL, NULL, false };
 
     task = qio_task_new(obj, task_callback, &data, task_data_free);
@@ -113,7 +113,7 @@ static void test_task_data_free(void)
 static void test_task_failure(void)
 {
     QIOTask *task;
-    Object *obj = object_new(TYPE_DUMMY);
+    Object *obj = object_new(TYPE_DUMMY_OBJECT);
     struct TestTaskData data = { NULL, NULL, false };
     Error *err = NULL;
 
@@ -174,7 +174,7 @@ static void test_task_thread_callback(QIOTask *task,
 static void test_task_thread_complete(void)
 {
     QIOTask *task;
-    Object *obj = object_new(TYPE_DUMMY);
+    Object *obj = object_new(TYPE_DUMMY_OBJECT);
     struct TestThreadWorkerData data = { 0 };
     GThread *self;
 
@@ -215,7 +215,7 @@ static void test_task_thread_complete(void)
 static void test_task_thread_failure(void)
 {
     QIOTask *task;
-    Object *obj = object_new(TYPE_DUMMY);
+    Object *obj = object_new(TYPE_DUMMY_OBJECT);
     struct TestThreadWorkerData data = { 0 };
     GThread *self;
 
Signature · 1 line
2.26.2
#109 lore raw

PATCH 62/63 tests: Rename DYNAMIC_TYPE to DYNAMIC_PROPS

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 tests/test-qdev-global-props.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/test-qdev-global-props.c +4 -4
index 8a3c14d92c..bf6b9fb2a2 100644
@@ -128,7 +128,7 @@ static void test_static_globalprop(void)
 }
 
 #define TYPE_DYNAMIC_PROPS "dynamic-prop-type"
-DECLARE_INSTANCE_CHECKER(MyType, DYNAMIC_TYPE,
+DECLARE_INSTANCE_CHECKER(MyType, DYNAMIC_PROPS,
                          TYPE_DYNAMIC_PROPS)
 
 #define TYPE_UNUSED_HOTPLUG   "hotplug-type"
@@ -137,7 +137,7 @@ DECLARE_INSTANCE_CHECKER(MyType, DYNAMIC_TYPE,
 static void prop1_accessor(Object *obj, Visitor *v, const char *name,
                            void *opaque, Error **errp)
 {
-    MyType *mt = DYNAMIC_TYPE(obj);
+    MyType *mt = DYNAMIC_PROPS(obj);
 
     visit_type_uint32(v, name, &mt->prop1, errp);
 }
@@ -145,7 +145,7 @@ static void prop1_accessor(Object *obj, Visitor *v, const char *name,
 static void prop2_accessor(Object *obj, Visitor *v, const char *name,
                            void *opaque, Error **errp)
 {
-    MyType *mt = DYNAMIC_TYPE(obj);
+    MyType *mt = DYNAMIC_PROPS(obj);
 
     visit_type_uint32(v, name, &mt->prop2, errp);
 }
@@ -230,7 +230,7 @@ static void test_dynamic_globalprop_subprocess(void)
 
     register_global_properties(props);
 
-    mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
+    mt = DYNAMIC_PROPS(object_new(TYPE_DYNAMIC_PROPS));
     qdev_realize(DEVICE(mt), NULL, &error_fatal);
 
     g_assert_cmpuint(mt->prop1, ==, 101);
Signature · 1 line
2.26.2
#110 lore raw

PATCH 63/63 tests: Rename STATIC_TYPE to STATIC_PROPS

In reply to Eduardo Habkost

Make the type checking macro name consistent with the TYPE_* constant.

---
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 tests/test-qdev-global-props.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/test-qdev-global-props.c +4 -4
index bf6b9fb2a2..ee4f561a5e 100644
@@ -32,7 +32,7 @@
 
 #define TYPE_STATIC_PROPS "static_prop_type"
 typedef struct MyType MyType;
-DECLARE_INSTANCE_CHECKER(MyType, STATIC_TYPE,
+DECLARE_INSTANCE_CHECKER(MyType, STATIC_PROPS,
                          TYPE_STATIC_PROPS)
 
 #define TYPE_SUBCLASS "static_prop_subtype"
@@ -77,7 +77,7 @@ static void test_static_prop_subprocess(void)
 {
     MyType *mt;
 
-    mt = STATIC_TYPE(object_new(TYPE_STATIC_PROPS));
+    mt = STATIC_PROPS(object_new(TYPE_STATIC_PROPS));
     qdev_realize(DEVICE(mt), NULL, &error_fatal);
 
     g_assert_cmpuint(mt->prop1, ==, PROP_DEFAULT);
@@ -112,7 +112,7 @@ static void test_static_globalprop_subprocess(void)
 
     register_global_properties(props);
 
-    mt = STATIC_TYPE(object_new(TYPE_STATIC_PROPS));
+    mt = STATIC_PROPS(object_new(TYPE_STATIC_PROPS));
     qdev_realize(DEVICE(mt), NULL, &error_fatal);
 
     g_assert_cmpuint(mt->prop1, ==, 200);
@@ -273,7 +273,7 @@ static void test_subclass_global_props(void)
 
     register_global_properties(props);
 
-    mt = STATIC_TYPE(object_new(TYPE_SUBCLASS));
+    mt = STATIC_PROPS(object_new(TYPE_SUBCLASS));
     qdev_realize(DEVICE(mt), NULL, &error_fatal);
 
     g_assert_cmpuint(mt->prop1, ==, 102);
Signature · 1 line
2.26.2
#111 lore raw
In reply to Eduardo Habkost
Quoted 10 lines · Eduardo Habkost

Reducing boilerplate QOM code using the new OBJECT_DEFINE_* and OBJECT_DECLARE_* macros is quite difficult when there are multiple ways a TYPE_* constant name is written.

This series renames many type checking macros and/or TYPE_* constants to make sure they are consistent.

This series is based on machine-next and can be fetched from:

https://github.com/ehabkost/qemu-hacks work/qom-rename-macros

I'm queueing:

[PATCH 01/63] gpex: Fix type checking function name
[PATCH 02/63] chardev: Rename TYPE_CHARDEV_* to TYPE_*_CHARDEV [PATCH 05/63] ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE [PATCH 06/63] dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV [PATCH 08/63] vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE [PATCH 10/63] vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID [PATCH 32/63] ahci: Rename ICH_AHCI to ICH9_AHCI
[PATCH 39/63] esp: Rename ESP_STATE to ESP
[PATCH 40/63] filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER [PATCH 47/63] rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC [PATCH 48/63] sabre: Rename SABRE_DEVICE to SABRE
[PATCH 53/63] usb: Rename USB_SERIAL_DEV to USB_SERIAL
[PATCH 55/63] vfio: Rename PCI_VFIO to VFIO_PCI

Signature · 1 line
Eduardo