[Qemu-devel] [PATCH v3 0/2] vl.c: make current_machine as non-global variable

Like Xu posted 2 patches 6 days ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1555315185-16414-1-git-send-email-like.xu@linux.intel.com
accel/kvm/kvm-all.c    |  6 ++++--
device-hotplug.c       |  3 ++-
device_tree.c          |  3 ++-
exec.c                 |  6 ++++--
hw/core/qdev.c         | 16 +++++++++++++---
hw/ppc/spapr_rtas.c    |  3 ++-
include/hw/boards.h    |  1 -
include/hw/qdev-core.h |  1 +
migration/savevm.c     |  9 ++++++---
qmp.c                  |  3 ++-
qom/cpu.c              |  5 +++--
target/i386/kvm.c      |  3 ++-
target/ppc/kvm.c       |  3 ++-
vl.c                   |  4 ++--
14 files changed, 45 insertions(+), 21 deletions(-)

[Qemu-devel] [PATCH v3 0/2] vl.c: make current_machine as non-global variable

Posted by Like Xu 6 days ago
This patch makes the remaining dozen or so uses of the global
current_machine outside vl.c use qdev_get_machine() instead,
and then make current_machine local to vl.c instead of global.

With type assertion in qdev_get_machine(), it will be hard to
misuse this function if machine hasn't been created yet.
For obj-common cases, qdev_get_machine_uncheck() is applied
without semantic change.

---
Changes in v3:
    - add TYPE_MACHINE assertion for qdev_get_machine() usage
    - apply qdev_get_machine_uncheck() for obj-common usage
Changes in v2:
    - make the variable current_machine "static" (Thomas Huth)

Like Xu (2):
  vl.c: refactor current_machine as non-global variable
  core/qdev: refactor qdev_get_machine() with type assertion

 accel/kvm/kvm-all.c    |  6 ++++--
 device-hotplug.c       |  3 ++-
 device_tree.c          |  3 ++-
 exec.c                 |  6 ++++--
 hw/core/qdev.c         | 16 +++++++++++++---
 hw/ppc/spapr_rtas.c    |  3 ++-
 include/hw/boards.h    |  1 -
 include/hw/qdev-core.h |  1 +
 migration/savevm.c     |  9 ++++++---
 qmp.c                  |  3 ++-
 qom/cpu.c              |  5 +++--
 target/i386/kvm.c      |  3 ++-
 target/ppc/kvm.c       |  3 ++-
 vl.c                   |  4 ++--
 14 files changed, 45 insertions(+), 21 deletions(-)

-- 
1.8.3.1