Re: [PATCH v2 13/33] iommu: Export bus_iommu_probe() and make is safe for re-probing

From: Lu Baolu
Date: Wed Apr 15 2020 - 02:10:25 EST


On 2020/4/14 21:15, Joerg Roedel wrote:
From: Joerg Roedel <jroedel@xxxxxxx>

Add a check to the bus_iommu_probe() call-path to make sure it ignores
devices which have already been successfully probed. Then export the
bus_iommu_probe() function so it can be used by IOMMU drivers.

Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
---
drivers/iommu/iommu.c | 6 +++++-
include/linux/iommu.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 834a45da0ed0..a2ff95424044 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1615,6 +1615,10 @@ static int probe_iommu_group(struct device *dev, void *data)
if (!dev_iommu_get(dev))
return -ENOMEM;
+ /* Device is probed already if in a group */
+ if (iommu_group_get(dev) != NULL)

Same as
if (iommu_group_get(dev))
?

By the way, do we need to put the group if device has already been
probed?

Best regards,
baolu