Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- include/hw/char/imx_serial.h | 1 + hw/arm/fsl-imx25.c | 9 +-------- hw/arm/fsl-imx31.c | 9 +-------- hw/arm/fsl-imx6.c | 10 +--------- 4 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h index baeec3183f..55139dc6ec 100644 --- a/include/hw/char/imx_serial.h +++ b/include/hw/char/imx_serial.h @@ -20,6 +20,7 @@ #include "hw/sysbus.h" #include "chardev/char-fe.h" +#include "hw/char/serial.h" #define TYPE_IMX_SERIAL "imx.serial" #define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 3b97eceb3c..425a9edc36 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -120,14 +120,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) if (i < MAX_SERIAL_PORTS) { Chardev *chr; - chr = serial_hds[i]; - - if (!chr) { - char label[20]; - snprintf(label, sizeof(label), "imx31.uart%d", i); - chr = qemu_chr_new(label, "null"); - } - + chr = serial_chr_nonnull(serial_hds[i]); qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr); } diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 0f2ebe8161..8d4535a536 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -109,14 +109,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) if (i < MAX_SERIAL_PORTS) { Chardev *chr; - chr = serial_hds[i]; - - if (!chr) { - char label[20]; - snprintf(label, sizeof(label), "imx31.uart%d", i); - chr = qemu_chr_new(label, "null"); - } - + chr = serial_chr_nonnull(serial_hds[i]); qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr); } diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 26fd214004..7bc1aa1fbe 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -189,15 +189,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) if (i < MAX_SERIAL_PORTS) { Chardev *chr; - chr = serial_hds[i]; - - if (!chr) { - char *label = g_strdup_printf("imx6.uart%d", i + 1); - chr = qemu_chr_new(label, "null"); - g_free(label); - serial_hds[i] = chr; - } - + chr = serial_chr_nonnull(serial_hds[i]); qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr); } -- 2.14.1