Skip to content

Commit d826044

Browse files
committed
iommu/rockchip: Convert to probe/release_device() call-backs
Convert the Rockchip IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent bfe3bd4 commit d826044

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,40 +1054,28 @@ static void rk_iommu_domain_free(struct iommu_domain *domain)
10541054
kfree(rk_domain);
10551055
}
10561056

1057-
static int rk_iommu_add_device(struct device *dev)
1057+
static struct iommu_device *rk_iommu_probe_device(struct device *dev)
10581058
{
1059-
struct iommu_group *group;
1060-
struct rk_iommu *iommu;
10611059
struct rk_iommudata *data;
1060+
struct rk_iommu *iommu;
10621061

10631062
data = dev->archdata.iommu;
10641063
if (!data)
1065-
return -ENODEV;
1064+
return ERR_PTR(-ENODEV);
10661065

10671066
iommu = rk_iommu_from_dev(dev);
10681067

1069-
group = iommu_group_get_for_dev(dev);
1070-
if (IS_ERR(group))
1071-
return PTR_ERR(group);
1072-
iommu_group_put(group);
1073-
1074-
iommu_device_link(&iommu->iommu, dev);
10751068
data->link = device_link_add(dev, iommu->dev,
10761069
DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME);
10771070

1078-
return 0;
1071+
return &iommu->iommu;
10791072
}
10801073

1081-
static void rk_iommu_remove_device(struct device *dev)
1074+
static void rk_iommu_release_device(struct device *dev)
10821075
{
1083-
struct rk_iommu *iommu;
10841076
struct rk_iommudata *data = dev->archdata.iommu;
10851077

1086-
iommu = rk_iommu_from_dev(dev);
1087-
10881078
device_link_del(data->link);
1089-
iommu_device_unlink(&iommu->iommu, dev);
1090-
iommu_group_remove_device(dev);
10911079
}
10921080

10931081
static struct iommu_group *rk_iommu_device_group(struct device *dev)
@@ -1126,8 +1114,8 @@ static const struct iommu_ops rk_iommu_ops = {
11261114
.detach_dev = rk_iommu_detach_device,
11271115
.map = rk_iommu_map,
11281116
.unmap = rk_iommu_unmap,
1129-
.add_device = rk_iommu_add_device,
1130-
.remove_device = rk_iommu_remove_device,
1117+
.probe_device = rk_iommu_probe_device,
1118+
.release_device = rk_iommu_release_device,
11311119
.iova_to_phys = rk_iommu_iova_to_phys,
11321120
.device_group = rk_iommu_device_group,
11331121
.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP,

0 commit comments

Comments
 (0)