Skip to content

Commit 8624ebc

Browse files
andy-shevbjorn-helgaas
authored andcommitted
PCI/ACPI: Use acpi_evaluate_dsm_typed()
The acpi_evaluate_dsm_typed() provides a way to check the type of the object evaluated by _DSM call. Use it instead of open coded variant. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: "Rafael J. Wysocki" <[email protected]>
1 parent 83c0881 commit 8624ebc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/pci/pci-acpi.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,12 +1215,12 @@ void acpi_pci_add_bus(struct pci_bus *bus)
12151215
if (!pci_is_root_bus(bus))
12161216
return;
12171217

1218-
obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
1219-
DSM_PCI_POWER_ON_RESET_DELAY, NULL);
1218+
obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
1219+
DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER);
12201220
if (!obj)
12211221
return;
12221222

1223-
if (obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 1) {
1223+
if (obj->integer.value == 1) {
12241224
bridge = pci_find_host_bridge(bus);
12251225
bridge->ignore_reset_delay = 1;
12261226
}
@@ -1376,12 +1376,13 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
13761376
if (bridge->ignore_reset_delay)
13771377
pdev->d3cold_delay = 0;
13781378

1379-
obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3,
1380-
DSM_PCI_DEVICE_READINESS_DURATIONS, NULL);
1379+
obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3,
1380+
DSM_PCI_DEVICE_READINESS_DURATIONS, NULL,
1381+
ACPI_TYPE_PACKAGE);
13811382
if (!obj)
13821383
return;
13831384

1384-
if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 5) {
1385+
if (obj->package.count == 5) {
13851386
elements = obj->package.elements;
13861387
if (elements[0].type == ACPI_TYPE_INTEGER) {
13871388
value = (int)elements[0].integer.value / 1000;

0 commit comments

Comments
 (0)