From: Yinghai Lu <yinghai@kernel.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ram Pai <linuxram@us.ibm.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 5/5] PCI: Make pci_rescan_bus handle add_list
Date: Wed, 7 Dec 2011 00:53:04 -0800 [thread overview]
Message-ID: <1323247984-15281-6-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1323247984-15281-1-git-send-email-yinghai@kernel.org>
So it will allocate resource to hotplug bridge during remove/rescan.
Need to move that function to setup-bus.c so it could use
__pci_bus_size_bridges and __pci_bus_assign_resources
directly to take add_list.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/probe.c | 32 --------------------------------
drivers/pci/setup-bus.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 32 deletions(-)
Index: linux-2.6/drivers/pci/probe.c
===================================================================
--- linux-2.6.orig/drivers/pci/probe.c
+++ linux-2.6/drivers/pci/probe.c
@@ -1684,38 +1684,6 @@ unsigned int __ref pci_rescan_bus_bridge
return max;
}
-/**
- * pci_rescan_bus - scan a PCI bus for devices.
- * @bus: PCI bus to scan
- *
- * Scan a PCI bus and child buses for new devices, adds them,
- * and enables them.
- *
- * Returns the max number of subordinate bus discovered.
- */
-unsigned int __ref pci_rescan_bus(struct pci_bus *bus)
-{
- unsigned int max;
- struct pci_dev *dev;
-
- max = pci_scan_child_bus(bus);
-
- down_read(&pci_bus_sem);
- list_for_each_entry(dev, &bus->devices, bus_list)
- if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
- dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
- if (dev->subordinate)
- pci_bus_size_bridges(dev->subordinate);
- up_read(&pci_bus_sem);
-
- pci_bus_assign_resources(bus);
- pci_enable_bridges(bus);
- pci_bus_add_devices(bus);
-
- return max;
-}
-EXPORT_SYMBOL_GPL(pci_rescan_bus);
-
EXPORT_SYMBOL(pci_add_new_bus);
EXPORT_SYMBOL(pci_scan_slot);
EXPORT_SYMBOL(pci_scan_bridge);
Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1354,3 +1354,42 @@ enable_all:
pci_enable_bridges(parent);
}
EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources);
+
+#ifdef CONFIG_HOTPLUG
+/**
+ * pci_rescan_bus - scan a PCI bus for devices.
+ * @bus: PCI bus to scan
+ *
+ * Scan a PCI bus and child buses for new devices, adds them,
+ * and enables them.
+ *
+ * Returns the max number of subordinate bus discovered.
+ */
+unsigned int __ref pci_rescan_bus(struct pci_bus *bus)
+{
+ unsigned int max;
+ struct pci_dev *dev;
+ struct resource_list_x add_list; /* list of resources that
+ want additional resources */
+
+ max = pci_scan_child_bus(bus);
+
+ add_list.next = NULL;
+ down_read(&pci_bus_sem);
+ list_for_each_entry(dev, &bus->devices, bus_list)
+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
+ dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+ if (dev->subordinate)
+ __pci_bus_size_bridges(dev->subordinate,
+ &add_list);
+ up_read(&pci_bus_sem);
+ __pci_bus_assign_resources(bus, &add_list, NULL);
+ BUG_ON(add_list.next);
+
+ pci_enable_bridges(bus);
+ pci_bus_add_devices(bus);
+
+ return max;
+}
+EXPORT_SYMBOL_GPL(pci_rescan_bus);
+#endif
prev parent reply other threads:[~2011-12-07 8:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 8:52 [PATCH 0/5] PCI: make pci hotplug/rescan path to handle add_size list Yinghai Lu
2011-12-07 8:53 ` [PATCH 1/5] PCI : Calculate right add_size Yinghai Lu
2012-01-06 21:14 ` Jesse Barnes
2012-01-07 1:21 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 2/5] PCI: Try to assign required+option size at first Yinghai Lu
2012-01-06 21:49 ` Jesse Barnes
2012-01-07 3:46 ` Yinghai Lu
2012-01-07 5:51 ` Yinghai Lu
2012-01-07 5:53 ` Yinghai Lu
2012-01-07 6:12 ` Yinghai Lu
2012-01-07 4:49 ` Linus Torvalds
2012-01-09 6:01 ` Yinghai Lu
2012-01-11 6:20 ` Linus Torvalds
2012-01-11 18:01 ` Yinghai Lu
2012-01-13 16:39 ` Ram Pai
2012-01-13 23:28 ` Yinghai Lu
2012-01-15 16:05 ` Ram Pai
2012-01-16 1:14 ` Yinghai Lu
2012-01-16 3:26 ` Ram Pai
2012-01-16 4:54 ` Yinghai Lu
2012-01-16 10:29 ` Ram Pai
2012-01-16 17:13 ` Yinghai Lu
2012-01-16 21:30 ` Yinghai Lu
2012-01-16 19:59 ` Peter Henriksson
2012-01-16 21:41 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 3/5] PCI: Using add_list in pcie hotplug path Yinghai Lu
2012-01-06 21:58 ` Jesse Barnes
2012-01-07 1:30 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 4/5] PCI: Make rescan bus could increase bridge resource size if needed Yinghai Lu
2011-12-07 8:53 ` Yinghai Lu [this message]
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=1323247984-15281-6-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=jbarnes@virtuousgeek.org \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxram@us.ibm.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).