public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] x86: acpi: Not every platform has serial console a first device
@ 2019-02-28 15:06 Andy Shevchenko
  2019-02-28 15:18 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2019-02-28 15:06 UTC (permalink / raw)
  To: u-boot

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(-)

diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 04058a60d7..5848b6fcd8 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 = 0;
 
 	/* 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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH v1] x86: acpi: Not every platform has serial console a first device
  2019-02-28 15:06 [U-Boot] [PATCH v1] x86: acpi: Not every platform has serial console a first device Andy Shevchenko
@ 2019-02-28 15:18 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2019-02-28 15:18 UTC (permalink / raw)
  To: u-boot

On Thu, Feb 28, 2019 at 05:06:26PM +0200, Andy Shevchenko 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(-)
> 
> diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
> index 04058a60d7..5848b6fcd8 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 = 0;

This should be -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;
> -- 
> 2.20.1
> 

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-28 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 15:06 [U-Boot] [PATCH v1] x86: acpi: Not every platform has serial console a first device Andy Shevchenko
2019-02-28 15:18 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox