hw/arm/fsl-imx*: Don't create "null" chardevs for serial devices
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 20 Apr 2018 14:52:38 +0000 (15:52 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 26 Apr 2018 12:57:00 +0000 (13:57 +0100)
Following commit 12051d82f004024, UART devices should handle
being passed a NULL pointer chardev, so we don't need to
create "null" backends in board code. Remove the code that
does this and updates serial_hds[].

(fsl-imx7.c was already written this way.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20180420145249.32435-3-peter.maydell@linaro.org

hw/arm/fsl-imx25.c
hw/arm/fsl-imx31.c
hw/arm/fsl-imx6.c

index cb988a6c256ff2b564bb9c5e2e4d9f92375bb877..d7d064e5ce3a7c5a49d393a9524e8ef68bf785af 100644 (file)
@@ -118,17 +118,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");
-            }
-
-            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
+            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hds[i]);
         }
 
         object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);
index 3eee83d547ae9f7e8b3d8e7b478144e08d6b5a13..e6c788049d187290e3a92ffc49c693b881f06048 100644 (file)
@@ -107,17 +107,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");
-            }
-
-            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
+            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hds[i]);
         }
 
         object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);
index 9dfbc9a8c4e6dd31a92e1399b804e9a62bc47ee9..ea14de33c6f09f4b729f40d9ec3dad8bc31e6c7c 100644 (file)
@@ -189,18 +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;
-            }
-
-            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
+            qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hds[i]);
         }
 
         object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);