diff mbox series

[U-Boot,v2] x86: acpi: Not every platform has serial console a first device

Message ID 20190228151954.11265-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit edf18a83f8dc993279947cfc7faaba7dedf1ad82
Delegated to: Bin Meng
Headers show
Series [U-Boot,v2] x86: acpi: Not every platform has serial console a first device | expand

Commit Message

Andy Shevchenko Feb. 28, 2019, 3:19 p.m. UTC
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>
---
 arch/x86/lib/acpi_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bin Meng March 1, 2019, 2:13 a.m. UTC | #1
On Thu, Feb 28, 2019 at 11:19 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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>
> ---
>  arch/x86/lib/acpi_table.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng March 4, 2019, 6:24 a.m. UTC | #2
On Fri, Mar 1, 2019 at 10:13 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Thu, Feb 28, 2019 at 11:19 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > 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>
> > ---
> >  arch/x86/lib/acpi_table.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 04058a60d7..270274f6b3 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -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;