qdev: Avoid using prop->name unnecessarily

We already get the property name as argument to the property
getter and setters, we don't need to use prop->name.  This will
make it easier to remove the Property.name field in the future.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20201211220529.2290218-20-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-12-11 17:05:16 -05:00
parent e68c2cb75a
commit 991f0ac901
3 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
s = qemu_find_tpm_be(str); s = qemu_find_tpm_be(str);
if (s == NULL) { if (s == NULL) {
error_setg(errp, "Property '%s.%s' can't find value '%s'", error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(obj), prop->name, str); object_get_typename(obj), name, str);
} else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) { } else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) {
*be = s; /* weak reference, avoid cyclic ref */ *be = s; /* weak reference, avoid cyclic ref */
} }

View File

@ -141,7 +141,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
} }
if (!blk) { if (!blk) {
error_setg(errp, "Property '%s.%s' can't find value '%s'", error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(OBJECT(dev)), prop->name, str); object_get_typename(OBJECT(dev)), name, str);
goto fail; goto fail;
} }
if (blk_attach_dev(blk, dev) < 0) { if (blk_attach_dev(blk, dev) < 0) {
@ -262,10 +262,10 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
s = qemu_chr_find(str); s = qemu_chr_find(str);
if (s == NULL) { if (s == NULL) {
error_setg(errp, "Property '%s.%s' can't find value '%s'", error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(obj), prop->name, str); object_get_typename(obj), name, str);
} else if (!qemu_chr_fe_init(be, s, errp)) { } else if (!qemu_chr_fe_init(be, s, errp)) {
error_prepend(errp, "Property '%s.%s' can't take value '%s': ", error_prepend(errp, "Property '%s.%s' can't take value '%s': ",
object_get_typename(obj), prop->name, str); object_get_typename(obj), name, str);
} }
g_free(str); g_free(str);
} }
@ -966,7 +966,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
abort(); abort();
} }
visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp); visit_type_enum(v, name, &speed, prop->info->enum_table, errp);
} }
static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
@ -982,7 +982,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
return; return;
} }
if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, if (!visit_type_enum(v, name, &speed, prop->info->enum_table,
errp)) { errp)) {
return; return;
} }
@ -1051,7 +1051,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
abort(); abort();
} }
visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp); visit_type_enum(v, name, &width, prop->info->enum_table, errp);
} }
static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
@ -1067,7 +1067,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
return; return;
} }
if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, if (!visit_type_enum(v, name, &width, prop->info->enum_table,
errp)) { errp)) {
return; return;
} }

View File

@ -50,7 +50,7 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
Property *prop = opaque; Property *prop = opaque;
int *ptr = qdev_get_prop_ptr(obj, prop); int *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); visit_type_enum(v, name, ptr, prop->info->enum_table, errp);
} }
void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
@ -65,7 +65,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
return; return;
} }
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); visit_type_enum(v, name, ptr, prop->info->enum_table, errp);
} }
void qdev_propinfo_set_default_value_enum(ObjectProperty *op, void qdev_propinfo_set_default_value_enum(ObjectProperty *op,