]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI/portdrv: Move pcie_port_bus_type to pcie source file
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Tue, 2 Dec 2025 15:13:52 +0000 (16:13 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 13 Jan 2026 21:42:35 +0000 (15:42 -0600)
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 <u.kleine-koenig@baylibre.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/420d771f0091dea7cf18f445b94301576dcee4c8.1764688034.git.u.kleine-koenig@baylibre.com
drivers/pci/pci-driver.c
drivers/pci/pcie/portdrv.c

index e6ccaf0a762fcf00c287b6400557aeb2fb20e054..2cc4e9e6f5ef1d714501c000aa3f5f5081a50e14 100644 (file)
@@ -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;
index 348d90315570e058737f46fc43d6183165d1c11e..0127e3dc768f4d87d814bd514f5cf67df3979858 100644 (file)
@@ -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