Commit 006abbe3 authored by Robin Murphy's avatar Robin Murphy Committed by Joerg Roedel

iommu/dart: Clean up bus_set_iommu()

Stop calling bus_set_iommu() since it's now unnecessary, and simplify
the probe failure path accordingly.
Tested-by: default avatarSven Peter <sven@svenpeter.dev>
Reviewed-by: default avatarSven Peter <sven@svenpeter.dev>
Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/afe138964196907d58147a686c1dcd6a12f9e210.1660572783.git.robin.murphy@arm.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 2efbd29b
...@@ -820,27 +820,6 @@ static irqreturn_t apple_dart_irq(int irq, void *dev) ...@@ -820,27 +820,6 @@ static irqreturn_t apple_dart_irq(int irq, void *dev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int apple_dart_set_bus_ops(const struct iommu_ops *ops)
{
int ret;
if (!iommu_present(&platform_bus_type)) {
ret = bus_set_iommu(&platform_bus_type, ops);
if (ret)
return ret;
}
#ifdef CONFIG_PCI
if (!iommu_present(&pci_bus_type)) {
ret = bus_set_iommu(&pci_bus_type, ops);
if (ret) {
bus_set_iommu(&platform_bus_type, NULL);
return ret;
}
}
#endif
return 0;
}
static int apple_dart_probe(struct platform_device *pdev) static int apple_dart_probe(struct platform_device *pdev)
{ {
int ret; int ret;
...@@ -895,14 +874,10 @@ static int apple_dart_probe(struct platform_device *pdev) ...@@ -895,14 +874,10 @@ static int apple_dart_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dart); platform_set_drvdata(pdev, dart);
ret = apple_dart_set_bus_ops(&apple_dart_iommu_ops);
if (ret)
goto err_free_irq;
ret = iommu_device_sysfs_add(&dart->iommu, dev, NULL, "apple-dart.%s", ret = iommu_device_sysfs_add(&dart->iommu, dev, NULL, "apple-dart.%s",
dev_name(&pdev->dev)); dev_name(&pdev->dev));
if (ret) if (ret)
goto err_remove_bus_ops; goto err_free_irq;
ret = iommu_device_register(&dart->iommu, &apple_dart_iommu_ops, dev); ret = iommu_device_register(&dart->iommu, &apple_dart_iommu_ops, dev);
if (ret) if (ret)
...@@ -916,8 +891,6 @@ static int apple_dart_probe(struct platform_device *pdev) ...@@ -916,8 +891,6 @@ static int apple_dart_probe(struct platform_device *pdev)
err_sysfs_remove: err_sysfs_remove:
iommu_device_sysfs_remove(&dart->iommu); iommu_device_sysfs_remove(&dart->iommu);
err_remove_bus_ops:
apple_dart_set_bus_ops(NULL);
err_free_irq: err_free_irq:
free_irq(dart->irq, dart); free_irq(dart->irq, dart);
err_clk_disable: err_clk_disable:
...@@ -932,7 +905,6 @@ static int apple_dart_remove(struct platform_device *pdev) ...@@ -932,7 +905,6 @@ static int apple_dart_remove(struct platform_device *pdev)
apple_dart_hw_reset(dart); apple_dart_hw_reset(dart);
free_irq(dart->irq, dart); free_irq(dart->irq, dart);
apple_dart_set_bus_ops(NULL);
iommu_device_unregister(&dart->iommu); iommu_device_unregister(&dart->iommu);
iommu_device_sysfs_remove(&dart->iommu); iommu_device_sysfs_remove(&dart->iommu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment