diff mbox series

[v4,21/32] qdev: Add name argument to PropertyInfo.create method

Message ID 20201211220529.2290218-22-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show
Series qdev property code cleanup | expand

Commit Message

Eduardo Habkost Dec. 11, 2020, 10:05 p.m. UTC
This will make it easier to remove the Property.name field in the
future.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
This is a new patch added in series v2
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
 include/hw/qdev-properties.h | 2 +-
 hw/core/qdev-properties.c    | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Igor Mammedov Dec. 14, 2020, 2:47 p.m. UTC | #1
On Fri, 11 Dec 2020 17:05:18 -0500
Eduardo Habkost <ehabkost@redhat.com> wrote:

> This will make it easier to remove the Property.name field in the
> future.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> This is a new patch added in series v2
> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  include/hw/qdev-properties.h | 2 +-
>  hw/core/qdev-properties.c    | 7 ++++---
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> index 476737b9da..ab9c538ba4 100644
> --- a/include/hw/qdev-properties.h
> +++ b/include/hw/qdev-properties.h
> @@ -34,7 +34,7 @@ struct PropertyInfo {
>      const QEnumLookup *enum_table;
>      int (*print)(Object *obj, Property *prop, char *dest, size_t len);
>      void (*set_default_value)(ObjectProperty *op, const Property *prop);
> -    void (*create)(ObjectClass *oc, Property *prop);
> +    void (*create)(ObjectClass *oc, const char *name, Property *prop);
>      ObjectPropertyAccessor *get;
>      ObjectPropertyAccessor *set;
>      ObjectPropertyRelease *release;
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 457c7fe4ba..c68a20695d 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -851,9 +851,10 @@ const PropertyInfo qdev_prop_size = {
>  
>  /* --- object link property --- */
>  
> -static void create_link_property(ObjectClass *oc, Property *prop)
> +static void create_link_property(ObjectClass *oc, const char *name,
> +                                 Property *prop)
>  {
> -    object_class_property_add_link(oc, prop->name, prop->link_type,
> +    object_class_property_add_link(oc, name, prop->link_type,
>                                     prop->offset,
>                                     qdev_prop_allow_set_link_before_realize,
>                                     OBJ_PROP_LINK_STRONG);
> @@ -893,7 +894,7 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name,
>      ObjectClass *oc = OBJECT_CLASS(klass);
>  
>      if (prop->info->create) {
> -        prop->info->create(oc, prop);
> +        prop->info->create(oc, name, prop);
>      } else {
>          ObjectProperty *op;
>
diff mbox series

Patch

diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 476737b9da..ab9c538ba4 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -34,7 +34,7 @@  struct PropertyInfo {
     const QEnumLookup *enum_table;
     int (*print)(Object *obj, Property *prop, char *dest, size_t len);
     void (*set_default_value)(ObjectProperty *op, const Property *prop);
-    void (*create)(ObjectClass *oc, Property *prop);
+    void (*create)(ObjectClass *oc, const char *name, Property *prop);
     ObjectPropertyAccessor *get;
     ObjectPropertyAccessor *set;
     ObjectPropertyRelease *release;
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 457c7fe4ba..c68a20695d 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -851,9 +851,10 @@  const PropertyInfo qdev_prop_size = {
 
 /* --- object link property --- */
 
-static void create_link_property(ObjectClass *oc, Property *prop)
+static void create_link_property(ObjectClass *oc, const char *name,
+                                 Property *prop)
 {
-    object_class_property_add_link(oc, prop->name, prop->link_type,
+    object_class_property_add_link(oc, name, prop->link_type,
                                    prop->offset,
                                    qdev_prop_allow_set_link_before_realize,
                                    OBJ_PROP_LINK_STRONG);
@@ -893,7 +894,7 @@  static void qdev_class_add_property(DeviceClass *klass, const char *name,
     ObjectClass *oc = OBJECT_CLASS(klass);
 
     if (prop->info->create) {
-        prop->info->create(oc, prop);
+        prop->info->create(oc, name, prop);
     } else {
         ObjectProperty *op;