From: Philippe Mathieu-Daudé <philmd@linaro.org>
Mechanical change using the following coccinelle script:
@@
identifier dev;
expression qom_type;
expression addr;
expression irq;
@@
- dev = qdev_new(qom_type);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
+ dev = sysbus_create_simple(qom_type, addr, irq);
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-ID: <20231024083010.12453-7-philmd@linaro.org>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
---
hw/m68k/virt.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index e7dc188855..2e49e262ee 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -201,11 +201,8 @@ static void virt_init(MachineState *machine)
sysbus_connect_irq(sysbus, 0, PIC_GPIO(VIRT_GF_TTY_IRQ_BASE));
/* virt controller */
- dev = qdev_new(TYPE_VIRT_CTRL);
- sysbus = SYS_BUS_DEVICE(dev);
- sysbus_realize_and_unref(sysbus, &error_fatal);
- sysbus_mmio_map(sysbus, 0, VIRT_CTRL_MMIO_BASE);
- sysbus_connect_irq(sysbus, 0, PIC_GPIO(VIRT_CTRL_IRQ_BASE));
+ dev = sysbus_create_simple(TYPE_VIRT_CTRL, VIRT_CTRL_MMIO_BASE,
+ PIC_GPIO(VIRT_CTRL_IRQ_BASE));
/* virtio-mmio */
io_base = VIRT_VIRTIO_MMIO_BASE;
--
2.41.0