* [PATCH 2/4] PCI: Move resource reassignment func declarations into pci/pci.h
2025-03-11 17:46 [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Ilpo Järvinen
@ 2025-03-11 17:46 ` Ilpo Järvinen
2025-03-11 17:47 ` [PATCH 3/4] PCI: Make pci_setup_bridge() static Ilpo Järvinen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2025-03-11 17:46 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Ilpo Järvinen
Neither pci_reassign_bridge_resources() nor pci_reassign_resource() is
used outside of the PCI subsystem. They seem to be naturally static
functions but since resource fitting/assignment is split between
setup-bus.c and setup-res.c, they fall into different sides of the
divide and need to be declared).
Move the declarations of pci_reassign_bridge_resources() and
pci_reassign_resource() into pci/pci.h to keep them internal to PCI
subsystem.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/pci/pci.h | 2 ++
include/linux/pci.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index be2f43c9d3b0..3e05e5506041 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -310,6 +310,8 @@ struct device *pci_get_host_bridge_device(struct pci_dev *dev);
void pci_put_host_bridge_device(struct device *dev);
unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
+int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type);
+int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
int pci_configure_extended_tags(struct pci_dev *dev, void *ign);
bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d788acf2686a..c629962f4ccd 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1396,7 +1396,6 @@ void pci_reset_secondary_bus(struct pci_dev *dev);
void pcibios_reset_secondary_bus(struct pci_dev *dev);
void pci_update_resource(struct pci_dev *dev, int resno);
int __must_check pci_assign_resource(struct pci_dev *dev, int i);
-int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
void pci_release_resource(struct pci_dev *dev, int resno);
static inline int pci_rebar_bytes_to_size(u64 bytes)
{
@@ -1476,7 +1475,6 @@ void pci_assign_unassigned_resources(void);
void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
-int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type);
int pci_enable_resources(struct pci_dev *, int mask);
void pci_assign_irq(struct pci_dev *dev);
struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res);
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] PCI: Make pci_setup_bridge() static
2025-03-11 17:46 [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Ilpo Järvinen
2025-03-11 17:46 ` [PATCH 2/4] PCI: Move resource reassignment func declarations into pci/pci.h Ilpo Järvinen
@ 2025-03-11 17:47 ` Ilpo Järvinen
2025-03-11 17:47 ` [PATCH 4/4] PCI: Move cardbus IO size declarations into pci/pci.h Ilpo Järvinen
2025-03-12 20:44 ` [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Bjorn Helgaas
3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2025-03-11 17:47 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Ilpo Järvinen
pci_setup_bridge() is only used within setup-bus.c. Therefore, make it
a static function.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/pci/setup-bus.c | 2 +-
include/linux/pci.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 5e00cecf1f1a..836d260328a8 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -694,7 +694,7 @@ void __weak pcibios_setup_bridge(struct pci_bus *bus, unsigned long type)
{
}
-void pci_setup_bridge(struct pci_bus *bus)
+static void pci_setup_bridge(struct pci_bus *bus)
{
unsigned long type = IORESOURCE_IO | IORESOURCE_MEM |
IORESOURCE_PREFETCH;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c629962f4ccd..9a703355ef06 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1634,7 +1634,6 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
void *userdata);
int pci_cfg_space_size(struct pci_dev *dev);
unsigned char pci_bus_max_busnr(struct pci_bus *bus);
-void pci_setup_bridge(struct pci_bus *bus);
resource_size_t pcibios_window_alignment(struct pci_bus *bus,
unsigned long type);
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] PCI: Move cardbus IO size declarations into pci/pci.h
2025-03-11 17:46 [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Ilpo Järvinen
2025-03-11 17:46 ` [PATCH 2/4] PCI: Move resource reassignment func declarations into pci/pci.h Ilpo Järvinen
2025-03-11 17:47 ` [PATCH 3/4] PCI: Make pci_setup_bridge() static Ilpo Järvinen
@ 2025-03-11 17:47 ` Ilpo Järvinen
2025-03-12 20:44 ` [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Bjorn Helgaas
3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2025-03-11 17:47 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Ilpo Järvinen
For some reason, cardbus related io/mem size declarations are in
linux/pci.h, whereas non-cardbus sizes are already in pci/pci.h.
Move all them into one place in pci/pci.h.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/pci/pci.h | 2 ++
include/linux/pci.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 3e05e5506041..f88e28519f5c 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -266,6 +266,8 @@ extern unsigned long pci_hotplug_io_size;
extern unsigned long pci_hotplug_mmio_size;
extern unsigned long pci_hotplug_mmio_pref_size;
extern unsigned long pci_hotplug_bus_size;
+extern unsigned long pci_cardbus_io_size;
+extern unsigned long pci_cardbus_mem_size;
/**
* pci_match_one_device - Tell if a PCI device structure has a matching
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9a703355ef06..f9424478a19a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2332,8 +2332,6 @@ extern int pci_pci_problems;
#define PCIPCI_ALIMAGIK 32 /* Need low latency setting */
#define PCIAGP_FAIL 64 /* No PCI to AGP DMA */
-extern unsigned long pci_cardbus_io_size;
-extern unsigned long pci_cardbus_mem_size;
extern u8 pci_dfl_cache_line_size;
extern u8 pci_cache_line_size;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h
2025-03-11 17:46 [PATCH 1/4] PCI: Move pci_rescan_bus_bridge_resize() declaration to pci/pci.h Ilpo Järvinen
` (2 preceding siblings ...)
2025-03-11 17:47 ` [PATCH 4/4] PCI: Move cardbus IO size declarations into pci/pci.h Ilpo Järvinen
@ 2025-03-12 20:44 ` Bjorn Helgaas
3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2025-03-12 20:44 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Bjorn Helgaas, linux-pci, linux-kernel
On Tue, Mar 11, 2025 at 07:46:58PM +0200, Ilpo Järvinen wrote:
> pci_rescan_bus_bridge_resize() is only used by code inside PCI
> subsystem. The comment also falsely advertizes it to be for hotplug
> drivers, yet the only caller is from sysfs store function. Move the
> function declaration into pci/pci.h.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Applied all four patches to pci/resource for v6.15, thanks, Ilpo!
> ---
> drivers/pci/pci.h | 2 ++
> include/linux/pci.h | 1 -
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 01e51db8d285..be2f43c9d3b0 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -309,6 +309,8 @@ enum pci_bar_type {
> struct device *pci_get_host_bridge_device(struct pci_dev *dev);
> void pci_put_host_bridge_device(struct device *dev);
>
> +unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
> +
> int pci_configure_extended_tags(struct pci_dev *dev, void *ign);
> bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl,
> int rrs_timeout);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 47b31ad724fa..d788acf2686a 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1455,7 +1455,6 @@ void set_pcie_port_type(struct pci_dev *pdev);
> void set_pcie_hotplug_bridge(struct pci_dev *pdev);
>
> /* Functions for PCI Hotplug drivers to use */
> -unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
> unsigned int pci_rescan_bus(struct pci_bus *bus);
> void pci_lock_rescan_remove(void);
> void pci_unlock_rescan_remove(void);
>
> base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread