[PATCH 09/11] PCI: Move pci_resource_alignment() to setup-res.c file

Ilpo Järvinen
2026-04-29T12:28:14Z

pci_resource_alignment() is a bit one the complex side to have in a
header so put it into setup-res.c.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/pci/pci.h | 13 ++-----------
drivers/pci/setup-res.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index e0fcc33dfef6..472b6c2f7c4d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1044,17 +1044,8 @@ static inline void pci_suspend_ptm(struct pci_dev *dev) { }
static inline void pci_resume_ptm(struct pci_dev *dev) { }
#endif

-static inline resource_size_t pci_resource_alignment(const struct pci_dev *dev,
- const struct resource *res)
-{
- int resno = pci_resource_num(dev, res);
-
- if (pci_resource_is_iov(resno))
- return pci_sriov_resource_alignment(dev, resno);
- if (dev->class >> 8 == PCI_CLASS_BRIDGE_CARDBUS)
- return pci_cardbus_resource_alignment(res);
- return resource_alignment(res);
-}
+resource_size_t pci_resource_alignment(const struct pci_dev *dev,
+ const struct resource *res);

resource_size_t pci_min_window_alignment(struct pci_bus *bus,
unsigned long type);
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 0d203325562b..18e8775ea848 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -246,6 +246,18 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
return 0;
}

+resource_size_t pci_resource_alignment(const struct pci_dev *dev,
+ const struct resource *res)
+{
+ int resno = pci_resource_num(dev, res);
+
+ if (pci_resource_is_iov(resno))
+ return pci_sriov_resource_alignment(dev, resno);
+ if (dev->class >> 8 == PCI_CLASS_BRIDGE_CARDBUS)
+ return pci_cardbus_resource_alignment(res);
+ return resource_alignment(res);
+}
+
/*
* For mem bridge windows, try to relocate tail remainder space to space
* before res->start if there's enough free space there. This enables
--
2.39.5