[Qemu-devel] [RFC PATCH 0/3] add helpers to be more explicit when using QOM abstract parent hooks

Philippe Mathieu-Daudé posted 3 patches 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180114020412.26160-1-f4bug@amsat.org
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
include/hw/qdev-core.h             | 14 ++++++++++++--
hw/core/qdev.c                     | 24 ++++++++++++++++++++++++
hw/i386/kvm/i8254.c                |  4 ++--
hw/i386/kvm/i8259.c                |  3 +--
hw/input/adb-kbd.c                 |  4 ++--
hw/input/adb-mouse.c               |  4 ++--
hw/intc/arm_gic.c                  |  3 +--
hw/intc/arm_gic_kvm.c              |  7 +++----
hw/intc/arm_gicv3.c                |  3 +--
hw/intc/arm_gicv3_its_kvm.c        |  3 +--
hw/intc/arm_gicv3_kvm.c            |  7 +++----
hw/intc/i8259.c                    |  3 +--
hw/net/vmxnet3.c                   |  4 ++--
hw/pci-bridge/gen_pcie_root_port.c |  3 +--
hw/scsi/vmw_pvscsi.c               |  4 ++--
hw/timer/i8254.c                   |  3 +--
hw/vfio/amd-xgbe.c                 |  4 ++--
hw/vfio/calxeda-xgmac.c            |  4 ++--
hw/virtio/virtio-pci.c             |  4 ++--
target/alpha/cpu.c                 |  4 ++--
target/arm/cpu.c                   |  4 ++--
target/cris/cpu.c                  |  4 ++--
target/hppa/cpu.c                  |  4 ++--
target/i386/cpu.c                  |  8 ++++----
target/lm32/cpu.c                  |  5 ++---
target/m68k/cpu.c                  |  5 ++---
target/microblaze/cpu.c            |  5 ++---
target/mips/cpu.c                  |  5 ++---
target/moxie/cpu.c                 |  5 ++---
target/nios2/cpu.c                 |  4 ++--
target/openrisc/cpu.c              |  5 ++---
target/ppc/translate_init.c        |  8 ++++----
target/s390x/cpu.c                 |  4 ++--
target/sh4/cpu.c                   |  4 ++--
target/sparc/cpu.c                 |  4 ++--
target/tilegx/cpu.c                |  4 ++--
target/tricore/cpu.c               |  4 ++--
target/unicore32/cpu.c             |  4 ++--
target/xtensa/cpu.c                |  4 ++--
39 files changed, 109 insertions(+), 90 deletions(-)
[Qemu-devel] [RFC PATCH 0/3] add helpers to be more explicit when using QOM abstract parent hooks
Posted by Philippe Mathieu-Daudé 6 years, 3 months ago
Hi,

Learning how to implement QOM devices I found the pattern changing parent hooks
when the parent is abstract not trivial to understand.

This series add few helpers to have this pattern more explicit.

Those functions deserve some comments, but before spending more time I'd like
to get some feedbacks if this might be useful or not.
If so, I can split the 3rd patch in many patches for each subsystem maintainers.

This can also be use for the CPUClass->reset() method, dunno if useful but
maybe to be consistent.

Regards,

Phil.

Philippe Mathieu-Daudé (3):
  qdev: rename typedef qdev_resetfn() -> DeviceReset()
  qdev: add helpers to be more explicit when using abstract QOM parent functions
  qdev: use device_class_set_parent_realize/unrealize/reset()

 include/hw/qdev-core.h             | 14 ++++++++++++--
 hw/core/qdev.c                     | 24 ++++++++++++++++++++++++
 hw/i386/kvm/i8254.c                |  4 ++--
 hw/i386/kvm/i8259.c                |  3 +--
 hw/input/adb-kbd.c                 |  4 ++--
 hw/input/adb-mouse.c               |  4 ++--
 hw/intc/arm_gic.c                  |  3 +--
 hw/intc/arm_gic_kvm.c              |  7 +++----
 hw/intc/arm_gicv3.c                |  3 +--
 hw/intc/arm_gicv3_its_kvm.c        |  3 +--
 hw/intc/arm_gicv3_kvm.c            |  7 +++----
 hw/intc/i8259.c                    |  3 +--
 hw/net/vmxnet3.c                   |  4 ++--
 hw/pci-bridge/gen_pcie_root_port.c |  3 +--
 hw/scsi/vmw_pvscsi.c               |  4 ++--
 hw/timer/i8254.c                   |  3 +--
 hw/vfio/amd-xgbe.c                 |  4 ++--
 hw/vfio/calxeda-xgmac.c            |  4 ++--
 hw/virtio/virtio-pci.c             |  4 ++--
 target/alpha/cpu.c                 |  4 ++--
 target/arm/cpu.c                   |  4 ++--
 target/cris/cpu.c                  |  4 ++--
 target/hppa/cpu.c                  |  4 ++--
 target/i386/cpu.c                  |  8 ++++----
 target/lm32/cpu.c                  |  5 ++---
 target/m68k/cpu.c                  |  5 ++---
 target/microblaze/cpu.c            |  5 ++---
 target/mips/cpu.c                  |  5 ++---
 target/moxie/cpu.c                 |  5 ++---
 target/nios2/cpu.c                 |  4 ++--
 target/openrisc/cpu.c              |  5 ++---
 target/ppc/translate_init.c        |  8 ++++----
 target/s390x/cpu.c                 |  4 ++--
 target/sh4/cpu.c                   |  4 ++--
 target/sparc/cpu.c                 |  4 ++--
 target/tilegx/cpu.c                |  4 ++--
 target/tricore/cpu.c               |  4 ++--
 target/unicore32/cpu.c             |  4 ++--
 target/xtensa/cpu.c                |  4 ++--
 39 files changed, 109 insertions(+), 90 deletions(-)

-- 
2.15.1


Re: [Qemu-devel] [RFC PATCH 0/3] add helpers to be more explicit when using QOM abstract parent hooks
Posted by Paolo Bonzini 6 years, 3 months ago
On 14/01/2018 03:04, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> Learning how to implement QOM devices I found the pattern changing parent hooks
> when the parent is abstract not trivial to understand.
> 
> This series add few helpers to have this pattern more explicit.
> 
> Those functions deserve some comments, but before spending more time I'd like
> to get some feedbacks if this might be useful or not.
> If so, I can split the 3rd patch in many patches for each subsystem maintainers.
> 
> This can also be use for the CPUClass->reset() method, dunno if useful but
> maybe to be consistent.

Queued, thanks.

Paolo