From 43b6ab4c673418e3dd4391a137132ca8ed7f9a99 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 11 Dec 2020 17:05:14 -0500 Subject: sparc: Use DEFINE_PROP for nwindows property Use the DEFINE_PROP macro (which will set extra fields in the struct) instead of initializing a Property struct manually. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov Acked-by: Mark Cave-Ayland Message-Id: <20201211220529.2290218-18-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- target/sparc/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'target') diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 6a32990..a1dc0f1 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = { qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0), - { .name = "nwindows", .info = &qdev_prop_nwindows }, + DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows, + qdev_prop_nwindows, uint32_t), DEFINE_PROP_END_OF_LIST() }; -- cgit v1.1 From ea7c1e5c3ed0f138f67a7c26a4219827845eb545 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 11 Dec 2020 17:05:20 -0500 Subject: qdev: Move dev->realized check to qdev_property_set() Every single qdev property setter function manually checks dev->realized. We can just check dev->realized inside qdev_property_set() instead. Signed-off-by: Eduardo Habkost Reviewed-by: Stefan Berger Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov Acked-by: Paul Durrant Message-Id: <20201211220529.2290218-24-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- target/sparc/cpu.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'target') diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index a1dc0f1..d8a8bb1 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -798,17 +798,11 @@ static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name, static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); const int64_t min = MIN_NWINDOWS; const int64_t max = MAX_NWINDOWS; SPARCCPU *cpu = SPARC_CPU(obj); int64_t value; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_int(v, name, &value, errp)) { return; } -- cgit v1.1