Message ID | 20231002135352.2603096-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [v1,1/1] PCI: ACPI: Switch to use acpi_evaluate_dsm_typed() | expand |
On Mon, Oct 2, 2023 at 3:54 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > 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. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> > --- > drivers/pci/pci-acpi.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c > index a05350a4e49c..cf108259aef6 100644 > --- a/drivers/pci/pci-acpi.c > +++ b/drivers/pci/pci-acpi.c > @@ -1215,12 +1215,12 @@ void acpi_pci_add_bus(struct pci_bus *bus) > if (!pci_is_root_bus(bus)) > return; > > - obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, > - DSM_PCI_POWER_ON_RESET_DELAY, NULL); > + obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, > + DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER); > if (!obj) > return; > > - if (obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 1) { > + if (obj->integer.value == 1) { > bridge = pci_find_host_bridge(bus); > bridge->ignore_reset_delay = 1; > } > @@ -1376,12 +1376,13 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev, > if (bridge->ignore_reset_delay) > pdev->d3cold_delay = 0; > > - obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3, > - DSM_PCI_DEVICE_READINESS_DURATIONS, NULL); > + obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3, > + DSM_PCI_DEVICE_READINESS_DURATIONS, NULL, > + ACPI_TYPE_PACKAGE); > if (!obj) > return; > > - if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 5) { > + if (obj->package.count == 5) { > elements = obj->package.elements; > if (elements[0].type == ACPI_TYPE_INTEGER) { > value = (int)elements[0].integer.value / 1000; > -- > 2.40.0.1.gaa8946217a0b >
On Mon, Oct 02, 2023 at 04:53:52PM +0300, Andy Shevchenko wrote: > 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. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Applied with Rafael's ack to pci/enumeration for v6.7, thanks! > --- > drivers/pci/pci-acpi.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c > index a05350a4e49c..cf108259aef6 100644 > --- a/drivers/pci/pci-acpi.c > +++ b/drivers/pci/pci-acpi.c > @@ -1215,12 +1215,12 @@ void acpi_pci_add_bus(struct pci_bus *bus) > if (!pci_is_root_bus(bus)) > return; > > - obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, > - DSM_PCI_POWER_ON_RESET_DELAY, NULL); > + obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, > + DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER); > if (!obj) > return; > > - if (obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 1) { > + if (obj->integer.value == 1) { > bridge = pci_find_host_bridge(bus); > bridge->ignore_reset_delay = 1; > } > @@ -1376,12 +1376,13 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev, > if (bridge->ignore_reset_delay) > pdev->d3cold_delay = 0; > > - obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3, > - DSM_PCI_DEVICE_READINESS_DURATIONS, NULL); > + obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3, > + DSM_PCI_DEVICE_READINESS_DURATIONS, NULL, > + ACPI_TYPE_PACKAGE); > if (!obj) > return; > > - if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 5) { > + if (obj->package.count == 5) { > elements = obj->package.elements; > if (elements[0].type == ACPI_TYPE_INTEGER) { > value = (int)elements[0].integer.value / 1000; > -- > 2.40.0.1.gaa8946217a0b >
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a05350a4e49c..cf108259aef6 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1215,12 +1215,12 @@ void acpi_pci_add_bus(struct pci_bus *bus) if (!pci_is_root_bus(bus)) return; - obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, - DSM_PCI_POWER_ON_RESET_DELAY, NULL); + obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3, + DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER); if (!obj) return; - if (obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 1) { + if (obj->integer.value == 1) { bridge = pci_find_host_bridge(bus); bridge->ignore_reset_delay = 1; } @@ -1376,12 +1376,13 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev, if (bridge->ignore_reset_delay) pdev->d3cold_delay = 0; - obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3, - DSM_PCI_DEVICE_READINESS_DURATIONS, NULL); + obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3, + DSM_PCI_DEVICE_READINESS_DURATIONS, NULL, + ACPI_TYPE_PACKAGE); if (!obj) return; - if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 5) { + if (obj->package.count == 5) { elements = obj->package.elements; if (elements[0].type == ACPI_TYPE_INTEGER) { value = (int)elements[0].integer.value / 1000;
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. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pci/pci-acpi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)