Hello, This series finally eliminates the FROM_SYSBUS() macro. It goes on to fix remaining ->qdev field accesses (less work than I thought).
I've been pushing out device patches ASAP to give them maximum review hours, now here follows the rationale why I made this effort: i) Murphy's Law When there's two ways to write a device and one is considered obsolete, someone at some point will apply a new device using FROM_SYSBUS(). ii) Broken Window theory If we let devices languish in an obsolete state, then someone will refuse to update their device patch, pointing that it is no worse than in-tree devices. (Ignoring that it makes it even more work for others to convert, who don't know the code and how to best name the new macros.) iii) Why for-1.6? Once the Hard Freeze is lifted, traditionally we will see submaintainers quickly flushing their queues, with arm-devs.next, ppc-next and others potentially adding devices using FROM_SYSBUS() or other deprecated constructs. Applying these cleanups for v1.6-rc0 will lead to build failures for most obsolete constructs and thereby more fairly distributing the work of rebasing and/or bouncing patches among submaintainers. Experience shows that posting such touch-all series to the list and waiting for weeks does not give each device/target test coverage by reviewers; having it in qemu.git and -rcX will more likely uncover bugs through testing. In most cases only initialization and reset will be affected, so we should see failures immediately. Fixing bugs should be trivial, and I am around to do so. Bleading-edge version tree available for testing here: git://github.com/afaerber/qemu-cpu.git qom-devices https://github.com/afaerber/qemu-cpu/commits/qom-devices iv) What's up next? Many preceding SysBusDevice conversion patches grew a DeviceState *dev variable to prepare for conversion to QOM realize: dev variable and sbd argument will simply switch place, avoiding variable renaming along with functional changes. Loved by some, loathed by others, SysBusDevices are the simplest because no initialization/unintialization really happens at bus level (there is no bus). PCIDevice and others with multiple levels of initfn are waiting on proposals under discussion of how to efficiently call the parent's method implementation. I plan to submit a RFC inspired by Peter C.'s work for ISA/CPU/virtio. Implementing QOM CPU topologies for x86, s390x and arm SoCs requires recursive realization - offloading that to QOM infrastructure won't make it into 1.6. So all devices being worked on still need to manually realize their children where they qdev_init()ed them before, violating the same ordering constraints Paolo brought up for the infrastructure-based approach. Feedback appreciated. Embedding busses still faces challenges wrt device ID and VMState to be solved. Peter M. has an RFC for how to allow embedding structs while shielding fields. A script to inspect the QOM tree similar to qtree may come increasingly handy the more we think about devices not on a bus or actually using the composition model we've been building up for ACPI or qtests. qtests will come very handy the more devices we touch. Having each machine covered by some test would be a start, having each non-default device covered even better, and be it no-op to exercise instantiation, hot-add/remove a bonus. Probably many other QOM TODOs not on my mind right now. :-) Regards, Andreas Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Hu Tao <hu...@cn.fujitsu.com> Cc: Peter Crosthwaite <peter.crosthwa...@xilinx.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Peter Maydell <peter.mayd...@linaro.org> Andreas Färber (11): sysbus: Drop FROM_SYSBUS() sysbus: Remove unused sysbus_new() prototype exynos4210_i2c: QOM cast cleanup opencores_eth: QOM cast cleanup mipsnet: QOM cast cleanup kvmvapic: QOM cast cleanup kvm/ioapic: QOM cast cleanup ioapic: QOM cast cleanup mips_malta: QOM cast cleanup spapr_pci: QOM cast cleanup sysbus: QOM parent field cleanup for SysBusDevice hw/i2c/exynos4210_i2c.c | 12 +++++++----- hw/i386/kvm/ioapic.c | 4 ++-- hw/i386/kvmvapic.c | 4 ++-- hw/intc/ioapic.c | 2 +- hw/mips/mips_malta.c | 12 ++++++++---- hw/net/mipsnet.c | 20 ++++++++++++-------- hw/net/opencores_eth.c | 24 +++++++++++++++--------- hw/ppc/spapr_pci.c | 7 ++++--- include/hw/sysbus.h | 9 ++++----- 9 files changed, 55 insertions(+), 39 deletions(-) -- 1.8.1.4