summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Johnson <nicholas.johnson-opensource@outlook.com.au>2019-06-22 13:13:50 -0400
committerBjorn Helgaas <bhelgaas@google.com>2019-07-02 14:56:54 -0400
commit6a381ea694c9da31ba8741c42a7f1b206c156841 (patch)
tree96b2edcbdb5b28dad0abb3f23f1cb2be3463769a
parent5c6bcc344b18dfb3b0ddcca6c26f6858879f73bf (diff)
PCI: Skip resource distribution when no hotplug bridges
If "hotplug_bridges == 0", "!dev->is_hotplug_bridge" is always true, so the loop that divides the remaining resources among hotplug-capable bridges does nothing. Check for "hotplug_bridges == 0" earlier, so we don't even have to compute the amount of remaining resources. No functional change intended. Link: https://lore.kernel.org/r/PS2P216MB0642C7A485649D2D787A1C6F80000@PS2P216MB0642.KORP216.PROD.OUTLOOK.COM Link: https://lore.kernel.org/r/20190622210310.180905-3-helgaas@kernel.org Signed-off-by: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/pci/setup-bus.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ee5be219dd41..79b1fa6519be 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1892,6 +1892,9 @@ static void pci_bus_distribute_available_resources(struct pci_bus *bus,
1892 return; 1892 return;
1893 } 1893 }
1894 1894
1895 if (hotplug_bridges == 0)
1896 return;
1897
1895 /* 1898 /*
1896 * Calculate the total amount of extra resource space we can 1899 * Calculate the total amount of extra resource space we can
1897 * pass to bridges below this one. This is basically the 1900 * pass to bridges below this one. This is basically the
@@ -1941,8 +1944,6 @@ static void pci_bus_distribute_available_resources(struct pci_bus *bus,
1941 * Distribute available extra resources equally between 1944 * Distribute available extra resources equally between
1942 * hotplug-capable downstream ports taking alignment into 1945 * hotplug-capable downstream ports taking alignment into
1943 * account. 1946 * account.
1944 *
1945 * Here hotplug_bridges is always != 0.
1946 */ 1947 */
1947 align = pci_resource_alignment(bridge, io_res); 1948 align = pci_resource_alignment(bridge, io_res);
1948 io = div64_ul(available_io, hotplug_bridges); 1949 io = div64_ul(available_io, hotplug_bridges);