diff mbox series

[08/24] vexpress-a15: Register "virtualization" as class property

Message ID 20200921221045.699690-9-ehabkost@redhat.com
State New, archived
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
---
 hw/arm/vexpress.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Igor Mammedov Oct. 23, 2020, 6:19 p.m. UTC | #1
On Mon, 21 Sep 2020 18:10:29 -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
> ---
>  hw/arm/vexpress.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index 0cc35749d7d..13339302af5 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -769,12 +769,6 @@ static void vexpress_a15_instance_init(Object *obj)
>       * but can also be specifically set to on or off.
>       */
>      vms->virt = true;
> -    object_property_add_bool(obj, "virtualization", vexpress_get_virt,
> -                             vexpress_set_virt);
> -    object_property_set_description(obj, "virtualization",
> -                                    "Set on/off to enable/disable the ARM "
> -                                    "Virtualization Extensions "
> -                                    "(defaults to same as 'secure')");
>  }
>  
>  static void vexpress_a9_instance_init(Object *obj)
> @@ -822,6 +816,14 @@ static void vexpress_a15_class_init(ObjectClass *oc, void *data)
>      mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
>  
>      vmc->daughterboard = &a15_daughterboard;
> +
> +    object_class_property_add_bool(oc, "virtualization", vexpress_get_virt,
> +                                   vexpress_set_virt);
> +    object_class_property_set_description(oc, "virtualization",
> +                                          "Set on/off to enable/disable the ARM "
> +                                          "Virtualization Extensions "
> +                                          "(defaults to same as 'secure')");
> +
>  }
>  
>  static const TypeInfo vexpress_info = {
diff mbox series

Patch

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 0cc35749d7d..13339302af5 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -769,12 +769,6 @@  static void vexpress_a15_instance_init(Object *obj)
      * but can also be specifically set to on or off.
      */
     vms->virt = true;
-    object_property_add_bool(obj, "virtualization", vexpress_get_virt,
-                             vexpress_set_virt);
-    object_property_set_description(obj, "virtualization",
-                                    "Set on/off to enable/disable the ARM "
-                                    "Virtualization Extensions "
-                                    "(defaults to same as 'secure')");
 }
 
 static void vexpress_a9_instance_init(Object *obj)
@@ -822,6 +816,14 @@  static void vexpress_a15_class_init(ObjectClass *oc, void *data)
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
 
     vmc->daughterboard = &a15_daughterboard;
+
+    object_class_property_add_bool(oc, "virtualization", vexpress_get_virt,
+                                   vexpress_set_virt);
+    object_class_property_set_description(oc, "virtualization",
+                                          "Set on/off to enable/disable the ARM "
+                                          "Virtualization Extensions "
+                                          "(defaults to same as 'secure')");
+
 }
 
 static const TypeInfo vexpress_info = {