[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 07/10] hw/misc/vmcoreinfo: Factor vmcoreinfo_device_realize()
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 07/10] hw/misc/vmcoreinfo: Factor vmcoreinfo_device_realize() out |
Date: |
Thu, 19 Dec 2024 16:38:54 +0100 |
In preparation of implementing a UserCreatable callback
in the next commit, factor vmcoreinfo_device_realize() out.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/misc/vmcoreinfo.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
index 55f9d437a94..a0511ea0da4 100644
--- a/hw/misc/vmcoreinfo.c
+++ b/hw/misc/vmcoreinfo.c
@@ -49,9 +49,8 @@ static void vmcoreinfo_reset_hold(Object *obj, ResetType type)
s->vmcoreinfo.host_format = cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF);
}
-static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
+static void vmcoreinfo_realize(VMCoreInfoState *s, Error **errp)
{
- VMCoreInfoState *s = VMCOREINFO_DEVICE(dev);
FWCfgState *fw_cfg = fw_cfg_find();
/* for gdb script dump-guest-memory.py */
static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED;
@@ -84,13 +83,18 @@ static void vmcoreinfo_realize(DeviceState *dev, Error
**errp)
vmcoreinfo_state = s;
}
+static void vmcoreinfo_device_realize(DeviceState *dev, Error **errp)
+{
+ vmcoreinfo_realize(VMCOREINFO_DEVICE(dev), errp);
+}
+
static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->vmsd = &vmstate_vmcoreinfo;
- dc->realize = vmcoreinfo_realize;
+ dc->realize = vmcoreinfo_device_realize;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
rc->phases.hold = vmcoreinfo_reset_hold;
--
2.47.1
- [RFC PATCH 03/10] hw/misc/vmcoreinfo: Un-inline vmcoreinfo_find(), (continued)
- [RFC PATCH 03/10] hw/misc/vmcoreinfo: Un-inline vmcoreinfo_find(), Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 01/10] hw/misc/vmcoreinfo: Declare QOM type using DEFINE_TYPES macro, Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE, Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 09/10] hw/misc/vmcoreinfo: Deprecate '-device vmcoreinfo', Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 05/10] hw/misc/vmcoreinfo: Convert to three-phase reset interface, Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 07/10] hw/misc/vmcoreinfo: Factor vmcoreinfo_device_realize() out,
Philippe Mathieu-Daudé <=
- [RFC PATCH 02/10] hw/misc/vmcoreinfo: Rename opaque pointer as 'opaque', Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 08/10] hw/misc/vmcoreinfo: Implement 'vmcore-info' object, Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH-for-10.2 10/10] hw/misc/vmcoreinfo: Remove legacy '-device vmcoreinfo', Philippe Mathieu-Daudé, 2024/12/19
- [RFC PATCH 06/10] hw/misc/vmcoreinfo: Move vmstate_vmcoreinfo[] around, Philippe Mathieu-Daudé, 2024/12/19
- Re: [RFC PATCH 00/10] hw/misc/vmcoreinfo: Convert from QDev to plain Object, Daniel P . Berrangé, 2024/12/19