mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
iommu/mtk: Clean up bus_set_iommu()
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure paths accordingly. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/9134322ecd24030eebeac73f37ca579094cc7df0.1660572783.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
b87d6d7fa4
commit
7341c365c3
2 changed files with 2 additions and 35 deletions
|
@ -1243,30 +1243,13 @@ static int mtk_iommu_probe(struct platform_device *pdev)
|
|||
data->hw_list = &data->hw_list_head;
|
||||
}
|
||||
|
||||
if (!iommu_present(&platform_bus_type)) {
|
||||
ret = bus_set_iommu(&platform_bus_type, &mtk_iommu_ops);
|
||||
if (ret)
|
||||
goto out_list_del;
|
||||
}
|
||||
|
||||
if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_MM)) {
|
||||
ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match);
|
||||
if (ret)
|
||||
goto out_bus_set_null;
|
||||
} else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA) &&
|
||||
MTK_IOMMU_HAS_FLAG(data->plat_data, IFA_IOMMU_PCIE_SUPPORT)) {
|
||||
#ifdef CONFIG_PCI
|
||||
if (!iommu_present(&pci_bus_type)) {
|
||||
ret = bus_set_iommu(&pci_bus_type, &mtk_iommu_ops);
|
||||
if (ret) /* PCIe fail don't affect platform_bus. */
|
||||
goto out_list_del;
|
||||
}
|
||||
#endif
|
||||
goto out_list_del;
|
||||
}
|
||||
return ret;
|
||||
|
||||
out_bus_set_null:
|
||||
bus_set_iommu(&platform_bus_type, NULL);
|
||||
out_list_del:
|
||||
list_del(&data->list);
|
||||
iommu_device_unregister(&data->iommu);
|
||||
|
@ -1294,11 +1277,6 @@ static int mtk_iommu_remove(struct platform_device *pdev)
|
|||
if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_MM)) {
|
||||
device_link_remove(data->smicomm_dev, &pdev->dev);
|
||||
component_master_del(&pdev->dev, &mtk_iommu_com_ops);
|
||||
} else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA) &&
|
||||
MTK_IOMMU_HAS_FLAG(data->plat_data, IFA_IOMMU_PCIE_SUPPORT)) {
|
||||
#ifdef CONFIG_PCI
|
||||
bus_set_iommu(&pci_bus_type, NULL);
|
||||
#endif
|
||||
}
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
for (i = 0; i < data->plat_data->banks_num; i++) {
|
||||
|
|
|
@ -691,19 +691,11 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
goto out_sysfs_remove;
|
||||
|
||||
if (!iommu_present(&platform_bus_type)) {
|
||||
ret = bus_set_iommu(&platform_bus_type, &mtk_iommu_v1_ops);
|
||||
if (ret)
|
||||
goto out_dev_unreg;
|
||||
}
|
||||
|
||||
ret = component_master_add_with_match(dev, &mtk_iommu_v1_com_ops, match);
|
||||
if (ret)
|
||||
goto out_bus_set_null;
|
||||
goto out_dev_unreg;
|
||||
return ret;
|
||||
|
||||
out_bus_set_null:
|
||||
bus_set_iommu(&platform_bus_type, NULL);
|
||||
out_dev_unreg:
|
||||
iommu_device_unregister(&data->iommu);
|
||||
out_sysfs_remove:
|
||||
|
@ -718,9 +710,6 @@ static int mtk_iommu_v1_remove(struct platform_device *pdev)
|
|||
iommu_device_sysfs_remove(&data->iommu);
|
||||
iommu_device_unregister(&data->iommu);
|
||||
|
||||
if (iommu_present(&platform_bus_type))
|
||||
bus_set_iommu(&platform_bus_type, NULL);
|
||||
|
||||
clk_disable_unprepare(data->bclk);
|
||||
devm_free_irq(&pdev->dev, data->irq, data);
|
||||
component_master_del(&pdev->dev, &mtk_iommu_v1_com_ops);
|
||||
|
|
Loading…
Reference in a new issue