Commit a58674ff authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: Simplify pcie_bus_configure_settings() interface

Based on a patch by Jon Mason (see URL below).

All users of pcie_bus_configure_settings() pass arguments of the form
"bus, bus->self->pcie_mpss".  The "mpss" argument is redundant since we
can easily look it up internally.  In addition, all callers check
"bus->self" for NULL, which we can also do internally.

This patch simplifies the interface and the callers.  No functional change.

Reference: http://lkml.kernel.org/r/1317048850-30728-2-git-send-email-mason@myri.comSigned-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 2c25e34c
...@@ -1672,12 +1672,8 @@ void pcibios_scan_phb(struct pci_controller *hose) ...@@ -1672,12 +1672,8 @@ void pcibios_scan_phb(struct pci_controller *hose)
/* Configure PCI Express settings */ /* Configure PCI Express settings */
if (bus && !pci_has_flag(PCI_PROBE_ONLY)) { if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
struct pci_bus *child; struct pci_bus *child;
list_for_each_entry(child, &bus->children, node) { list_for_each_entry(child, &bus->children, node)
struct pci_dev *self = child->self; pcie_bus_configure_settings(child);
if (!self)
continue;
pcie_bus_configure_settings(child, self->pcie_mpss);
}
} }
} }
......
...@@ -508,13 +508,8 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller) ...@@ -508,13 +508,8 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller)
rc_dev_cap.word); rc_dev_cap.word);
/* Configure PCI Express MPS setting. */ /* Configure PCI Express MPS setting. */
list_for_each_entry(child, &root_bus->children, node) { list_for_each_entry(child, &root_bus->children, node)
struct pci_dev *self = child->self; pcie_bus_configure_settings(child);
if (!self)
continue;
pcie_bus_configure_settings(child, self->pcie_mpss);
}
/* /*
* Set the mac_config register in trio based on the MPS/MRS of the link. * Set the mac_config register in trio based on the MPS/MRS of the link.
......
...@@ -568,13 +568,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) ...@@ -568,13 +568,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
*/ */
if (bus) { if (bus) {
struct pci_bus *child; struct pci_bus *child;
list_for_each_entry(child, &bus->children, node) { list_for_each_entry(child, &bus->children, node)
struct pci_dev *self = child->self; pcie_bus_configure_settings(child);
if (!self)
continue;
pcie_bus_configure_settings(child, self->pcie_mpss);
}
} }
if (bus && node != -1) { if (bus && node != -1) {
......
...@@ -160,9 +160,8 @@ void pci_configure_slot(struct pci_dev *dev) ...@@ -160,9 +160,8 @@ void pci_configure_slot(struct pci_dev *dev)
(dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)))
return; return;
if (dev->bus && dev->bus->self) if (dev->bus)
pcie_bus_configure_settings(dev->bus, pcie_bus_configure_settings(dev->bus);
dev->bus->self->pcie_mpss);
memset(&hpp, 0, sizeof(hpp)); memset(&hpp, 0, sizeof(hpp));
ret = pci_get_hp_params(dev, &hpp); ret = pci_get_hp_params(dev, &hpp);
......
...@@ -1607,10 +1607,13 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data) ...@@ -1607,10 +1607,13 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
* parents then children fashion. If this changes, then this code will not * parents then children fashion. If this changes, then this code will not
* work as designed. * work as designed.
*/ */
void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss) void pcie_bus_configure_settings(struct pci_bus *bus)
{ {
u8 smpss; u8 smpss;
if (!bus->self)
return;
if (!pci_is_pcie(bus->self)) if (!pci_is_pcie(bus->self))
return; return;
...@@ -1625,7 +1628,7 @@ void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss) ...@@ -1625,7 +1628,7 @@ void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss)
smpss = 0; smpss = 0;
if (pcie_bus_config == PCIE_BUS_SAFE) { if (pcie_bus_config == PCIE_BUS_SAFE) {
smpss = mpss; smpss = bus->self->pcie_mpss;
pcie_find_smpss(bus->self, &smpss); pcie_find_smpss(bus->self, &smpss);
pci_walk_bus(bus, pcie_find_smpss, &smpss); pci_walk_bus(bus, pcie_find_smpss, &smpss);
......
...@@ -675,7 +675,7 @@ struct pci_driver { ...@@ -675,7 +675,7 @@ struct pci_driver {
/* these external functions are only available when PCI support is enabled */ /* these external functions are only available when PCI support is enabled */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); void pcie_bus_configure_settings(struct pci_bus *bus);
enum pcie_bus_config_types { enum pcie_bus_config_types {
PCIE_BUS_TUNE_OFF, PCIE_BUS_TUNE_OFF,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment