[PATCH 08/11] PCI: Convert pci_resource_alignment() input parameters to const

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

pci_resource_alignment() calculates resource alignment and should not
alter its input structs. Make its input parameters const.

It requires making also pci_cardbus_resource_alignment() input const.

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

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 710803be3a79..e0fcc33dfef6 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -419,7 +419,7 @@ static inline bool pci_is_cardbus_bridge(struct pci_dev *dev)
return dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
}
#ifdef CONFIG_CARDBUS
-unsigned long pci_cardbus_resource_alignment(struct resource *res);
+unsigned long pci_cardbus_resource_alignment(const struct resource *res);
int pci_bus_size_cardbus_bridge(struct pci_bus *bus,
struct list_head *realloc_head);
int pci_cardbus_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
@@ -428,7 +428,7 @@ int pci_cardbus_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
int pci_setup_cardbus(char *str);

#else
-static inline unsigned long pci_cardbus_resource_alignment(struct resource *res)
+static inline unsigned long pci_cardbus_resource_alignment(const struct resource *res)
{
return 0;
}
@@ -1044,8 +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(struct pci_dev *dev,
- struct resource *res)
+static inline resource_size_t pci_resource_alignment(const struct pci_dev *dev,
+ const struct resource *res)
{
int resno = pci_resource_num(dev, res);

diff --git a/drivers/pci/setup-cardbus.c b/drivers/pci/setup-cardbus.c
index 1ebd13a1f730..0cba404080ad 100644
--- a/drivers/pci/setup-cardbus.c
+++ b/drivers/pci/setup-cardbus.c
@@ -22,7 +22,7 @@
static unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE;
static unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;

-unsigned long pci_cardbus_resource_alignment(struct resource *res)
+unsigned long pci_cardbus_resource_alignment(const struct resource *res)
{
if (res->flags & IORESOURCE_IO)
return pci_cardbus_io_size;
--
2.39.5