diff mbox series

[18/24] arm/cpu64: Register "aarch64" as class property

Message ID 20200921221045.699690-19-ehabkost@redhat.com
State New
Headers show
Series qom: Convert some properties to class properties | expand

Commit Message

Eduardo Habkost Sept. 21, 2020, 10:10 p.m. UTC
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 target/arm/cpu64.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Igor Mammedov Oct. 23, 2020, 6:34 p.m. UTC | #1
On Mon, 21 Sep 2020 18:10:39 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

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

> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  target/arm/cpu64.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
> index 3c2b3d95993..349c9fa3a3a 100644
> --- a/target/arm/cpu64.c
> +++ b/target/arm/cpu64.c
> @@ -758,15 +758,6 @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)
>      }
>  }
>  
> -static void aarch64_cpu_initfn(Object *obj)
> -{
> -    object_property_add_bool(obj, "aarch64", aarch64_cpu_get_aarch64,
> -                             aarch64_cpu_set_aarch64);
> -    object_property_set_description(obj, "aarch64",
> -                                    "Set on/off to enable/disable aarch64 "
> -                                    "execution state ");
> -}
> -
>  static void aarch64_cpu_finalizefn(Object *obj)
>  {
>  }
> @@ -786,6 +777,12 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
>      cc->gdb_num_core_regs = 34;
>      cc->gdb_core_xml_file = "aarch64-core.xml";
>      cc->gdb_arch_name = aarch64_gdb_arch_name;
> +
> +    object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64,
> +                                   aarch64_cpu_set_aarch64);
> +    object_class_property_set_description(oc, "aarch64",
> +                                          "Set on/off to enable/disable aarch64 "
> +                                          "execution state ");
>  }
>  
>  static void aarch64_cpu_instance_init(Object *obj)
> @@ -823,7 +820,6 @@ static const TypeInfo aarch64_cpu_type_info = {
>      .name = TYPE_AARCH64_CPU,
>      .parent = TYPE_ARM_CPU,
>      .instance_size = sizeof(ARMCPU),
> -    .instance_init = aarch64_cpu_initfn,
>      .instance_finalize = aarch64_cpu_finalizefn,
>      .abstract = true,
>      .class_size = sizeof(AArch64CPUClass),
diff mbox series

Patch

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 3c2b3d95993..349c9fa3a3a 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -758,15 +758,6 @@  static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)
     }
 }
 
-static void aarch64_cpu_initfn(Object *obj)
-{
-    object_property_add_bool(obj, "aarch64", aarch64_cpu_get_aarch64,
-                             aarch64_cpu_set_aarch64);
-    object_property_set_description(obj, "aarch64",
-                                    "Set on/off to enable/disable aarch64 "
-                                    "execution state ");
-}
-
 static void aarch64_cpu_finalizefn(Object *obj)
 {
 }
@@ -786,6 +777,12 @@  static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
     cc->gdb_num_core_regs = 34;
     cc->gdb_core_xml_file = "aarch64-core.xml";
     cc->gdb_arch_name = aarch64_gdb_arch_name;
+
+    object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64,
+                                   aarch64_cpu_set_aarch64);
+    object_class_property_set_description(oc, "aarch64",
+                                          "Set on/off to enable/disable aarch64 "
+                                          "execution state ");
 }
 
 static void aarch64_cpu_instance_init(Object *obj)
@@ -823,7 +820,6 @@  static const TypeInfo aarch64_cpu_type_info = {
     .name = TYPE_AARCH64_CPU,
     .parent = TYPE_ARM_CPU,
     .instance_size = sizeof(ARMCPU),
-    .instance_init = aarch64_cpu_initfn,
     .instance_finalize = aarch64_cpu_finalizefn,
     .abstract = true,
     .class_size = sizeof(AArch64CPUClass),