All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Andreas Noever <andreas.noever@gmail.com>,
	Keith Busch <keith.busch@intel.com>
Subject: Re: [PATCH 6/9] PCI: Unfold conditions to block runtime PM on PCIe ports
Date: Thu, 20 Oct 2016 17:18:10 +0300	[thread overview]
Message-ID: <20161020141810.GM24289@lahna.fi.intel.com> (raw)
In-Reply-To: <ba2f9f322b4aeea1aeb01f98a2eda8efe055494f.1476875113.git.lukas@wunner.de>

On Wed, Oct 19, 2016 at 04:07:13PM +0200, Lukas Wunner wrote:
> The conditions to block D3 on parent ports are currently condensed into
> a single expression in pci_dev_check_d3cold().  Upcoming commits will
> add further conditions for hotplug ports, making this expression fairly
> large and impenetrable.  Unfold the conditions to maintain readability
> when they are amended.
> 
> No functional change intended.

This actually results a functional change because now all the conditions
are evaluated whereas previosly it bailed out immediately when the
condition was true ;-)

Not that it matters here.

> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
>  drivers/pci/pci.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index a19056e..f1ddb6b 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2270,19 +2270,20 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge)
>  static int pci_dev_check_d3cold(struct pci_dev *dev, void *data)
>  {
>  	bool *d3cold_ok = data;
> -	bool no_d3cold;
>  
> -	/*
> -	 * The device needs to be allowed to go D3cold and if it is wake
> -	 * capable to do so from D3cold.
> -	 */
> -	no_d3cold = dev->no_d3cold || !dev->d3cold_allowed ||
> -		(device_may_wakeup(&dev->dev) && !pci_pme_capable(dev, PCI_D3cold)) ||
> -		!pci_power_manageable(dev);
> +	/* The device needs to be allowed to go D3cold. */
> +	if (dev->no_d3cold || !dev->d3cold_allowed)
> +		*d3cold_ok = false;
> +
> +	/* If it is wakeup capable it must be able to do so from D3cold. */
> +	if (device_may_wakeup(&dev->dev) && !pci_pme_capable(dev, PCI_D3cold))
> +		*d3cold_ok = false;
>  
> -	*d3cold_ok = !no_d3cold;
> +	/* If it is a bridge it must be allowed to go to D3. */
> +	if (!pci_power_manageable(dev))
> +		*d3cold_ok = false;
>  
> -	return no_d3cold;
> +	return !*d3cold_ok;
>  }
>  
>  /*
> -- 
> 2.9.3

  reply	other threads:[~2016-10-20 14:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 14:07 [PATCH 0/9] PCIe port PM: high gloss polish & hotplug support Lukas Wunner
2016-10-19 14:07 ` [PATCH 9/9] PCI: pciehp: Add runtime PM support for PCIe hotplug ports Lukas Wunner
2016-10-19 14:07 ` [PATCH 2/9] PCI: Autosense device removal in pci_bridge_d3_update() Lukas Wunner
2016-10-19 14:07 ` [PATCH 3/9] PCI: Speed up algorithm " Lukas Wunner
2016-10-19 14:07 ` [PATCH 7/9] ACPI / hotplug / PCI: Use cached copy of PCI_EXP_SLTCAP_HPC bit Lukas Wunner
2016-10-19 14:07 ` [PATCH 4/9] PCI: Activate runtime PM on a PCIe port only if it can suspend Lukas Wunner
2016-10-19 14:07 ` [PATCH 1/9] PCI: Don't acquire ref on parent in pci_bridge_d3_update() Lukas Wunner
2016-10-19 14:07 ` [PATCH 8/9] ACPI / hotplug / PCI: Make device_is_managed_by_native_pciehp() public Lukas Wunner
2016-10-19 14:07 ` [PATCH 5/9] PCI: Consolidate conditions to allow runtime PM on PCIe ports Lukas Wunner
2016-10-19 14:07 ` [PATCH 6/9] PCI: Unfold conditions to block " Lukas Wunner
2016-10-20 14:18   ` Mika Westerberg [this message]
2016-10-25  5:28     ` Lukas Wunner
2016-10-20 14:27 ` [PATCH 0/9] PCIe port PM: high gloss polish & hotplug support Mika Westerberg
2016-10-20 23:21 ` Rafael J. Wysocki

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=20161020141810.GM24289@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andreas.noever@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rafael.j.wysocki@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.