Re: [PATCH v7-incomplete 1/3] PCI: Move PRESERVE_BOOT_CONFIG _DSM evaluation to pci_register_host_bridge()

From: Andy Shevchenko
Date: Mon Apr 22 2024 - 03:46:42 EST


Sun, Apr 21, 2024 at 02:09:12PM -0500, Bjorn Helgaas kirjoitti:
> From: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
>
> Move the PRESERVE_BOOT_CONFIG _DSM evaluation from acpi_pci_root_create()
> to pci_register_host_bridge().
>
> This will help unify the ACPI _DSM path and the DT-based
> "linux,pci-probe-only" paths.

..

> +bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge)
> +{
> + if (ACPI_HANDLE(&host_bridge->dev)) {

Wouldn't the below looks nicer if you invert the conditional?

handle = ACPI_HANDLE(...);

if (!handle)
return false;

...

> + union acpi_object *obj;
> +
> + /*
> + * Evaluate the "PCI Boot Configuration" _DSM Function. If it
> + * exists and returns 0, we must preserve any PCI resource
> + * assignments made by firmware for this host bridge.
> + */
> + obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(&host_bridge->dev),
> + &pci_acpi_dsm_guid,
> + 1, DSM_PCI_PRESERVE_BOOT_CONFIG,
> + NULL, ACPI_TYPE_INTEGER);
> + if (obj && obj->integer.value == 0)
> + return true;
> + ACPI_FREE(obj);
> + }
> +
> + return false;
> +}


--
With Best Regards,
Andy Shevchenko