Message ID | 20231030143957.82988-3-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/ppc/e500: Pass array of CPUs as array of canonical QOM paths | expand |
On 10/30/23 11:39, Philippe Mathieu-Daudé wrote: > When multiple QOM types are registered in the same file, > it is simpler to use the the DEFINE_TYPES() macro. In > particular because type array declared with such macro > are easier to review. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> > I'm going to do that for each file I modify, so eventually > we'll get all converted. > --- > hw/ppc/ppce500_spin.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c > index bbce63e8a4..e3608d8c16 100644 > --- a/hw/ppc/ppce500_spin.c > +++ b/hw/ppc/ppce500_spin.c > @@ -195,17 +195,14 @@ static void ppce500_spin_class_init(ObjectClass *klass, void *data) > dc->reset = spin_reset; > } > > -static const TypeInfo ppce500_spin_info = { > - .name = TYPE_E500_SPIN, > - .parent = TYPE_SYS_BUS_DEVICE, > - .instance_size = sizeof(SpinState), > - .instance_init = ppce500_spin_initfn, > - .class_init = ppce500_spin_class_init, > +static const TypeInfo ppce500_spin_types[] = { > + { > + .name = TYPE_E500_SPIN, > + .parent = TYPE_SYS_BUS_DEVICE, > + .instance_size = sizeof(SpinState), > + .instance_init = ppce500_spin_initfn, > + .class_init = ppce500_spin_class_init, > + }, > }; > > -static void ppce500_spin_register_types(void) > -{ > - type_register_static(&ppce500_spin_info); > -} > - > -type_init(ppce500_spin_register_types) > +DEFINE_TYPES(ppce500_spin_types)
Am 30.10.2023 um 15:39 hat Philippe Mathieu-Daudé geschrieben: > When multiple QOM types are registered in the same file, > it is simpler to use the the DEFINE_TYPES() macro. In > particular because type array declared with such macro > are easier to review. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > I'm going to do that for each file I modify, so eventually > we'll get all converted. This is probably a standard commit message that you used for every conversion? Maybe it should be changed here because I only see a single QOM type in the patch. Kevin
diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index bbce63e8a4..e3608d8c16 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -195,17 +195,14 @@ static void ppce500_spin_class_init(ObjectClass *klass, void *data) dc->reset = spin_reset; } -static const TypeInfo ppce500_spin_info = { - .name = TYPE_E500_SPIN, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(SpinState), - .instance_init = ppce500_spin_initfn, - .class_init = ppce500_spin_class_init, +static const TypeInfo ppce500_spin_types[] = { + { + .name = TYPE_E500_SPIN, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SpinState), + .instance_init = ppce500_spin_initfn, + .class_init = ppce500_spin_class_init, + }, }; -static void ppce500_spin_register_types(void) -{ - type_register_static(&ppce500_spin_info); -} - -type_init(ppce500_spin_register_types) +DEFINE_TYPES(ppce500_spin_types)
When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- I'm going to do that for each file I modify, so eventually we'll get all converted. --- hw/ppc/ppce500_spin.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)