Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> --- include/hw/misc/vmcoreinfo.h | 13 ++++++------- hw/misc/vmcoreinfo.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index 0b7b55d400a..da1066d540c 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -30,12 +30,11 @@ struct VMCoreInfoState { FWCfgVMCoreInfo vmcoreinfo; }; -/* returns NULL unless there is exactly one device */ -static inline VMCoreInfoState *vmcoreinfo_find(void) -{ - Object *o = object_resolve_path_type("", VMCOREINFO_DEVICE, NULL); - - return o ? VMCOREINFO(o) : NULL; -} +/** + * vmcoreinfo_find: + * + * Returns NULL unless there is exactly one instance. + */ +VMCoreInfoState *vmcoreinfo_find(void); #endif diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index ad5a4dec596..c5bb5c9fa52 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -42,11 +42,12 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp) /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; - /* Given that this function is executing, there is at least one VMCOREINFO - * device. Check if there are several. + /* + * Given that this function is executing, there is at least one + * VMCOREINFO instance. Check if there are several. */ if (!vmcoreinfo_find()) { - error_setg(errp, "at most one %s device is permitted", + error_setg(errp, "at most one %s instance is permitted", VMCOREINFO_DEVICE); return; } @@ -103,3 +104,12 @@ static const TypeInfo vmcoreinfo_types[] = { }; DEFINE_TYPES(vmcoreinfo_types) + +VMCoreInfoState *vmcoreinfo_find(void) +{ + Object *obj; + + obj = object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + + return obj ? (VMCoreInfoState *)obj : NULL; +} -- 2.47.1