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 <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
master
Uwe Kleine-König 2025-12-02 16:13:52 +01:00 committed by Bjorn Helgaas
parent 0c1594df40
commit 61df4929a7
2 changed files with 20 additions and 22 deletions

View 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;

View 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