public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Limonciello, Mario" <mario.limonciello@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Bjorn Helgaas <helgaas@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-acpi@vger.kernel.org,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Iain Lane <iain@orangesquash.org.uk>,
	Shyam-sundar S-k <Shyam-sundar.S-k@amd.com>
Subject: Re: [PATCH v9 3/3] PCI/ACPI: Use device constraints to decide PCI target state fallback policy
Date: Fri, 4 Aug 2023 10:56:32 -0500	[thread overview]
Message-ID: <36dfd3cf-37c6-a630-7ef6-376a339a8f8d@amd.com> (raw)
In-Reply-To: <20230804131703.GB14638@black.fi.intel.com>



On 8/4/2023 8:17 AM, Mika Westerberg wrote:
> 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"?

My aim was to make the caller use it a pass/fail function.

I'll adjust it so that the caller would look for >= 0 instead.

> 
>> +
>> +	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);
>> +}
>> +

      reply	other threads:[~2023-08-04 15:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  1:02 [PATCH v9 0/3] Fix wakeup problems on some AMD platforms Mario Limonciello
2023-08-04  1:02 ` [PATCH v9 1/3] ACPI: Add comments to clarify some #ifdef statements Mario Limonciello
2023-08-04  1:02 ` [PATCH v9 2/3] ACPI: x86: s2idle: Adjust constraints logic building Mario Limonciello
2023-08-04  4:31   ` Andy Shevchenko
2023-08-04  1:02 ` [PATCH v9 3/3] PCI/ACPI: Use device constraints to decide PCI target state fallback policy Mario Limonciello
2023-08-04  4:30   ` Andy Shevchenko
2023-08-04  4:37     ` Mario Limonciello
2023-08-04  4:57       ` Andy Shevchenko
2023-08-04 13:17   ` Mika Westerberg
2023-08-04 15:56     ` Limonciello, Mario [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36dfd3cf-37c6-a630-7ef6-376a339a8f8d@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=helgaas@kernel.org \
    --cc=iain@orangesquash.org.uk \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox