[RFC PATCH 1/2] hw/arm/raspi: Trivial code movement

Philippe Mathieu-Daudé posted 2 patches 5 years ago
Maintainers: Michael Tokarev <mjt@tls.msk.ru>, Laurent Vivier <laurent@vivier.eu>
[RFC PATCH 1/2] hw/arm/raspi: Trivial code movement
Posted by Philippe Mathieu-Daudé 5 years ago
Move the abstract TYPE_BCM283X and TYPE_RASPI_MACHINE declarations
earlier to make the next commit easier to review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/bcm2836.c | 32 +++++++++++++++++---------------
 hw/arm/raspi.c   | 18 ++++++++++--------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
index de7ade2878e..fd16ed87c40 100644
--- a/hw/arm/bcm2836.c
+++ b/hw/arm/bcm2836.c
@@ -219,20 +219,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *data)
 
 static const TypeInfo bcm283x_types[] = {
     {
-        .name           = TYPE_BCM2835,
-        .parent         = TYPE_BCM283X,
-        .class_init     = bcm2835_class_init,
-    }, {
-        .name           = TYPE_BCM2836,
-        .parent         = TYPE_BCM283X,
-        .class_init     = bcm2836_class_init,
-#ifdef TARGET_AARCH64
-    }, {
-        .name           = TYPE_BCM2837,
-        .parent         = TYPE_BCM283X,
-        .class_init     = bcm2837_class_init,
-#endif
-    }, {
         .name           = TYPE_BCM283X,
         .parent         = TYPE_DEVICE,
         .instance_size  = sizeof(BCM283XState),
@@ -240,7 +226,23 @@ static const TypeInfo bcm283x_types[] = {
         .class_size     = sizeof(BCM283XClass),
         .class_init     = bcm283x_class_init,
         .abstract       = true,
-    }
+    },
+    {
+        .name           = TYPE_BCM2835,
+        .parent         = TYPE_BCM283X,
+        .class_init     = bcm2835_class_init,
+    }, {
+        .name           = TYPE_BCM2836,
+        .parent         = TYPE_BCM283X,
+        .class_init     = bcm2836_class_init,
+    },
+#ifdef TARGET_AARCH64
+    {
+        .name           = TYPE_BCM2837,
+        .parent         = TYPE_BCM283X,
+        .class_init     = bcm2837_class_init,
+    },
+#endif
 };
 
 DEFINE_TYPES(bcm283x_types)
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 990509d3852..dce966a4dd8 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -369,6 +369,13 @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
 #endif /* TARGET_AARCH64 */
 
 static const TypeInfo raspi_machine_types[] = {
+    {
+        .name           = TYPE_RASPI_MACHINE,
+        .parent         = TYPE_MACHINE,
+        .instance_size  = sizeof(RaspiMachineState),
+        .class_size     = sizeof(RaspiMachineClass),
+        .abstract       = true,
+    },
     {
         .name           = MACHINE_TYPE_NAME("raspi0"),
         .parent         = TYPE_RASPI_MACHINE,
@@ -381,8 +388,9 @@ static const TypeInfo raspi_machine_types[] = {
         .name           = MACHINE_TYPE_NAME("raspi2b"),
         .parent         = TYPE_RASPI_MACHINE,
         .class_init     = raspi2b_machine_class_init,
+    },
 #ifdef TARGET_AARCH64
-    }, {
+    {
         .name           = MACHINE_TYPE_NAME("raspi3ap"),
         .parent         = TYPE_RASPI_MACHINE,
         .class_init     = raspi3ap_machine_class_init,
@@ -390,14 +398,8 @@ static const TypeInfo raspi_machine_types[] = {
         .name           = MACHINE_TYPE_NAME("raspi3b"),
         .parent         = TYPE_RASPI_MACHINE,
         .class_init     = raspi3b_machine_class_init,
+    },
 #endif
-    }, {
-        .name           = TYPE_RASPI_MACHINE,
-        .parent         = TYPE_MACHINE,
-        .instance_size  = sizeof(RaspiMachineState),
-        .class_size     = sizeof(RaspiMachineClass),
-        .abstract       = true,
-    }
 };
 
 DEFINE_TYPES(raspi_machine_types)
-- 
2.26.2

Re: [RFC PATCH 1/2] hw/arm/raspi: Trivial code movement
Posted by Luc Michel 5 years ago
On 16:14 Sun 31 Jan     , Philippe Mathieu-Daudé wrote:
> Move the abstract TYPE_BCM283X and TYPE_RASPI_MACHINE declarations
> earlier to make the next commit easier to review.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc@lmichel.fr>

> ---
>  hw/arm/bcm2836.c | 32 +++++++++++++++++---------------
>  hw/arm/raspi.c   | 18 ++++++++++--------
>  2 files changed, 27 insertions(+), 23 deletions(-)
> 
> diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
> index de7ade2878e..fd16ed87c40 100644
> --- a/hw/arm/bcm2836.c
> +++ b/hw/arm/bcm2836.c
> @@ -219,20 +219,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *data)
>  
>  static const TypeInfo bcm283x_types[] = {
>      {
> -        .name           = TYPE_BCM2835,
> -        .parent         = TYPE_BCM283X,
> -        .class_init     = bcm2835_class_init,
> -    }, {
> -        .name           = TYPE_BCM2836,
> -        .parent         = TYPE_BCM283X,
> -        .class_init     = bcm2836_class_init,
> -#ifdef TARGET_AARCH64
> -    }, {
> -        .name           = TYPE_BCM2837,
> -        .parent         = TYPE_BCM283X,
> -        .class_init     = bcm2837_class_init,
> -#endif
> -    }, {
>          .name           = TYPE_BCM283X,
>          .parent         = TYPE_DEVICE,
>          .instance_size  = sizeof(BCM283XState),
> @@ -240,7 +226,23 @@ static const TypeInfo bcm283x_types[] = {
>          .class_size     = sizeof(BCM283XClass),
>          .class_init     = bcm283x_class_init,
>          .abstract       = true,
> -    }
> +    },
> +    {
> +        .name           = TYPE_BCM2835,
> +        .parent         = TYPE_BCM283X,
> +        .class_init     = bcm2835_class_init,
> +    }, {
> +        .name           = TYPE_BCM2836,
> +        .parent         = TYPE_BCM283X,
> +        .class_init     = bcm2836_class_init,
> +    },
> +#ifdef TARGET_AARCH64
> +    {
> +        .name           = TYPE_BCM2837,
> +        .parent         = TYPE_BCM283X,
> +        .class_init     = bcm2837_class_init,
> +    },
> +#endif
>  };
>  
>  DEFINE_TYPES(bcm283x_types)
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index 990509d3852..dce966a4dd8 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -369,6 +369,13 @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
>  #endif /* TARGET_AARCH64 */
>  
>  static const TypeInfo raspi_machine_types[] = {
> +    {
> +        .name           = TYPE_RASPI_MACHINE,
> +        .parent         = TYPE_MACHINE,
> +        .instance_size  = sizeof(RaspiMachineState),
> +        .class_size     = sizeof(RaspiMachineClass),
> +        .abstract       = true,
> +    },
>      {
>          .name           = MACHINE_TYPE_NAME("raspi0"),
>          .parent         = TYPE_RASPI_MACHINE,
> @@ -381,8 +388,9 @@ static const TypeInfo raspi_machine_types[] = {
>          .name           = MACHINE_TYPE_NAME("raspi2b"),
>          .parent         = TYPE_RASPI_MACHINE,
>          .class_init     = raspi2b_machine_class_init,
> +    },
>  #ifdef TARGET_AARCH64
> -    }, {
> +    {
>          .name           = MACHINE_TYPE_NAME("raspi3ap"),
>          .parent         = TYPE_RASPI_MACHINE,
>          .class_init     = raspi3ap_machine_class_init,
> @@ -390,14 +398,8 @@ static const TypeInfo raspi_machine_types[] = {
>          .name           = MACHINE_TYPE_NAME("raspi3b"),
>          .parent         = TYPE_RASPI_MACHINE,
>          .class_init     = raspi3b_machine_class_init,
> +    },
>  #endif
> -    }, {
> -        .name           = TYPE_RASPI_MACHINE,
> -        .parent         = TYPE_MACHINE,
> -        .instance_size  = sizeof(RaspiMachineState),
> -        .class_size     = sizeof(RaspiMachineClass),
> -        .abstract       = true,
> -    }
>  };
>  
>  DEFINE_TYPES(raspi_machine_types)
> -- 
> 2.26.2
> 

--