Skip to content

Commit a5616e2

Browse files
committed
iommu/tegra: 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]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8b9cc3b commit a5616e2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/iommu/tegra-gart.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain,
113113

114114
if (gart->active_domain && gart->active_domain != domain) {
115115
ret = -EBUSY;
116-
} else if (dev->archdata.iommu != domain) {
117-
dev->archdata.iommu = domain;
116+
} else if (dev_iommu_priv_get(dev) != domain) {
117+
dev_iommu_priv_set(dev, domain);
118118
gart->active_domain = domain;
119119
gart->active_devices++;
120120
}
@@ -131,8 +131,8 @@ static void gart_iommu_detach_dev(struct iommu_domain *domain,
131131

132132
spin_lock(&gart->dom_lock);
133133

134-
if (dev->archdata.iommu == domain) {
135-
dev->archdata.iommu = NULL;
134+
if (dev_iommu_priv_get(dev) == domain) {
135+
dev_iommu_priv_set(dev, NULL);
136136

137137
if (--gart->active_devices == 0)
138138
gart->active_domain = NULL;

drivers/iommu/tegra-smmu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static void tegra_smmu_as_unprepare(struct tegra_smmu *smmu,
465465
static int tegra_smmu_attach_dev(struct iommu_domain *domain,
466466
struct device *dev)
467467
{
468-
struct tegra_smmu *smmu = dev->archdata.iommu;
468+
struct tegra_smmu *smmu = dev_iommu_priv_get(dev);
469469
struct tegra_smmu_as *as = to_smmu_as(domain);
470470
struct device_node *np = dev->of_node;
471471
struct of_phandle_args args;
@@ -780,7 +780,7 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev)
780780
* supported by the Linux kernel, so abort after the
781781
* first match.
782782
*/
783-
dev->archdata.iommu = smmu;
783+
dev_iommu_priv_set(dev, smmu);
784784

785785
break;
786786
}
@@ -797,7 +797,7 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev)
797797

798798
static void tegra_smmu_release_device(struct device *dev)
799799
{
800-
dev->archdata.iommu = NULL;
800+
dev_iommu_priv_set(dev, NULL);
801801
}
802802

803803
static const struct tegra_smmu_group_soc *
@@ -856,7 +856,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu,
856856
static struct iommu_group *tegra_smmu_device_group(struct device *dev)
857857
{
858858
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
859-
struct tegra_smmu *smmu = dev->archdata.iommu;
859+
struct tegra_smmu *smmu = dev_iommu_priv_get(dev);
860860
struct iommu_group *group;
861861

862862
group = tegra_smmu_group_get(smmu, fwspec->ids[0]);

0 commit comments

Comments
 (0)