diff mbox series

[19/23] hw/block/pflash_cfi01: Prefer DEFINE_TYPES() macro

Message ID 20240923093016.66437-20-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series E500 Cleanup | expand

Commit Message

Bernhard Beschow Sept. 23, 2024, 9:30 a.m. UTC
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/block/pflash_cfi01.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

Comments

Cédric Le Goater Sept. 25, 2024, 3:42 p.m. UTC | #1
On 9/23/24 11:30, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/block/pflash_cfi01.c | 21 ++++++++-------------
>   1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index 7b6ec64442..cf11dada29 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -47,7 +47,6 @@
>   #include "qemu/bitops.h"
>   #include "qemu/host-utils.h"
>   #include "qemu/log.h"
> -#include "qemu/module.h"
>   #include "qemu/option.h"
>   #include "hw/sysbus.h"
>   #include "migration/vmstate.h"
> @@ -947,20 +946,16 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
>       set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
>   }
>   
> -
> -static const TypeInfo pflash_cfi01_info = {
> -    .name           = TYPE_PFLASH_CFI01,
> -    .parent         = TYPE_SYS_BUS_DEVICE,
> -    .instance_size  = sizeof(PFlashCFI01),
> -    .class_init     = pflash_cfi01_class_init,
> +static const TypeInfo types[] = {
> +    {
> +        .name           = TYPE_PFLASH_CFI01,
> +        .parent         = TYPE_SYS_BUS_DEVICE,
> +        .instance_size  = sizeof(PFlashCFI01),
> +        .class_init     = pflash_cfi01_class_init,
> +    },
>   };
>   
> -static void pflash_cfi01_register_types(void)
> -{
> -    type_register_static(&pflash_cfi01_info);
> -}
> -
> -type_init(pflash_cfi01_register_types)
> +DEFINE_TYPES(types)
>   
>   PFlashCFI01 *pflash_cfi01_register(hwaddr base,
>                                      const char *name,
diff mbox series

Patch

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 7b6ec64442..cf11dada29 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -47,7 +47,6 @@ 
 #include "qemu/bitops.h"
 #include "qemu/host-utils.h"
 #include "qemu/log.h"
-#include "qemu/module.h"
 #include "qemu/option.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
@@ -947,20 +946,16 @@  static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
 
-
-static const TypeInfo pflash_cfi01_info = {
-    .name           = TYPE_PFLASH_CFI01,
-    .parent         = TYPE_SYS_BUS_DEVICE,
-    .instance_size  = sizeof(PFlashCFI01),
-    .class_init     = pflash_cfi01_class_init,
+static const TypeInfo types[] = {
+    {
+        .name           = TYPE_PFLASH_CFI01,
+        .parent         = TYPE_SYS_BUS_DEVICE,
+        .instance_size  = sizeof(PFlashCFI01),
+        .class_init     = pflash_cfi01_class_init,
+    },
 };
 
-static void pflash_cfi01_register_types(void)
-{
-    type_register_static(&pflash_cfi01_info);
-}
-
-type_init(pflash_cfi01_register_types)
+DEFINE_TYPES(types)
 
 PFlashCFI01 *pflash_cfi01_register(hwaddr base,
                                    const char *name,