Skip to content

Commit 3c51c05

Browse files
committed
iommu/exynos: Convert to probe/release_device() call-backs
Convert the Exynos 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]> Tested-by: Marek Szyprowski <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 66ae88e commit 3c51c05

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,19 +1235,13 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain,
12351235
return phys;
12361236
}
12371237

1238-
static int exynos_iommu_add_device(struct device *dev)
1238+
static struct iommu_device *exynos_iommu_probe_device(struct device *dev)
12391239
{
12401240
struct exynos_iommu_owner *owner = dev->archdata.iommu;
12411241
struct sysmmu_drvdata *data;
1242-
struct iommu_group *group;
12431242

12441243
if (!has_sysmmu(dev))
1245-
return -ENODEV;
1246-
1247-
group = iommu_group_get_for_dev(dev);
1248-
1249-
if (IS_ERR(group))
1250-
return PTR_ERR(group);
1244+
return ERR_PTR(-ENODEV);
12511245

12521246
list_for_each_entry(data, &owner->controllers, owner_node) {
12531247
/*
@@ -1259,17 +1253,15 @@ static int exynos_iommu_add_device(struct device *dev)
12591253
DL_FLAG_STATELESS |
12601254
DL_FLAG_PM_RUNTIME);
12611255
}
1262-
iommu_group_put(group);
12631256

12641257
/* There is always at least one entry, see exynos_iommu_of_xlate() */
12651258
data = list_first_entry(&owner->controllers,
12661259
struct sysmmu_drvdata, owner_node);
1267-
iommu_device_link(&data->iommu, dev);
12681260

1269-
return 0;
1261+
return &data->iommu;
12701262
}
12711263

1272-
static void exynos_iommu_remove_device(struct device *dev)
1264+
static void exynos_iommu_release_device(struct device *dev)
12731265
{
12741266
struct exynos_iommu_owner *owner = dev->archdata.iommu;
12751267
struct sysmmu_drvdata *data;
@@ -1287,15 +1279,9 @@ static void exynos_iommu_remove_device(struct device *dev)
12871279
iommu_group_put(group);
12881280
}
12891281
}
1290-
iommu_group_remove_device(dev);
12911282

12921283
list_for_each_entry(data, &owner->controllers, owner_node)
12931284
device_link_del(data->link);
1294-
1295-
/* There is always at least one entry, see exynos_iommu_of_xlate() */
1296-
data = list_first_entry(&owner->controllers,
1297-
struct sysmmu_drvdata, owner_node);
1298-
iommu_device_unlink(&data->iommu, dev);
12991285
}
13001286

13011287
static int exynos_iommu_of_xlate(struct device *dev,
@@ -1341,8 +1327,8 @@ static const struct iommu_ops exynos_iommu_ops = {
13411327
.unmap = exynos_iommu_unmap,
13421328
.iova_to_phys = exynos_iommu_iova_to_phys,
13431329
.device_group = generic_device_group,
1344-
.add_device = exynos_iommu_add_device,
1345-
.remove_device = exynos_iommu_remove_device,
1330+
.probe_device = exynos_iommu_probe_device,
1331+
.release_device = exynos_iommu_release_device,
13461332
.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
13471333
.of_xlate = exynos_iommu_of_xlate,
13481334
};

0 commit comments

Comments
 (0)