linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Dutile <ddutile@redhat.com>
To: Myron Stowe <myron.stowe@redhat.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, xudong.hao@linux.intel.com,
	yu.zhao@intel.com
Subject: Re: [PATCH 2/4] PCI: Remove redundant checking in PCI Express capability routines
Date: Fri, 01 Jun 2012 18:02:07 -0400	[thread overview]
Message-ID: <4FC93BDF.8050900@redhat.com> (raw)
In-Reply-To: <20120601211631.20328.53913.stgit@amt.stowe>

On 06/01/2012 05:16 PM, Myron Stowe wrote:
> There are a number of redundant pci_is_pcie() checks in various PCI
> Express capabilities related routines like the following:
>
>      if (!pci_is_pcie(dev))
> 	return false;
>
>      pos = pci_pcie_cap(dev);
>      if (!pos)
> 	return false;
>
> The current pci_is_pcie() implementation is merely:
>
>      static inline bool pci_is_pcie(struct pci_dev *dev)
>      {
>          return !!pci_pcie_cap(dev);
>      }
>
> so we can just drop the pci_is_pcie() test in such cases.
>
> Suggested by Bjorn Helgaas in -
> http://marc.info/?l=linux-pci&m=130463494319762&w=2
>
> Signed-off-by: Myron Stowe<myron.stowe@redhat.com>
> ---
>
you can add my ack to this patch.

>   drivers/pci/pci.c |   14 +-------------
>   1 files changed, 1 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 64471b1..ff0beb0 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1995,7 +1995,7 @@ void pci_enable_ari(struct pci_dev *dev)
>   		return;
>
>   	bridge = dev->bus->self;
> -	if (!bridge || !pci_is_pcie(bridge))
> +	if (!bridge)
>   		return;
>
>   	pos = pci_pcie_cap(bridge);
> @@ -2055,9 +2055,6 @@ void pci_disable_ido(struct pci_dev *dev, unsigned long type)
>   	int pos;
>   	u16 ctrl;
>
> -	if (!pci_is_pcie(dev))
> -		return;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return;
> @@ -2097,9 +2094,6 @@ int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type)
>   	u16 ctrl;
>   	int ret;
>
> -	if (!pci_is_pcie(dev))
> -		return -ENOTSUPP;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return -ENOTSUPP;
> @@ -2150,9 +2144,6 @@ void pci_disable_obff(struct pci_dev *dev)
>   	int pos;
>   	u16 ctrl;
>
> -	if (!pci_is_pcie(dev))
> -		return;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return;
> @@ -2175,9 +2166,6 @@ static bool pci_ltr_supported(struct pci_dev *dev)
>   	int pos;
>   	u32 cap;
>
> -	if (!pci_is_pcie(dev))
> -		return false;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return false;
>


  reply	other threads:[~2012-06-01 22:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 21:16 [PATCH 0/4] PCI: PCIe capability structure related cleanup/fixes Myron Stowe
2012-06-01 21:16 ` [PATCH 1/4] PCI: make pci_ltr_supported static Myron Stowe
2012-06-01 22:02   ` Don Dutile
2012-06-01 21:16 ` [PATCH 2/4] PCI: Remove redundant checking in PCI Express capability routines Myron Stowe
2012-06-01 22:02   ` Don Dutile [this message]
2012-06-01 21:16 ` [PATCH 3/4] PCI: Add pci_pcie_cap2() check for PCIe feature capabilities >= v2 Myron Stowe
2012-06-01 21:58   ` Don Dutile
2012-06-01 21:16 ` [PATCH 4/4] PCI: Remove redundant capabilities checking in pci_{save, restore}_pcie_state Myron Stowe
2012-06-01 22:00   ` Don Dutile
2012-06-12  2:52 ` [PATCH 0/4] PCI: PCIe capability structure related cleanup/fixes Bjorn Helgaas
2012-06-12 16:34   ` Myron Stowe
2012-06-12 16:44     ` Bjorn Helgaas

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=4FC93BDF.8050900@redhat.com \
    --to=ddutile@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=myron.stowe@redhat.com \
    --cc=xudong.hao@linux.intel.com \
    --cc=yu.zhao@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;
as well as URLs for NNTP newsgroup(s).