Skip to content

Commit 0f45b04

Browse files
committed
iommu/exynos: Use dev_iommu_priv_get/set()
Remove the use of dev->archdata.iommu and use the private per-device pointer provided by IOMMU core code instead. Signed-off-by: Joerg Roedel <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9704719 commit 0f45b04

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static u32 lv2ent_offset(sysmmu_iova_t iova)
173173
#define REG_V5_FAULT_AR_VA 0x070
174174
#define REG_V5_FAULT_AW_VA 0x080
175175

176-
#define has_sysmmu(dev) (dev->archdata.iommu != NULL)
176+
#define has_sysmmu(dev) (dev_iommu_priv_get(dev) != NULL)
177177

178178
static struct device *dma_dev;
179179
static struct kmem_cache *lv2table_kmem_cache;
@@ -226,7 +226,7 @@ static const struct sysmmu_fault_info sysmmu_v5_faults[] = {
226226
};
227227

228228
/*
229-
* This structure is attached to dev.archdata.iommu of the master device
229+
* This structure is attached to dev->iommu->priv of the master device
230230
* on device add, contains a list of SYSMMU controllers defined by device tree,
231231
* which are bound to given master device. It is usually referenced by 'owner'
232232
* pointer.
@@ -670,7 +670,7 @@ static int __maybe_unused exynos_sysmmu_suspend(struct device *dev)
670670
struct device *master = data->master;
671671

672672
if (master) {
673-
struct exynos_iommu_owner *owner = master->archdata.iommu;
673+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(master);
674674

675675
mutex_lock(&owner->rpm_lock);
676676
if (data->domain) {
@@ -688,7 +688,7 @@ static int __maybe_unused exynos_sysmmu_resume(struct device *dev)
688688
struct device *master = data->master;
689689

690690
if (master) {
691-
struct exynos_iommu_owner *owner = master->archdata.iommu;
691+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(master);
692692

693693
mutex_lock(&owner->rpm_lock);
694694
if (data->domain) {
@@ -837,8 +837,8 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
837837
static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain,
838838
struct device *dev)
839839
{
840-
struct exynos_iommu_owner *owner = dev->archdata.iommu;
841840
struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain);
841+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
842842
phys_addr_t pagetable = virt_to_phys(domain->pgtable);
843843
struct sysmmu_drvdata *data, *next;
844844
unsigned long flags;
@@ -875,8 +875,8 @@ static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain,
875875
static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain,
876876
struct device *dev)
877877
{
878-
struct exynos_iommu_owner *owner = dev->archdata.iommu;
879878
struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain);
879+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
880880
struct sysmmu_drvdata *data;
881881
phys_addr_t pagetable = virt_to_phys(domain->pgtable);
882882
unsigned long flags;
@@ -1237,7 +1237,7 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain,
12371237

12381238
static struct iommu_device *exynos_iommu_probe_device(struct device *dev)
12391239
{
1240-
struct exynos_iommu_owner *owner = dev->archdata.iommu;
1240+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
12411241
struct sysmmu_drvdata *data;
12421242

12431243
if (!has_sysmmu(dev))
@@ -1263,7 +1263,7 @@ static struct iommu_device *exynos_iommu_probe_device(struct device *dev)
12631263

12641264
static void exynos_iommu_release_device(struct device *dev)
12651265
{
1266-
struct exynos_iommu_owner *owner = dev->archdata.iommu;
1266+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
12671267
struct sysmmu_drvdata *data;
12681268

12691269
if (!has_sysmmu(dev))
@@ -1287,8 +1287,8 @@ static void exynos_iommu_release_device(struct device *dev)
12871287
static int exynos_iommu_of_xlate(struct device *dev,
12881288
struct of_phandle_args *spec)
12891289
{
1290-
struct exynos_iommu_owner *owner = dev->archdata.iommu;
12911290
struct platform_device *sysmmu = of_find_device_by_node(spec->np);
1291+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
12921292
struct sysmmu_drvdata *data, *entry;
12931293

12941294
if (!sysmmu)
@@ -1305,7 +1305,7 @@ static int exynos_iommu_of_xlate(struct device *dev,
13051305

13061306
INIT_LIST_HEAD(&owner->controllers);
13071307
mutex_init(&owner->rpm_lock);
1308-
dev->archdata.iommu = owner;
1308+
dev_iommu_priv_set(dev, owner);
13091309
}
13101310

13111311
list_for_each_entry(entry, &owner->controllers, owner_node)

drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010
#if defined(CONFIG_EXYNOS_IOMMU)
1111

12+
#include <linux/iommu.h>
13+
1214
static inline bool exynos_is_iommu_available(struct device *dev)
1315
{
14-
return dev->archdata.iommu != NULL;
16+
return dev_iommu_priv_get(dev) != NULL;
1517
}
1618

1719
#else

0 commit comments

Comments
 (0)