[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230804131703.GB14638@black.fi.intel.com>
Date: Fri, 4 Aug 2023 16:17:03 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Mario Limonciello <mario.limonciello@....com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-acpi@...r.kernel.org,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Iain Lane <iain@...ngesquash.org.uk>,
Shyam-sundar S-k <Shyam-sundar.S-k@....com>
Subject: Re: [PATCH v9 3/3] PCI/ACPI: Use device constraints to decide PCI
target state fallback policy
On Thu, Aug 03, 2023 at 08:02:29PM -0500, Mario Limonciello wrote:
> +/**
> + * acpi_pci_device_constraint - determine if the platform has a contraint for the device
> + * @dev: PCI device to check
> + * @result (out): the constraint specified by the platform
> + *
> + * If the platform has specified a constraint for a device, this function will
> + * return 0 and set @result to the constraint.
> + * Otherwise, it will return an error code.
> + */
> +int acpi_pci_device_constraint(struct pci_dev *dev, int *result)
> +{
> + int constraint;
> +
> + constraint = acpi_get_lps0_constraint(&dev->dev);
> + pci_dbg(dev, "ACPI device constraint: %d\n", constraint);
> + if (constraint < 0)
> + return constraint;
> + *result = constraint;
Is there something preventing to return the constraint directly instead
of storing it into "result"?
> +
> + return 0;
> +}
> +
> static void acpi_pci_config_space_access(struct pci_dev *dev, bool enable)
> {
> int val = enable ? ACPI_REG_CONNECT : ACPI_REG_DISCONNECT;
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 60230da957e0c..6c70f921467c6 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1082,6 +1082,14 @@ static inline bool platform_pci_bridge_d3(struct pci_dev *dev)
> return acpi_pci_bridge_d3(dev);
> }
>
> +static inline int platform_get_constraint(struct pci_dev *dev, int *result)
Ditto here.
> +{
> + if (pci_use_mid_pm())
> + return -ENODEV;
> +
> + return acpi_pci_device_constraint(dev, result);
> +}
> +
Powered by blists - more mailing lists