From: Thierry Reding <thierry.reding@gmail.com>
To: David Miller <davem@davemloft.net>,
Bjorn Helgaas <bhelgaas@google.com>,
Ding Tianhong <dingtianhong@huawei.com>,
Michael Ellerman <mpe@ellerman.id.au>
Cc: mark.rutland@arm.com, gabriele.paoloni@huawei.com,
asit.k.mallick@intel.com, catalin.marinas@arm.com,
will.deacon@arm.com, linuxarm@huawei.com,
alexander.duyck@gmail.com, ashok.raj@intel.com,
eric.dumazet@gmail.com, jeffrey.t.kirsher@intel.com,
linux-pci@vger.kernel.org, ganeshgr@chelsio.com,
Bob.Shaw@amd.com, leedom@chelsio.com, patrick.j.cramer@intel.com,
werner@chelsio.com, linux-arm-kernel@lists.infradead.org,
amira@mellanox.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, David.Laight@aculab.com,
Suravee.Suthikulpanit@amd.com, robin.murphy@arm.com,
l.stach@pengutronix.de
Subject: [PATCH] PCI: Allow PCI express root ports to find themselves
Date: Thu, 17 Aug 2017 13:06:14 +0200 [thread overview]
Message-ID: <20170817110614.11454-1-thierry.reding@gmail.com> (raw)
In-Reply-To: <1502936730-7368-1-git-send-email-dingtianhong@huawei.com>
From: Thierry Reding <treding@nvidia.com>
If the pci_find_pcie_root_port() function is called on a root port
itself, return the root port rather than NULL.
This effectively reverts commit 0e405232871d6 ("PCI: fix oops when
try to find Root Port for a PCI device") which added an extra check
that would now be redundant.
Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported")
Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 Completion erratum")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
This applies on top of and was tested on next-20170817.
Michael, it'd be great if you could test this one again to clarify
whether or not the fix that's already in Linus' tree is still needed, or
whether it's indeed obsoleted by this patch.
drivers/pci/pci.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b05c587e335a..dd56c1c05614 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -514,7 +514,7 @@ EXPORT_SYMBOL(pci_find_resource);
*/
struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
{
- struct pci_dev *bridge, *highest_pcie_bridge = NULL;
+ struct pci_dev *bridge, *highest_pcie_bridge = dev;
bridge = pci_upstream_bridge(dev);
while (bridge && pci_is_pcie(bridge)) {
@@ -522,11 +522,10 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
bridge = pci_upstream_bridge(bridge);
}
- if (highest_pcie_bridge &&
- pci_pcie_type(highest_pcie_bridge) == PCI_EXP_TYPE_ROOT_PORT)
- return highest_pcie_bridge;
+ if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT)
+ return NULL;
- return NULL;
+ return highest_pcie_bridge;
}
EXPORT_SYMBOL(pci_find_pcie_root_port);
--
2.13.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-08-17 11:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 2:25 [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() Ding Tianhong
2017-08-17 2:42 ` David Miller
2017-08-17 10:51 ` Thierry Reding
2017-08-17 12:40 ` Ding Tianhong
2017-08-17 13:30 ` Thierry Reding
2017-08-17 13:38 ` Ding Tianhong
2017-08-17 11:06 ` Thierry Reding [this message]
2017-08-17 16:58 ` [PATCH] PCI: Allow PCI express root ports to find themselves Bjorn Helgaas
2017-08-18 1:29 ` Shawn Lin
2017-08-18 4:32 ` Michael Ellerman
2017-08-18 23:14 ` David Miller
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=20170817110614.11454-1-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=Bob.Shaw@amd.com \
--cc=David.Laight@aculab.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=alexander.duyck@gmail.com \
--cc=amira@mellanox.com \
--cc=ashok.raj@intel.com \
--cc=asit.k.mallick@intel.com \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=dingtianhong@huawei.com \
--cc=eric.dumazet@gmail.com \
--cc=gabriele.paoloni@huawei.com \
--cc=ganeshgr@chelsio.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=l.stach@pengutronix.de \
--cc=leedom@chelsio.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=patrick.j.cramer@intel.com \
--cc=robin.murphy@arm.com \
--cc=werner@chelsio.com \
--cc=will.deacon@arm.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).