linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Use pci_is_root_bus() to check for root bus
@ 2013-11-05 23:29 Bjorn Helgaas
  2013-11-06  3:39 ` Yinghai Lu
  0 siblings, 1 reply; 12+ messages in thread
From: Bjorn Helgaas @ 2013-11-05 23:29 UTC (permalink / raw)
  To: linux-pci; +Cc: Wei Yang, Yinghai Lu

pci_enable_device_flags() and pci_enable_bridge() assume that
"bus->self == NULL" means that "bus" is a root bus.  That assumption is
false; see 2ba29e270e97 ("PCI: Use pci_is_root_bus() to check for root
bus") for details.

This patch changes them to use pci_is_root_bus() instead.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 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 ac40f90..de65bf7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1150,10 +1150,8 @@ static void pci_enable_bridge(struct pci_dev *dev)
 {
 	int retval;
 
-	if (!dev)
-		return;
-
-	pci_enable_bridge(dev->bus->self);
+	if (!pci_is_root_bus(dev->bus))
+		pci_enable_bridge(dev->bus->self);
 
 	if (pci_is_enabled(dev)) {
 		if (!dev->is_busmaster)
@@ -1188,7 +1186,8 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
 	if (atomic_inc_return(&dev->enable_cnt) > 1)
 		return 0;		/* already enabled */
 
-	pci_enable_bridge(dev->bus->self);
+	if (!pci_is_root_bus(dev->bus))
+		pci_enable_bridge(dev->bus->self);
 
 	/* only skip sriov related */
 	for (i = 0; i <= PCI_ROM_RESOURCE; i++)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-11-08  1:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05 23:29 [PATCH] PCI: Use pci_is_root_bus() to check for root bus Bjorn Helgaas
2013-11-06  3:39 ` Yinghai Lu
2013-11-06 18:15   ` Bjorn Helgaas
2013-11-06 19:56     ` Yinghai Lu
2013-11-06 20:12       ` Bjorn Helgaas
2013-11-06 20:33         ` Yinghai Lu
2013-11-06 20:46           ` Bjorn Helgaas
2013-11-07  0:28             ` Yinghai Lu
2013-11-07 22:03               ` Bjorn Helgaas
2013-11-07  3:00     ` Wei Yang
2013-11-07 21:59       ` Bjorn Helgaas
2013-11-08  1:35         ` Wei Yang

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).