]> www.infradead.org Git - users/hch/misc.git/commit
PCI: Refactor distributing available memory to use loops
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 29 Aug 2025 13:11:09 +0000 (16:11 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 16 Sep 2025 16:19:55 +0000 (11:19 -0500)
commit4292a1e45fd464551efac7b2b52fd3606e956c28
tree73376261fb33816962f76b6cdf6e221d0e7d261c
parentae88d0b9c57f70086dca4f8ccb14c64b2f144c58
PCI: Refactor distributing available memory to use loops

pci_bus_distribute_available_resources() and
pci_bridge_distribute_available_resources() retain bridge window resources
and related data needed for distributing the available window in
independent variables for io, memory, and prefetchable memory windows. The
code is essentially the same for all of them and therefore repeated three
times with different variable names.

Refactor pci_bus_distribute_available_resources() to take an array. This
is complicated slightly by the function taking advantage of passing the
struct as value, which cannot be done for arrays in C. Therefore, copy the
data into a local array in the stack in the first loop.

Variable names are (hopefully) improved slightly as well.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250829131113.36754-21-ilpo.jarvinen@linux.intel.com
drivers/pci/setup-bus.c
include/linux/pci.h