summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-12-28 14:23:10 -0700
committerSimon Glass <sjg@chromium.org>2019-01-14 17:47:13 -0700
commita61cbad78e67963944e7d719f0aee27b8aef6c02 (patch)
tree5b274a956002e4d7c37e19ae63293015be15f9bc /arch
parent3de04e771c4b230ad08c7b22871dedf5f69032b9 (diff)
downloadu-boot-a61cbad78e67963944e7d719f0aee27b8aef6c02.tar.gz
dm: serial: Adjust serial_getinfo() to use proper API
All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/lib/acpi_table.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index bfcf2adbf1..04058a60d7 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -354,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;
@@ -432,11 +435,9 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
break;
}
- ret = uclass_first_device_err(UCLASS_SERIAL, &dev);
- if (!ret)
+ serial_config = SERIAL_DEFAULT_CONFIG;
+ if (dev)
ret = serial_getconfig(dev, &serial_config);
- if (ret)
- serial_config = SERIAL_DEFAULT_CONFIG;
spcr->parity = SERIAL_GET_PARITY(serial_config);
spcr->stop_bits = SERIAL_GET_STOP(serial_config);