From: Uwe Kleine-König Date: Tue, 2 Dec 2025 15:13:52 +0000 (+0100) Subject: PCI/portdrv: Move pcie_port_bus_type to pcie source file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61df4929a74bfd4aed712d09b681378b470b6224;p=thirdparty%2Fkernel%2Flinux.git PCI/portdrv: Move pcie_port_bus_type to pcie source file Conceptually the pci_express bus doesn't belong in generic PCI code. Move pcie_port_bus_match() and pcie_port_bus_type to pcie/portdrv.c. Signed-off-by: Uwe Kleine-König Signed-off-by: Bjorn Helgaas Link: https://patch.msgid.link/420d771f0091dea7cf18f445b94301576dcee4c8.1764688034.git.u.kleine-koenig@baylibre.com --- diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index e6ccaf0a762f..2cc4e9e6f5ef 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1701,28 +1701,6 @@ const struct bus_type pci_bus_type = { }; EXPORT_SYMBOL(pci_bus_type); -#ifdef CONFIG_PCIEPORTBUS -static int pcie_port_bus_match(struct device *dev, const struct device_driver *drv) -{ - struct pcie_device *pciedev = to_pcie_device(dev); - const struct pcie_port_service_driver *driver = to_service_driver(drv); - - if (driver->service != pciedev->service) - return 0; - - if (driver->port_type != PCIE_ANY_PORT && - driver->port_type != pci_pcie_type(pciedev->port)) - return 0; - - return 1; -} - -const struct bus_type pcie_port_bus_type = { - .name = "pci_express", - .match = pcie_port_bus_match, -}; -#endif - static int __init pci_driver_init(void) { int ret; diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index 348d90315570..0127e3dc768f 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -508,6 +508,21 @@ static void pcie_port_device_remove(struct pci_dev *dev) pci_free_irq_vectors(dev); } +static int pcie_port_bus_match(struct device *dev, const struct device_driver *drv) +{ + struct pcie_device *pciedev = to_pcie_device(dev); + const struct pcie_port_service_driver *driver = to_service_driver(drv); + + if (driver->service != pciedev->service) + return 0; + + if (driver->port_type != PCIE_ANY_PORT && + driver->port_type != pci_pcie_type(pciedev->port)) + return 0; + + return 1; +} + /** * pcie_port_probe_service - probe driver for given PCI Express port service * @dev: PCI Express port service device to probe against @@ -564,6 +579,11 @@ static int pcie_port_remove_service(struct device *dev) return 0; } +const struct bus_type pcie_port_bus_type = { + .name = "pci_express", + .match = pcie_port_bus_match, +}; + /** * pcie_port_service_register - register PCI Express port service driver * @new: PCI Express port service driver to register