[PATCH v0 01/13] PCI: Set bus's device name later

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The PCI bus's device name is based upon its bus number. An upcoming
patch will allow the user to explicitly set a bus's number and
subordinate; thus its name will no longer be accurate. The solution is
to move when a bus's name is set to be a bit later within
pci_alloc_child_bus().

Furthermore, the name is currently based upon busnr. It is more accurate
to use child->number, even though at this time both values are the same.

Signed-off-by: Jason Tang <jason.tang2@xxxxxxx>
---
 drivers/pci/probe.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8d2f400..873030b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -684,7 +684,6 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	 * now as the parent is not properly set up yet.
 	 */
 	child->dev.class = &pcibus_class;
-	dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
 
 	/*
 	 * Set up the primary, secondary and subordinate
@@ -695,6 +694,8 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	child->busn_res.end = 0xff;
 
 	if (!bridge) {
+		dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child),
+			     child->number);
 		child->dev.parent = parent->bridge;
 		goto add_dev;
 	}
@@ -702,6 +703,10 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	child->self = bridge;
 	child->bridge = get_device(&bridge->dev);
 	child->dev.parent = child->bridge;
+
+	dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child),
+		     child->number);
+
 	pci_set_bus_of_node(child);
 	pci_set_bus_speed(child);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux