All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Ani Sinha" <anisinha@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	devel@lists.libvirt.org
Subject: Re: [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE
Date: Thu, 19 Dec 2024 16:59:45 +0000	[thread overview]
Message-ID: <Z2RRARwT282Rj0aN@redhat.com> (raw)
In-Reply-To: <20241219153857.57450-5-philmd@linaro.org>

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 :|



  reply	other threads:[~2024-12-19 17:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 15:38 [RFC PATCH 00/10] hw/misc/vmcoreinfo: Convert from QDev to plain Object Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH 01/10] hw/misc/vmcoreinfo: Declare QOM type using DEFINE_TYPES macro Philippe Mathieu-Daudé
2024-12-19 16:54   ` Daniel P. Berrangé
2024-12-19 15:38 ` [RFC PATCH 02/10] hw/misc/vmcoreinfo: Rename opaque pointer as 'opaque' Philippe Mathieu-Daudé
2024-12-19 16:55   ` Daniel P. Berrangé
2024-12-19 15:38 ` [RFC PATCH 03/10] hw/misc/vmcoreinfo: Un-inline vmcoreinfo_find() Philippe Mathieu-Daudé
2024-12-19 16:57   ` Daniel P. Berrangé
2024-12-19 15:38 ` [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE Philippe Mathieu-Daudé
2024-12-19 16:59   ` Daniel P. Berrangé [this message]
2024-12-19 17:12     ` Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH 05/10] hw/misc/vmcoreinfo: Convert to three-phase reset interface Philippe Mathieu-Daudé
2024-12-19 17:00   ` Daniel P. Berrangé
2024-12-19 15:38 ` [RFC PATCH 06/10] hw/misc/vmcoreinfo: Move vmstate_vmcoreinfo[] around Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH 07/10] hw/misc/vmcoreinfo: Factor vmcoreinfo_device_realize() out Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH 08/10] hw/misc/vmcoreinfo: Implement 'vmcore-info' object Philippe Mathieu-Daudé
2024-12-20  8:50   ` Marc-André Lureau
2024-12-20 10:53     ` Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH 09/10] hw/misc/vmcoreinfo: Deprecate '-device vmcoreinfo' Philippe Mathieu-Daudé
2024-12-19 15:38 ` [RFC PATCH-for-10.2 10/10] hw/misc/vmcoreinfo: Remove legacy " Philippe Mathieu-Daudé
2024-12-19 15:57 ` [RFC PATCH 00/10] hw/misc/vmcoreinfo: Convert from QDev to plain Object Daniel P. Berrangé
2024-12-19 16:19   ` Ani Sinha
2024-12-19 16:48   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z2RRARwT282Rj0aN@redhat.com \
    --to=berrange@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.