qom/qdev: associate properties with QAPI types fixups
cover qom/qdev: associate properties with QAPI types fixups
Marc-André missed one property, I lost two in my butchering of his work, and we both missed alias class properties. Not too bad for such a big series, I think.
Markus Armbruster (4):
target/riscv: Fix up PropertyInfo to set @qapi_type hw/gpio/pca9552: Fix @type of pca9552 property led<N>
hw: Fix up PropertyInfo to set @qapi_type
qom: Convert alias properties to QAPI-aware registration
hw/gpio/pca9552.c | 5 +++-- hw/gpio/pca9554.c | 5 +++-- qom/object.c | 7 ++++--- target/riscv/cpu.c | 1 + 4 files changed, 11 insertions(+), 7 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/4 target/riscv: Fix up PropertyInfo to set @qapi_type
When we recently updated PropertyInfo to set @qapi_type, we missed one. Update it now.
--- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
@@ -2075,6 +2075,7 @@ static void prop_vlen_get(Object *obj, Visitor *v, const char *name,static const PropertyInfo prop_vlen = { .type ="uint16" , + .qapi_type = &uint16_type_info, .description ="vlen" , .get = prop_vlen_get, .set = prop_vlen_set,
Signature · 1 line
2.55.0
PATCH 2/4 hw/gpio/pca9552: Fix @type of pca9552 property led<N>
In reply to Markus Armbrusterpca955x_initfn() passes @type "bool" to object_property_add(). The properties are actually string-typed: pca955x_get_led() and pca955x_set_led() use visit_type_str(). Pass "str" instead.
--- hw/gpio/pca9552.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/pca9552.c +1 -1
@@ -567,7 +567,7 @@ static void pca955x_initfn(Object *obj)if (k->has_led_support) {/* LED variant: expose the LED selector state as led%d. */ name =g_strdup_printf ("led%d" , ix); -object_property_add (obj, name,"bool" ,NULL , +object_property_add (obj, name,"str" ,NULL , pca955x_get_led, pca955x_set_led,NULL ,NULL ); }else {/* GPIO variant: expose the pin logic level as pin%d. */
Signature · 1 line
2.55.0
Re: [PATCH 2/4] hw/gpio/pca9552: Fix @type of pca9552 property led<N>
Quoted 9 lines · Markus Armbruster
pca955x_initfn()passes @type "bool" toobject_property_add(). The properties are actually string-typed:pca955x_get_led()andpca955x_set_led()usevisit_type_str(). Pass "str" instead.Fixes a90d8f84674d ("misc/pca9552: Add qom set and get")Signed-off-by Markus Armbruster <[email protected]>--- hw/gpio/pca9552.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 2/4] hw/gpio/pca9552: Fix @type of pca9552 property led<N>
In reply to Markus ArmbrusterThanks,
Glenn
Quoted 23 lines · Markus Armbruster
pca955x_initfn()passes @type "bool" toobject_property_add(). The properties are actually string-typed:pca955x_get_led()andpca955x_set_led()usevisit_type_str(). Pass "str" instead.Fixes a90d8f84674d ("misc/pca9552: Add qom set and get")Signed-off-by Markus Armbruster <[email protected]>--- hw/gpio/pca9552.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/gpio/pca9552.c +1
-1@@ -567,7 +567,7 @@ static void pca955x_initfn(Object *obj)if (k->has_led_support) {/* LED variant: expose the LED selector state as led%d. */ name =g_strdup_printf ("led%d" , ix); -object_property_add (obj, name,"bool" ,NULL , +object_property_add (obj, name,"str" ,NULL , pca955x_get_led, pca955x_set_led,NULL ,NULL ); }else {/* GPIO variant: expose the pin logic level as pin%d. */
PATCH 3/4 hw: Fix up PropertyInfo to set @qapi_type
In reply to Markus ArmbrusterWhen we recently updated PropertyInfo to set @qapi_type, we missed a few. Update them now.
--- hw/gpio/pca9552.c | 5 +++-- hw/gpio/pca9554.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
hw/gpio/pca9552.c +3 -2
@@ -23,6 +23,7 @@#include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "trace.h" #include "qom/object.h"
@@ -567,12 +568,12 @@ static void pca955x_initfn(Object *obj)if (k->has_led_support) {/* LED variant: expose the LED selector state as led%d. */ name =g_strdup_printf ("led%d" , ix); -object_property_add (obj, name,"str" ,NULL , +object_property_add (obj, name,"str" , &str_type_info, pca955x_get_led, pca955x_set_led,NULL ,NULL ); }else {/* GPIO variant: expose the pin logic level as pin%d. */ name =g_strdup_printf ("pin%d" , ix); -object_property_add (obj, name,"str" ,NULL , +object_property_add (obj, name,"str" , &str_type_info, pca955x_get_pin, pca955x_set_pin,NULL ,NULL ); }g_free (name);
hw/gpio/pca9554.c +3 -2
@@ -16,6 +16,7 @@#include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "trace.h" #include "qom/object.h"
@@ -280,8 +281,8 @@ static void pca9554_initfn(Object *obj)char *name; name =g_strdup_printf ("pin%d" , pin); -object_property_add (obj, name,"str" ,NULL , pca9554_get_pin, - pca9554_set_pin, +object_property_add (obj, name,"str" , &str_type_info, + pca9554_get_pin, pca9554_set_pin,NULL ,NULL );g_free (name); }
Signature · 1 line
2.55.0
PATCH 4/4 qom: Convert alias properties to QAPI-aware registration
In reply to Markus ArmbrusterPass the target property's QAPITypeInfo to object_class_property_add() / object_property_add().
Commit 53c674710b4 (qom: add qapi_type field to ObjectProperty) already monkey-patched it in object_property_add_alias(), but not in object_class_property_add_alias(). Delete that.
--- qom/object.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
qom/object.c +4 -3
@@ -3099,13 +3099,13 @@ object_property_add_alias(Object *obj, const char *name, prop->target_name =g_strdup (target_name); prop->flags =0 ; - op =object_property_add (obj, name, prop_type,NULL , + op =object_property_add (obj, name, prop_type, + target_prop->qapi_type, property_get_alias, property_set_alias, property_release_alias, prop); op->resolve = property_resolve_alias; - op->qapi_type = target_prop->qapi_type;if (target_prop->defval) { op->defval =qobject_ref (target_prop->defval); }
@@ -3144,7 +3144,8 @@ object_class_property_add_alias(ObjectClass *klass, const char *name, prop->target_name =g_strdup (target_name); prop->flags =OBJ_PROP_ALIAS_CLASS ; - op = object_class_property_add(klass, name, prop_type, NULL, + op = object_class_property_add(klass, name, prop_type, + target_prop->qapi_type, property_get_alias, property_set_alias, property_release_alias,
Signature · 1 line
2.55.0
Quoted 10 lines · Markus Armbruster
Marc-André missed one property, I lost two in my butchering of his work, and we both missed alias class properties. Not too bad for such a big series, I think.
Markus Armbruster (4):
target/riscv: Fix up PropertyInfo to set @qapi_type hw/gpio/pca9552: Fix @type of pca9552 property led<N>
hw: Fix up PropertyInfo to set @qapi_type
qom: Convert alias properties to QAPI-aware registration
Quoted 10 lines
hw/gpio/pca9552.c | 5 +++-- hw/gpio/pca9554.c | 5 +++-- qom/object.c | 7 ++++--- target/riscv/cpu.c | 1 + 4 files changed, 11 insertions(+), 7 deletions(-)--
2.55.0