提交 48a7c508 编写于 作者: R Robin Murphy 提交者: Joerg Roedel

iommu/tegra-smmu: Clean up bus_set_iommu()

Stop calling bus_set_iommu() since it's now unnecessary, and simplify
the probe failure path accordingly.
Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/13bb6baa6c4d74e95a12529e4eb1ddfb3885c3b5.1660572783.git.robin.murphy@arm.comSigned-off-by: NJoerg Roedel <jroedel@suse.de>
上级 a2409086
...@@ -1083,8 +1083,8 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, ...@@ -1083,8 +1083,8 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
/* /*
* This is a bit of a hack. Ideally we'd want to simply return this * This is a bit of a hack. Ideally we'd want to simply return this
* value. However the IOMMU registration process will attempt to add * value. However iommu_device_register() will attempt to add
* all devices to the IOMMU when bus_set_iommu() is called. In order * all devices to the IOMMU before we get that far. In order
* not to rely on global variables to track the IOMMU instance, we * not to rely on global variables to track the IOMMU instance, we
* set it here so that it can be looked up from the .probe_device() * set it here so that it can be looked up from the .probe_device()
* callback via the IOMMU device's .drvdata field. * callback via the IOMMU device's .drvdata field.
...@@ -1138,32 +1138,15 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, ...@@ -1138,32 +1138,15 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
return ERR_PTR(err); return ERR_PTR(err);
err = iommu_device_register(&smmu->iommu, &tegra_smmu_ops, dev); err = iommu_device_register(&smmu->iommu, &tegra_smmu_ops, dev);
if (err) if (err) {
goto remove_sysfs; iommu_device_sysfs_remove(&smmu->iommu);
return ERR_PTR(err);
err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops); }
if (err < 0)
goto unregister;
#ifdef CONFIG_PCI
err = bus_set_iommu(&pci_bus_type, &tegra_smmu_ops);
if (err < 0)
goto unset_platform_bus;
#endif
if (IS_ENABLED(CONFIG_DEBUG_FS)) if (IS_ENABLED(CONFIG_DEBUG_FS))
tegra_smmu_debugfs_init(smmu); tegra_smmu_debugfs_init(smmu);
return smmu; return smmu;
unset_platform_bus: __maybe_unused;
bus_set_iommu(&platform_bus_type, NULL);
unregister:
iommu_device_unregister(&smmu->iommu);
remove_sysfs:
iommu_device_sysfs_remove(&smmu->iommu);
return ERR_PTR(err);
} }
void tegra_smmu_remove(struct tegra_smmu *smmu) void tegra_smmu_remove(struct tegra_smmu *smmu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册