Commit a58674ff8383f5b8f6a77f03c48f6a47840b9325

Authored by Bjorn Helgaas
1 parent 2c25e34c75

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.com
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Showing 6 changed files with 14 additions and 26 deletions Side-by-side Diff

arch/powerpc/kernel/pci-common.c
... ... @@ -1672,12 +1672,8 @@
1672 1672 /* Configure PCI Express settings */
1673 1673 if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
1674 1674 struct pci_bus *child;
1675   - list_for_each_entry(child, &bus->children, node) {
1676   - struct pci_dev *self = child->self;
1677   - if (!self)
1678   - continue;
1679   - pcie_bus_configure_settings(child, self->pcie_mpss);
1680   - }
  1675 + list_for_each_entry(child, &bus->children, node)
  1676 + pcie_bus_configure_settings(child);
1681 1677 }
1682 1678 }
1683 1679  
arch/tile/kernel/pci_gx.c
... ... @@ -508,13 +508,8 @@
508 508 rc_dev_cap.word);
509 509  
510 510 /* Configure PCI Express MPS setting. */
511   - list_for_each_entry(child, &root_bus->children, node) {
512   - struct pci_dev *self = child->self;
513   - if (!self)
514   - continue;
515   -
516   - pcie_bus_configure_settings(child, self->pcie_mpss);
517   - }
  511 + list_for_each_entry(child, &root_bus->children, node)
  512 + pcie_bus_configure_settings(child);
518 513  
519 514 /*
520 515 * Set the mac_config register in trio based on the MPS/MRS of the link.
... ... @@ -568,13 +568,8 @@
568 568 */
569 569 if (bus) {
570 570 struct pci_bus *child;
571   - list_for_each_entry(child, &bus->children, node) {
572   - struct pci_dev *self = child->self;
573   - if (!self)
574   - continue;
575   -
576   - pcie_bus_configure_settings(child, self->pcie_mpss);
577   - }
  571 + list_for_each_entry(child, &bus->children, node)
  572 + pcie_bus_configure_settings(child);
578 573 }
579 574  
580 575 if (bus && node != -1) {
drivers/pci/hotplug/pcihp_slot.c
... ... @@ -160,9 +160,8 @@
160 160 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)))
161 161 return;
162 162  
163   - if (dev->bus && dev->bus->self)
164   - pcie_bus_configure_settings(dev->bus,
165   - dev->bus->self->pcie_mpss);
  163 + if (dev->bus)
  164 + pcie_bus_configure_settings(dev->bus);
166 165  
167 166 memset(&hpp, 0, sizeof(hpp));
168 167 ret = pci_get_hp_params(dev, &hpp);
... ... @@ -1607,10 +1607,13 @@
1607 1607 * parents then children fashion. If this changes, then this code will not
1608 1608 * work as designed.
1609 1609 */
1610   -void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss)
  1610 +void pcie_bus_configure_settings(struct pci_bus *bus)
1611 1611 {
1612 1612 u8 smpss;
1613 1613  
  1614 + if (!bus->self)
  1615 + return;
  1616 +
1614 1617 if (!pci_is_pcie(bus->self))
1615 1618 return;
1616 1619  
... ... @@ -1625,7 +1628,7 @@
1625 1628 smpss = 0;
1626 1629  
1627 1630 if (pcie_bus_config == PCIE_BUS_SAFE) {
1628   - smpss = mpss;
  1631 + smpss = bus->self->pcie_mpss;
1629 1632  
1630 1633 pcie_find_smpss(bus->self, &smpss);
1631 1634 pci_walk_bus(bus, pcie_find_smpss, &smpss);
... ... @@ -675,7 +675,7 @@
675 675 /* these external functions are only available when PCI support is enabled */
676 676 #ifdef CONFIG_PCI
677 677  
678   -void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
  678 +void pcie_bus_configure_settings(struct pci_bus *bus);
679 679  
680 680 enum pcie_bus_config_types {
681 681 PCIE_BUS_TUNE_OFF,