Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: mobiveil: Move the host initialization into a function

Move the host initialization related operations into a new
function so that it can be reused by other platform
PCIe host drivers integrating the Mobiveil GPEX.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>

authored by

Hou Zhiqiang and committed by
Lorenzo Pieralisi
2ba24842 1f442218

+23 -16
+23 -16
drivers/pci/controller/pcie-mobiveil.c
··· 873 873 return 0; 874 874 } 875 875 876 - static int mobiveil_pcie_probe(struct platform_device *pdev) 876 + static int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) 877 877 { 878 - struct mobiveil_pcie *pcie; 878 + struct mobiveil_root_port *rp = &pcie->rp; 879 + struct pci_host_bridge *bridge = rp->bridge; 880 + struct device *dev = &pcie->pdev->dev; 879 881 struct pci_bus *bus; 880 882 struct pci_bus *child; 881 - struct pci_host_bridge *bridge; 882 - struct device *dev = &pdev->dev; 883 - struct mobiveil_root_port *rp; 884 883 int ret; 885 - 886 - /* allocate the PCIe port */ 887 - bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie)); 888 - if (!bridge) 889 - return -ENOMEM; 890 - 891 - pcie = pci_host_bridge_priv(bridge); 892 - rp = &pcie->rp; 893 - rp->bridge = bridge; 894 - 895 - pcie->pdev = pdev; 896 884 897 885 ret = mobiveil_pcie_parse_dt(pcie); 898 886 if (ret) { ··· 942 954 pci_bus_add_devices(bus); 943 955 944 956 return 0; 957 + } 958 + 959 + static int mobiveil_pcie_probe(struct platform_device *pdev) 960 + { 961 + struct mobiveil_pcie *pcie; 962 + struct pci_host_bridge *bridge; 963 + struct device *dev = &pdev->dev; 964 + 965 + /* allocate the PCIe port */ 966 + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie)); 967 + if (!bridge) 968 + return -ENOMEM; 969 + 970 + pcie = pci_host_bridge_priv(bridge); 971 + pcie->rp.bridge = bridge; 972 + 973 + pcie->pdev = pdev; 974 + 975 + return mobiveil_pcie_host_probe(pcie); 945 976 } 946 977 947 978 static const struct of_device_id mobiveil_pcie_of_match[] = {