diff mbox series

[19/19] hw/sparc: Set QDev properties using QDev API

Message ID 20230203180914.49112-20-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/dma/sparc32_dma.c |  6 +++---
 hw/sparc/sun4m.c     | 10 ++++------
 hw/sparc64/sun4u.c   |  3 +--
 3 files changed, 8 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index 0ef13c5e9a..49816755c2 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -347,7 +347,7 @@  static void sparc32_ledma_device_realize(DeviceState *dev, Error **errp)
     LEDMADeviceState *s = SPARC32_LEDMA_DEVICE(dev);
     SysBusPCNetState *lance = SYSBUS_PCNET(&s->lance);
 
-    object_property_set_link(OBJECT(lance), "dma", OBJECT(dev), &error_abort);
+    qdev_prop_set_link(DEVICE(lance), "dma", OBJECT(dev));
     sysbus_realize(SYS_BUS_DEVICE(lance), &error_fatal);
 }
 
@@ -380,7 +380,7 @@  static void sparc32_dma_realize(DeviceState *dev, Error **errp)
     }
 
     espdma = DEVICE(&s->espdma);
-    object_property_set_link(OBJECT(espdma), "iommu", iommu, &error_abort);
+    qdev_prop_set_link(espdma, "iommu", iommu);
     sysbus_realize(SYS_BUS_DEVICE(espdma), &error_fatal);
 
     esp = DEVICE(object_resolve_path_component(OBJECT(espdma), "esp"));
@@ -394,7 +394,7 @@  static void sparc32_dma_realize(DeviceState *dev, Error **errp)
                                 sysbus_mmio_get_region(sbd, 0));
 
     ledma = DEVICE(&s->ledma);
-    object_property_set_link(OBJECT(ledma), "iommu", iommu, &error_abort);
+    qdev_prop_set_link(ledma, "iommu", iommu);
     sysbus_realize(SYS_BUS_DEVICE(ledma), &error_fatal);
 
     lance = DEVICE(object_resolve_path_component(OBJECT(ledma), "lance"));
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index d9288326d6..f241a676b3 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -803,8 +803,7 @@  static void cpu_devinit(const char *cpu_type, unsigned int id,
     env = &cpu->env;
 
     qemu_register_reset(sun4m_cpu_reset, cpu);
-    object_property_set_bool(OBJECT(cpu), "start-powered-off", id != 0,
-                             &error_fatal);
+    qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", id != 0);
     qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
     cpu_sparc_set_id(env, id);
     *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
@@ -851,7 +850,7 @@  static void sun4m_hw_init(MachineState *machine)
 
     /* Create and map RAM frontend */
     dev = qdev_new("memory");
-    object_property_set_link(OBJECT(dev), "memdev", OBJECT(ram_memdev), &error_fatal);
+    qdev_prop_set_link(dev, "memdev", OBJECT(ram_memdev));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0);
 
@@ -978,7 +977,7 @@  static void sun4m_hw_init(MachineState *machine)
 
     /* Logically OR both its IRQs together */
     ms_kb_orgate = DEVICE(object_new(TYPE_OR_IRQ));
-    object_property_set_int(OBJECT(ms_kb_orgate), "num-lines", 2, &error_fatal);
+    qdev_prop_set_uint16(ms_kb_orgate, "num-lines", 2);
     qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal);
     sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0));
     sysbus_connect_irq(s, 1, qdev_get_gpio_in(ms_kb_orgate, 1));
@@ -999,8 +998,7 @@  static void sun4m_hw_init(MachineState *machine)
 
     /* Logically OR both its IRQs together */
     serial_orgate = DEVICE(object_new(TYPE_OR_IRQ));
-    object_property_set_int(OBJECT(serial_orgate), "num-lines", 2,
-                            &error_fatal);
+    qdev_prop_set_uint16(serial_orgate, "num-lines", 2);
     qdev_realize_and_unref(serial_orgate, NULL, &error_fatal);
     sysbus_connect_irq(s, 0, qdev_get_gpio_in(serial_orgate, 0));
     sysbus_connect_irq(s, 1, qdev_get_gpio_in(serial_orgate, 1));
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 387181ff77..823d527078 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -583,8 +583,7 @@  static void sun4uv_init(MemoryRegion *address_space_mem,
     sabre = SABRE(qdev_new(TYPE_SABRE));
     qdev_prop_set_uint64(DEVICE(sabre), "special-base", PBM_SPECIAL_BASE);
     qdev_prop_set_uint64(DEVICE(sabre), "mem-base", PBM_MEM_BASE);
-    object_property_set_link(OBJECT(sabre), "iommu", OBJECT(iommu),
-                             &error_abort);
+    qdev_prop_set_link(DEVICE(sabre), "iommu", OBJECT(iommu));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(sabre), &error_fatal);
 
     /* sabre_config */