hi On 2026-05-21 08:07:39+02:00, Philippe Mathieu-Daudé wrote: > 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/.
We could, but there is not much benefit. The function is still HMP specific, and the point is to have HMP-only code clearly identifed and compiled out.
