Skip to contentSkip to conversation

x86: acpi: Not every platform has serial console a first device

PATCH New Andy Shevchenko 1 participant 2 messages Feb 28, 2019 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: acpi: Not every platform has serial console a first device

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 <[email protected]>
---
 arch/x86/lib/acpi_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/lib/acpi_table.c +3 -3
index 04058a60d7..5848b6fcd8 100644
@@ -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;
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 x86: acpi: Not every platform has serial console a first device

Quoted 20 lines · Andy Shevchenko

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 <[email protected]>
---
 arch/x86/lib/acpi_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/lib/acpi_table.c +0 -0
index 04058a60d7..5848b6fcd8 100644

arch/x86/lib/acpi_table.c static void acpi_create_spcr(struct acpi_spcr *spcr) · line 351

Quoted 6 lines
arch/x86/lib/acpi_table.c +1 -1
@@ -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.

Quoted 17 lines
arch/x86/lib/acpi_table.c +2 -2
 	/* 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;
Signature · 1 line
2.20.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko