aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-10-19 12:49:29 +0200
committerThomas Huth <huth@tuxfamily.org>2023-11-01 07:31:05 +0100
commitf213ccc96831191ac492bd36b9935effa01f95fd (patch)
tree7740c4bd7801e970de5c546b5a2f153fe485e787 /hw/char
parent7f090ed7103df119fa33651ae15958ddb5863f56 (diff)
hw/char/mcf_uart: Have mcf_uart_create() return DeviceState
There is no point in having mcf_uart_init() demote the DeviceState pointer and return a void one. Directly return the real typedef. mcf_uart_init() do both init + realize: rename as mcf_uart_create(). Similarly, mcf_uart_mm_init() do init / realize / mmap: rename as mcf_uart_create_mmap(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20231019104929.16517-1-philmd@linaro.org> Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/mcf_uart.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 6fa4ac502c..f9cbc9bdc4 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -342,25 +342,26 @@ static void mcf_uart_register(void)
type_init(mcf_uart_register)
-void *mcf_uart_init(qemu_irq irq, Chardev *chrdrv)
+DeviceState *mcf_uart_create(qemu_irq irq, Chardev *chrdrv)
{
- DeviceState *dev;
+ DeviceState *dev;
dev = qdev_new(TYPE_MCF_UART);
if (chrdrv) {
qdev_prop_set_chr(dev, "chardev", chrdrv);
}
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
return dev;
}
-void mcf_uart_mm_init(hwaddr base, qemu_irq irq, Chardev *chrdrv)
+DeviceState *mcf_uart_create_mmap(hwaddr base, qemu_irq irq, Chardev *chrdrv)
{
- DeviceState *dev;
+ DeviceState *dev;
- dev = mcf_uart_init(irq, chrdrv);
+ dev = mcf_uart_create(irq, chrdrv);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
+
+ return dev;
}