diff mbox series

[RFC,v5,07/21] hw/boards: Introduce DEFINE_MACHINE_WITH_INTERFACES() macro

Message ID 20250424222112.36194-8-philmd@linaro.org
State New
Headers show
Series single-binary: Make hw/arm/ common | expand

Commit Message

Philippe Mathieu-Daudé April 24, 2025, 10:20 p.m. UTC
DEFINE_MACHINE_WITH_INTERFACES() is similar to DEFINE_MACHINE()
but allows to pass a InterfaceInfo[] pointer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/boards.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Pierrick Bouvier April 24, 2025, 10:44 p.m. UTC | #1
On 4/24/25 15:20, Philippe Mathieu-Daudé wrote:
> DEFINE_MACHINE_WITH_INTERFACES() is similar to DEFINE_MACHINE()
> but allows to pass a InterfaceInfo[] pointer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/boards.h | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 765dc8dd35e..3573907d597 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -744,7 +744,7 @@  struct MachineState {
         } \
     } while (0)
 
-#define DEFINE_MACHINE(namestr, machine_initfn) \
+#define DEFINE_MACHINE_WITH_INTERFACES(namestr, machine_initfn, ifaces) \
     static void machine_initfn##_class_init(ObjectClass *oc, const void *data) \
     { \
         MachineClass *mc = MACHINE_CLASS(oc); \
@@ -754,6 +754,7 @@  struct MachineState {
         .name       = MACHINE_TYPE_NAME(namestr), \
         .parent     = TYPE_MACHINE, \
         .class_init = machine_initfn##_class_init, \
+        .interfaces = ifaces, \
     }; \
     static void machine_initfn##_register_types(void) \
     { \
@@ -761,6 +762,9 @@  struct MachineState {
     } \
     type_init(machine_initfn##_register_types)
 
+#define DEFINE_MACHINE(namestr, machine_initfn) \
+    DEFINE_MACHINE_WITH_INTERFACES(namestr, machine_initfn, NULL)
+
 extern GlobalProperty hw_compat_10_0[];
 extern const size_t hw_compat_10_0_len;