summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2025-04-01 12:17:03 +0300
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2025-04-23 10:22:11 +0300
commitafc0a570bb6138713d74784a032e4eb5b7f919ca (patch)
treecf1f41debc4419d18ae56b332558b72df5da2b8d /include/linux
parent6b7f49be74758a60b760d6c19a48f65a23511dbe (diff)
downloadlinux-afc0a570bb6138713d74784a032e4eb5b7f919ca.tar.xz
PCI: host-generic: Extract an ECAM bridge creation helper from pci_host_common_probe()
pci_host_common_probe() is an extremely useful helper, as it abstracts away most of the gunk that a "mostly-ECAM-compliant" device driver needs. However, it is structured as a probe function, meaning that a lot of the driver-specific setup has to happen in a .init() callback, after the bridge and config space have been instantiated. This is a bit awkward, and results in a number of convolutions that could be avoided if the host-common code was more like a library. Introduce a pci_host_common_init() helper that does exactly that, taking the platform device and a struct pci_ecam_op as parameters. This can then be called from the probe routine, and a lot of the code that isn't relevant to PCI setup moved away from the .init() callback. This also removes the dependency on the device match data, which is an oddity. Signed-off-by: Marc Zyngier <maz@kernel.org> [mani: fixed spelling mistakes] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Tested-by: Janne Grunau <j@jannau.net> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Link: https://patch.msgid.link/20250401091713.2765724-4-maz@kernel.org
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pci-ecam.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index 3a10f8cfc3ad..bc2ca2c72ee2 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -97,6 +97,8 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
#if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
/* for DT-based PCI controllers that support ECAM */
int pci_host_common_probe(struct platform_device *pdev);
+int pci_host_common_init(struct platform_device *pdev,
+ const struct pci_ecam_ops *ops);
void pci_host_common_remove(struct platform_device *pdev);
#endif
#endif