forked from mirrors/linux
		
	PCI: Set bridge map_irq and swizzle_irq to default functions
The majority of DT based host drivers use the default .map_irq() and .swizzle_irq() functions, so let's initialize the function pointers to the default and drop setting them in the host drivers. Drivers like iProc which don't support legacy interrupts need to set .map_irq() back to NULL. Link: https://lore.kernel.org/r/20200722022514.1283916-20-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
		
							parent
							
								
									669cbc7081
								
							
						
					
					
						commit
						b64aa11eb2
					
				
					 21 changed files with 5 additions and 37 deletions
				
			
		| 
						 | 
					@ -231,8 +231,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 | 
				
			||||||
		goto err_init;
 | 
							goto err_init;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->ops = &cdns_pcie_host_ops;
 | 
						bridge->ops = &cdns_pcie_host_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pci_host_probe(bridge);
 | 
						ret = pci_host_probe(bridge);
 | 
				
			||||||
	if (ret < 0)
 | 
						if (ret < 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -470,8 +470,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = pp;
 | 
						bridge->sysdata = pp;
 | 
				
			||||||
	bridge->ops = &dw_pcie_ops;
 | 
						bridge->ops = &dw_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pci_scan_root_bus_bridge(bridge);
 | 
						ret = pci_scan_root_bus_bridge(bridge);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -596,8 +596,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
 | 
				
			||||||
	/* Initialize bridge */
 | 
						/* Initialize bridge */
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->ops = &mobiveil_pcie_ops;
 | 
						bridge->ops = &mobiveil_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = mobiveil_bringup_link(pcie);
 | 
						ret = mobiveil_bringup_link(pcie);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1175,8 +1175,6 @@ static int advk_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->ops = &advk_pcie_ops;
 | 
						bridge->ops = &advk_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pci_host_probe(bridge);
 | 
						ret = pci_host_probe(bridge);
 | 
				
			||||||
	if (ret < 0) {
 | 
						if (ret < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -437,8 +437,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->ops = &faraday_pci_ops;
 | 
						host->ops = &faraday_pci_ops;
 | 
				
			||||||
	host->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	host->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
	p = pci_host_bridge_priv(host);
 | 
						p = pci_host_bridge_priv(host);
 | 
				
			||||||
	host->sysdata = p;
 | 
						host->sysdata = p;
 | 
				
			||||||
	p->dev = dev;
 | 
						p->dev = dev;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,8 +77,6 @@ int pci_host_common_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = cfg;
 | 
						bridge->sysdata = cfg;
 | 
				
			||||||
	bridge->ops = (struct pci_ops *)&ops->pci_ops;
 | 
						bridge->ops = (struct pci_ops *)&ops->pci_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_set_drvdata(pdev, bridge);
 | 
						platform_set_drvdata(pdev, bridge);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1118,8 +1118,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->ops = &mvebu_pcie_ops;
 | 
						bridge->ops = &mvebu_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
	bridge->align_resource = mvebu_pcie_align_resource;
 | 
						bridge->align_resource = mvebu_pcie_align_resource;
 | 
				
			||||||
	bridge->msi = pcie->msi;
 | 
						bridge->msi = pcie->msi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2707,7 +2707,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->ops = &tegra_pcie_ops;
 | 
						host->ops = &tegra_pcie_ops;
 | 
				
			||||||
	host->map_irq = tegra_pcie_map_irq;
 | 
						host->map_irq = tegra_pcie_map_irq;
 | 
				
			||||||
	host->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = pci_host_probe(host);
 | 
						err = pci_host_probe(host);
 | 
				
			||||||
	if (err < 0) {
 | 
						if (err < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -722,8 +722,6 @@ static int v3_pci_probe(struct platform_device *pdev)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->ops = &v3_pci_ops;
 | 
						host->ops = &v3_pci_ops;
 | 
				
			||||||
	host->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	host->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
	v3 = pci_host_bridge_priv(host);
 | 
						v3 = pci_host_bridge_priv(host);
 | 
				
			||||||
	host->sysdata = v3;
 | 
						host->sysdata = v3;
 | 
				
			||||||
	v3->dev = dev;
 | 
						v3->dev = dev;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,8 +149,6 @@ static int versatile_pci_probe(struct platform_device *pdev)
 | 
				
			||||||
	pci_add_flags(PCI_REASSIGN_ALL_BUS);
 | 
						pci_add_flags(PCI_REASSIGN_ALL_BUS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->ops = &pci_versatile_ops;
 | 
						bridge->ops = &pci_versatile_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pci_host_probe(bridge);
 | 
						return pci_host_probe(bridge);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -620,8 +620,6 @@ static int xgene_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = port;
 | 
						bridge->sysdata = port;
 | 
				
			||||||
	bridge->ops = &xgene_pcie_ops;
 | 
						bridge->ops = &xgene_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pci_host_probe(bridge);
 | 
						return pci_host_probe(bridge);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -809,8 +809,6 @@ static int altera_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->busnr = pcie->root_bus_nr;
 | 
						bridge->busnr = pcie->root_bus_nr;
 | 
				
			||||||
	bridge->ops = &altera_pcie_ops;
 | 
						bridge->ops = &altera_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pci_host_probe(bridge);
 | 
						return pci_host_probe(bridge);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -991,8 +991,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->ops = &brcm_pcie_ops;
 | 
						bridge->ops = &brcm_pcie_ops;
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	platform_set_drvdata(pdev, pcie);
 | 
						platform_set_drvdata(pdev, pcie);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,9 +99,10 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
 | 
				
			||||||
	switch (pcie->type) {
 | 
						switch (pcie->type) {
 | 
				
			||||||
	case IPROC_PCIE_PAXC:
 | 
						case IPROC_PCIE_PAXC:
 | 
				
			||||||
	case IPROC_PCIE_PAXC_V2:
 | 
						case IPROC_PCIE_PAXC_V2:
 | 
				
			||||||
 | 
							pcie->map_irq = 0;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		pcie->map_irq = of_irq_parse_and_map_pci;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = iproc_pcie_setup(pcie, &bridge->windows);
 | 
						ret = iproc_pcie_setup(pcie, &bridge->windows);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1526,7 +1526,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 | 
				
			||||||
	host->ops = &iproc_pcie_ops;
 | 
						host->ops = &iproc_pcie_ops;
 | 
				
			||||||
	host->sysdata = pcie;
 | 
						host->sysdata = pcie;
 | 
				
			||||||
	host->map_irq = pcie->map_irq;
 | 
						host->map_irq = pcie->map_irq;
 | 
				
			||||||
	host->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pci_host_probe(host);
 | 
						ret = pci_host_probe(host);
 | 
				
			||||||
	if (ret < 0) {
 | 
						if (ret < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1083,8 +1083,6 @@ static int mtk_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
		return err;
 | 
							return err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->ops = pcie->soc->ops;
 | 
						host->ops = pcie->soc->ops;
 | 
				
			||||||
	host->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	host->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
	host->sysdata = pcie;
 | 
						host->sysdata = pcie;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = pci_host_probe(host);
 | 
						err = pci_host_probe(host);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -294,8 +294,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = host;
 | 
						bridge->sysdata = host;
 | 
				
			||||||
	bridge->ops = &rcar_pcie_ops;
 | 
						bridge->ops = &rcar_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
	if (IS_ENABLED(CONFIG_PCI_MSI))
 | 
						if (IS_ENABLED(CONFIG_PCI_MSI))
 | 
				
			||||||
		bridge->msi = &host->msi.chip;
 | 
							bridge->msi = &host->msi.chip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1001,8 +1001,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = rockchip;
 | 
						bridge->sysdata = rockchip;
 | 
				
			||||||
	bridge->ops = &rockchip_pcie_ops;
 | 
						bridge->ops = &rockchip_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = pci_host_probe(bridge);
 | 
						err = pci_host_probe(bridge);
 | 
				
			||||||
	if (err < 0)
 | 
						if (err < 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -846,8 +846,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = pcie;
 | 
						bridge->sysdata = pcie;
 | 
				
			||||||
	bridge->ops = &nwl_pcie_ops;
 | 
						bridge->ops = &nwl_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 | 
						if (IS_ENABLED(CONFIG_PCI_MSI)) {
 | 
				
			||||||
		err = nwl_pcie_enable_msi(pcie);
 | 
							err = nwl_pcie_enable_msi(pcie);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -643,8 +643,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bridge->sysdata = port;
 | 
						bridge->sysdata = port;
 | 
				
			||||||
	bridge->ops = &xilinx_pcie_ops;
 | 
						bridge->ops = &xilinx_pcie_ops;
 | 
				
			||||||
	bridge->map_irq = of_irq_parse_and_map_pci;
 | 
					 | 
				
			||||||
	bridge->swizzle_irq = pci_common_swizzle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_PCI_MSI
 | 
					#ifdef CONFIG_PCI_MSI
 | 
				
			||||||
	xilinx_pcie_msi_chip.dev = dev;
 | 
						xilinx_pcie_msi_chip.dev = dev;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,6 +569,9 @@ int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge)
 | 
				
			||||||
	if (!dev->of_node)
 | 
						if (!dev->of_node)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bridge->swizzle_irq = pci_common_swizzle;
 | 
				
			||||||
 | 
						bridge->map_irq = of_irq_parse_and_map_pci;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pci_parse_request_of_pci_ranges(dev, bridge);
 | 
						return pci_parse_request_of_pci_ranges(dev, bridge);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue