]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: acpi: Not every platform has serial console a first device
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 28 Feb 2019 15:19:54 +0000 (17:19 +0200)
committerBin Meng <bmeng.cn@gmail.com>
Sun, 10 Mar 2019 00:17:00 +0000 (08:17 +0800)
We may not do an assumption that current console device is always a first
of UCLASS_SERIAL one.

For example, on properly described Intel Edison board the console UART
is a third one.

Use current serial device as described in global data.

Fixes: a61cbad78e67 ("dm: serial: Adjust serial_getinfo() to use proper API")
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/lib/acpi_table.c

index 04058a60d75eb59c20dce160cf751cb11f9b8ad9..270274f6b3b7fa71d2c3586a2e57614013ee7be9 100644 (file)
@@ -347,7 +347,7 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
        uint serial_width;
        int access_size;
        int space_id;
-       int ret;
+       int ret = -ENODEV;
 
        /* Fill out header fields */
        acpi_fill_header(header, "SPCR");
@@ -355,8 +355,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
        header->revision = 2;
 
        /* Read the device once, here. It is reused below */
-       ret = uclass_first_device_err(UCLASS_SERIAL, &dev);
-       if (!ret)
+       dev = gd->cur_serial_dev;
+       if (dev)
                ret = serial_getinfo(dev, &serial_info);
        if (ret)
                serial_info.type = SERIAL_CHIP_UNKNOWN;