summaryrefslogtreecommitdiff
path: root/arch/x86/lib/acpi_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/lib/acpi_table.c')
-rw-r--r--arch/x86/lib/acpi_table.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 79bc2000bd..04058a60d7 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -342,6 +342,7 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
struct acpi_table_header *header = &(spcr->header);
struct serial_device_info serial_info = {0};
ulong serial_address, serial_offset;
+ struct udevice *dev;
uint serial_config;
uint serial_width;
int access_size;
@@ -353,7 +354,10 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
header->length = sizeof(struct acpi_spcr);
header->revision = 2;
- ret = serial_getinfo(&serial_info);
+ /* Read the device once, here. It is reused below */
+ ret = uclass_first_device_err(UCLASS_SERIAL, &dev);
+ if (!ret)
+ ret = serial_getinfo(dev, &serial_info);
if (ret)
serial_info.type = SERIAL_CHIP_UNKNOWN;
@@ -431,9 +435,9 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
break;
}
- ret = serial_getconfig(&serial_config);
- if (ret)
- serial_config = SERIAL_DEFAULT_CONFIG;
+ serial_config = SERIAL_DEFAULT_CONFIG;
+ if (dev)
+ ret = serial_getconfig(dev, &serial_config);
spcr->parity = SERIAL_GET_PARITY(serial_config);
spcr->stop_bits = SERIAL_GET_STOP(serial_config);