[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TY
From: |
Daniel P . Berrangé |
Subject: |
Re: [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE |
Date: |
Thu, 19 Dec 2024 16:59:45 +0000 |
User-agent: |
Mutt/2.2.13 (2024-03-09) |
On Thu, Dec 19, 2024 at 04:38:51PM +0100, Philippe Mathieu-Daudé wrote:
> Follow the assumed QOM type definition style, prefixing with 'TYPE_'.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/misc/vmcoreinfo.h | 6 +++---
> hw/misc/vmcoreinfo.c | 8 ++++----
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h
> index da1066d540c..122c69686b0 100644
> --- a/include/hw/misc/vmcoreinfo.h
> +++ b/include/hw/misc/vmcoreinfo.h
> @@ -16,10 +16,10 @@
> #include "standard-headers/linux/qemu_fw_cfg.h"
> #include "qom/object.h"
>
> -#define VMCOREINFO_DEVICE "vmcoreinfo"
> +#define TYPE_VMCOREINFO_DEVICE "vmcoreinfo"
Yes to adding TYPE_, but while there would also
drop _DEVICE. IMHO the best practice is for
TYPE_<NNNN> where NNNN matches the "nnnn" name.
An extra suffix doesn't add value, unless we've
got some other symbol clashing which is almost
never the case.
> typedef struct VMCoreInfoState VMCoreInfoState;
> -DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO,
> - VMCOREINFO_DEVICE)
> +DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO_DEVICE,
> + TYPE_VMCOREINFO_DEVICE)
>
> typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo;
>
> diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
> index c5bb5c9fa52..9822615cfed 100644
> --- a/hw/misc/vmcoreinfo.c
> +++ b/hw/misc/vmcoreinfo.c
> @@ -37,7 +37,7 @@ static void vmcoreinfo_reset(void *opaque)
>
> static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
> {
> - VMCoreInfoState *s = VMCOREINFO(dev);
> + 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;
> @@ -48,13 +48,13 @@ static void vmcoreinfo_realize(DeviceState *dev, Error
> **errp)
> */
> if (!vmcoreinfo_find()) {
> error_setg(errp, "at most one %s instance is permitted",
> - VMCOREINFO_DEVICE);
> + TYPE_VMCOREINFO_DEVICE);
> return;
> }
>
> if (!fw_cfg || !fw_cfg->dma_enabled) {
> error_setg(errp, "%s device requires fw_cfg with DMA",
> - VMCOREINFO_DEVICE);
> + TYPE_VMCOREINFO_DEVICE);
> return;
> }
>
> @@ -96,7 +96,7 @@ static void vmcoreinfo_device_class_init(ObjectClass
> *klass, void *data)
>
> static const TypeInfo vmcoreinfo_types[] = {
> {
> - .name = VMCOREINFO_DEVICE,
> + .name = TYPE_VMCOREINFO_DEVICE,
> .parent = TYPE_DEVICE,
> .instance_size = sizeof(VMCoreInfoState),
> .class_init = vmcoreinfo_device_class_init,
> --
> 2.47.1
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [RFC PATCH 00/10] hw/misc/vmcoreinfo: Convert from QDev to plain Object, Philippe Mathieu-Daudé, 2024/12/19
- [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
- Re: [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE,
Daniel P . Berrangé <=
- [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é, 2024/12/19
- [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