On 20/5/26 23:49, Marc-André Lureau wrote:
The print_dev callback is only used by HMP 'info qtree'. Guard the field
in BusClass, all implementations, and the caller with CONFIG_HMP.
Signed-off-by: Marc-André Lureau <[email protected]>
---
include/hw/core/qdev.h | 2 ++
hw/char/virtio-serial-bus.c | 6 ++++++
hw/core/sysbus.c | 6 ++++++
hw/misc/auxbus.c | 16 +++++++++++-----
hw/pci/pci-hmp-cmds.c | 2 ++
hw/pci/pci.c | 2 ++
hw/usb/bus.c | 6 ++++++
hw/xen/xen-bus.c | 4 ++++
system/qdev-monitor.c | 2 ++
9 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index e1476223411..22dd143acf0 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -322,8 +322,10 @@ DECLARE_OBJ_CHECKERS(BusState, BusClass,
struct BusClass {
ObjectClass parent_class;
+#ifdef CONFIG_HMP
/* FIXME first arg should be BusState */
void (*print_dev)(Monitor *mon, DeviceState *dev, int indent);
We should fill a GString instead, avoiding the need of #ifdef'ry in hw/.
+#endif
/*
* Return a newly allocated string containing the path of the
* device on this bus.