iommu: Use dev_iommu_ops() for probe_finalize
authorRobin Murphy <robin.murphy@arm.com>
Tue, 21 Jun 2022 15:14:25 +0000 (16:14 +0100)
committerJoerg Roedel <jroedel@suse.de>
Wed, 6 Jul 2022 10:55:53 +0000 (12:55 +0200)
The ->probe_finalize hook only runs after ->probe_device succeeds,
so we can move that over to the new dev_iommu_ops() as well.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/5fe4b0ce22f676f435d332f2b2828dc7ef848a19.1655822151.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c

index f46431a..862c3f6 100644 (file)
@@ -272,7 +272,7 @@ err_free:
 
 int iommu_probe_device(struct device *dev)
 {
-       const struct iommu_ops *ops = dev->bus->iommu_ops;
+       const struct iommu_ops *ops;
        struct iommu_group *group;
        int ret;
 
@@ -313,6 +313,7 @@ int iommu_probe_device(struct device *dev)
        mutex_unlock(&group->mutex);
        iommu_group_put(group);
 
+       ops = dev_iommu_ops(dev);
        if (ops->probe_finalize)
                ops->probe_finalize(dev);