summaryrefslogtreecommitdiffstats
path: root/hw/lm32
diff options
context:
space:
mode:
authorMarkus Armbruster2020-06-10 07:32:34 +0200
committerMarkus Armbruster2020-06-15 22:05:28 +0200
commit3c6ef471ee67bf5a22a9e0ecfdc45ca7d2393216 (patch)
tree300f0113474324b52f15500b1a80ee7e33872668 /hw/lm32
parentsysbus: New sysbus_realize(), sysbus_realize_and_unref() (diff)
downloadqemu-3c6ef471ee67bf5a22a9e0ecfdc45ca7d2393216.tar.gz
qemu-3c6ef471ee67bf5a22a9e0ecfdc45ca7d2393216.tar.xz
qemu-3c6ef471ee67bf5a22a9e0ecfdc45ca7d2393216.zip
sysbus: Convert to sysbus_realize() etc. with Coccinelle
Convert from qdev_realize(), qdev_realize_and_unref() with null @bus argument to sysbus_realize(), sysbus_realize_and_unref(). Coccinelle script: @@ expression dev, errp; @@ - qdev_realize(DEVICE(dev), NULL, errp); + sysbus_realize(SYS_BUS_DEVICE(dev), errp); @@ expression sysbus_dev, dev, errp; @@ + sysbus_dev = SYS_BUS_DEVICE(dev); - qdev_realize_and_unref(dev, NULL, errp); + sysbus_realize_and_unref(sysbus_dev, errp); - sysbus_dev = SYS_BUS_DEVICE(dev); @@ expression sysbus_dev, dev, errp; expression expr; @@ sysbus_dev = SYS_BUS_DEVICE(dev); ... when != dev = expr; - qdev_realize_and_unref(dev, NULL, errp); + sysbus_realize_and_unref(sysbus_dev, errp); @@ expression dev, errp; @@ - qdev_realize_and_unref(DEVICE(dev), NULL, errp); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp); @@ expression dev, errp; @@ - qdev_realize_and_unref(dev, NULL, errp); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp); Whitespace changes minimized manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-46-armbru@redhat.com> [Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
Diffstat (limited to 'hw/lm32')
-rw-r--r--hw/lm32/lm32.h6
-rw-r--r--hw/lm32/milkymist-hw.h18
2 files changed, 12 insertions, 12 deletions
diff --git a/hw/lm32/lm32.h b/hw/lm32/lm32.h
index 326238d859..7b4f6255b9 100644
--- a/hw/lm32/lm32.h
+++ b/hw/lm32/lm32.h
@@ -11,8 +11,8 @@ static inline DeviceState *lm32_pic_init(qemu_irq cpu_irq)
SysBusDevice *d;
dev = qdev_new("lm32-pic");
- qdev_realize_and_unref(dev, NULL, &error_fatal);
d = SYS_BUS_DEVICE(dev);
+ sysbus_realize_and_unref(d, &error_fatal);
sysbus_connect_irq(d, 0, cpu_irq);
return dev;
@@ -24,7 +24,7 @@ static inline DeviceState *lm32_juart_init(Chardev *chr)
dev = qdev_new(TYPE_LM32_JUART);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
return dev;
}
@@ -39,7 +39,7 @@ static inline DeviceState *lm32_uart_create(hwaddr addr,
dev = qdev_new("lm32-uart");
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
return dev;
diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h
index d5f15a30a1..05e2c2a5a7 100644
--- a/hw/lm32/milkymist-hw.h
+++ b/hw/lm32/milkymist-hw.h
@@ -13,7 +13,7 @@ static inline DeviceState *milkymist_uart_create(hwaddr base,
dev = qdev_new("milkymist-uart");
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
@@ -25,7 +25,7 @@ static inline DeviceState *milkymist_hpdmc_create(hwaddr base)
DeviceState *dev;
dev = qdev_new("milkymist-hpdmc");
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
return dev;
@@ -36,7 +36,7 @@ static inline DeviceState *milkymist_memcard_create(hwaddr base)
DeviceState *dev;
dev = qdev_new("milkymist-memcard");
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
return dev;
@@ -50,7 +50,7 @@ static inline DeviceState *milkymist_vgafb_create(hwaddr base,
dev = qdev_new("milkymist-vgafb");
qdev_prop_set_uint32(dev, "fb_offset", fb_offset);
qdev_prop_set_uint32(dev, "fb_mask", fb_mask);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
return dev;
@@ -68,7 +68,7 @@ static inline DeviceState *milkymist_sysctl_create(hwaddr base,
qdev_prop_set_uint32(dev, "systemid", system_id);
qdev_prop_set_uint32(dev, "capabilities", capabilities);
qdev_prop_set_uint32(dev, "gpio_strappings", gpio_strappings);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, gpio_irq);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, timer0_irq);
@@ -83,7 +83,7 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
DeviceState *dev;
dev = qdev_new("milkymist-pfpu");
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
return dev;
@@ -96,7 +96,7 @@ static inline DeviceState *milkymist_ac97_create(hwaddr base,
DeviceState *dev;
dev = qdev_new("milkymist-ac97");
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, crrequest_irq);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, crreply_irq);
@@ -114,7 +114,7 @@ static inline DeviceState *milkymist_minimac2_create(hwaddr base,
qemu_check_nic_model(&nd_table[0], "minimac2");
dev = qdev_new("milkymist-minimac2");
qdev_set_nic_properties(dev, &nd_table[0]);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, buffers_base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, rx_irq);
@@ -132,7 +132,7 @@ static inline DeviceState *milkymist_softusb_create(hwaddr base,
dev = qdev_new("milkymist-softusb");
qdev_prop_set_uint32(dev, "pmem_size", pmem_size);
qdev_prop_set_uint32(dev, "dmem_size", dmem_size);
- qdev_realize_and_unref(dev, NULL, &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, pmem_base);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, dmem_base);