Message ID | 20230220115114.25237-6-philmd@linaro.org |
---|---|
State | Accepted |
Commit | dc1daf392c7cc6d1481bd9ce40a5594e624e7b47 |
Headers | show |
Series | hw/arm: Cleanups around QOM style | expand |
Philippe Mathieu-Daudé <philmd@linaro.org> writes: > Open-code the single use of xilinx_uartlite_create(). > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
On 2/20/23 01:51, Philippe Mathieu-Daudé wrote: > Open-code the single use of xilinx_uartlite_create(). > > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org> > --- > hw/microblaze/petalogix_s3adsp1800_mmu.c | 7 +++++-- > include/hw/char/xilinx_uartlite.h | 20 -------------------- > 2 files changed, 5 insertions(+), 22 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index 9d959d1ad8..505639c298 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -100,8 +100,11 @@ petalogix_s3adsp1800_init(MachineState *machine) irq[i] = qdev_get_gpio_in(dev, i); } - xilinx_uartlite_create(UARTLITE_BASEADDR, irq[UARTLITE_IRQ], - serial_hd(0)); + dev = qdev_new(TYPE_XILINX_UARTLITE); + qdev_prop_set_chr(dev, "chardev", serial_hd(0)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, UARTLITE_BASEADDR); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[UARTLITE_IRQ]); /* 2 timers at irq 2 @ 62 Mhz. */ dev = qdev_new("xlnx.xps-timer"); diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h index 753d3a453e..36d4e8444d 100644 --- a/include/hw/char/xilinx_uartlite.h +++ b/include/hw/char/xilinx_uartlite.h @@ -15,29 +15,9 @@ #ifndef XILINX_UARTLITE_H #define XILINX_UARTLITE_H -#include "hw/qdev-properties.h" -#include "hw/sysbus.h" -#include "qapi/error.h" #include "qom/object.h" #define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite" OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE) -static inline DeviceState *xilinx_uartlite_create(hwaddr addr, - qemu_irq irq, - Chardev *chr) -{ - DeviceState *dev; - SysBusDevice *s; - - dev = qdev_new(TYPE_XILINX_UARTLITE); - s = SYS_BUS_DEVICE(dev); - qdev_prop_set_chr(dev, "chardev", chr); - sysbus_realize_and_unref(s, &error_fatal); - sysbus_mmio_map(s, 0, addr); - sysbus_connect_irq(s, 0, irq); - - return dev; -} - #endif
Open-code the single use of xilinx_uartlite_create(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/microblaze/petalogix_s3adsp1800_mmu.c | 7 +++++-- include/hw/char/xilinx_uartlite.h | 20 -------------------- 2 files changed, 5 insertions(+), 22 deletions(-)