diff mbox series

[13/19] hw/m68k: Set QDev properties using QDev API

Message ID 20230203180914.49112-14-philmd@linaro.org
State New
Headers show
Series hw: Set QDev properties using QDev API (part 1/3) | expand

Commit Message

Philippe Mathieu-Daudé Feb. 3, 2023, 6:09 p.m. UTC
No need to use the low-level QOM API when an object
inherits from QDev. Directly use the QDev API to set
its properties.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/m68k/next-cube.c | 2 +-
 hw/m68k/q800.c      | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

Comments

Thomas Huth Feb. 5, 2023, 9:14 a.m. UTC | #1
Am Fri,  3 Feb 2023 19:09:08 +0100
schrieb Philippe Mathieu-Daudé <philmd@linaro.org>:

> No need to use the low-level QOM API when an object
> inherits from QDev. Directly use the QDev API to set
> its properties.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/m68k/next-cube.c | 2 +-
>  hw/m68k/q800.c      | 7 +++----
>  2 files changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Thomas Huth <huth@tuxfamily.org>
diff mbox series

Patch

diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index e0d4a94f9d..460b84c6e6 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -966,7 +966,7 @@  static void next_cube_init(MachineState *machine)
 
     /* Peripheral Controller */
     pcdev = qdev_new(TYPE_NEXT_PC);
-    object_property_set_link(OBJECT(pcdev), "cpu", OBJECT(cpu), &error_abort);
+    qdev_prop_set_link(pcdev, "cpu", OBJECT(cpu));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(pcdev), &error_fatal);
 
     /* 64MB RAM starting at 0x04000000  */
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 9d52ca6613..1f363a666c 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -427,7 +427,7 @@  static void q800_init(MachineState *machine)
 
     /* IRQ Glue */
     glue = qdev_new(TYPE_GLUE);
-    object_property_set_link(OBJECT(glue), "cpu", OBJECT(cpu), &error_abort);
+    qdev_prop_set_link(glue, "cpu", OBJECT(cpu));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(glue), &error_fatal);
 
     /* VIA 1 */
@@ -483,8 +483,7 @@  static void q800_init(MachineState *machine)
     qdev_set_nic_properties(dev, &nd_table[0]);
     qdev_prop_set_uint8(dev, "it_shift", 2);
     qdev_prop_set_bit(dev, "big_endian", true);
-    object_property_set_link(OBJECT(dev), "dma_mr",
-                             OBJECT(get_system_memory()), &error_abort);
+    qdev_prop_set_link(dev, "dma_mr", OBJECT(get_system_memory()));
     sysbus = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(sysbus, &error_fatal);
     sysbus_mmio_map(sysbus, 0, SONIC_BASE);
@@ -520,7 +519,7 @@  static void q800_init(MachineState *machine)
 
     /* Logically OR both its IRQs together */
     escc_orgate = DEVICE(object_new(TYPE_OR_IRQ));
-    object_property_set_int(OBJECT(escc_orgate), "num-lines", 2, &error_fatal);
+    qdev_prop_set_uint16(escc_orgate, "num-lines", 2);
     qdev_realize_and_unref(escc_orgate, NULL, &error_fatal);
     sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(escc_orgate, 0));
     sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(escc_orgate, 1));