Skip to content

Commit b7a9662

Browse files
committed
iommu/arm-smmu-v3: Use accessor functions for iommu private data
Make use of dev_iommu_priv_set/get() functions in the code. Signed-off-by: Joerg Roedel <[email protected]> Tested-by: Hanjun Guo <[email protected]> Reviewed-by: Jean-Philippe Brucker <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f9867f4 commit b7a9662

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/iommu/arm-smmu-v3.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
26592659
if (!fwspec)
26602660
return -ENOENT;
26612661

2662-
master = fwspec->iommu_priv;
2662+
master = dev_iommu_priv_get(dev);
26632663
smmu = master->smmu;
26642664

26652665
arm_smmu_detach_dev(master);
@@ -2795,7 +2795,7 @@ static int arm_smmu_add_device(struct device *dev)
27952795
if (!fwspec || fwspec->ops != &arm_smmu_ops)
27962796
return -ENODEV;
27972797

2798-
if (WARN_ON_ONCE(fwspec->iommu_priv))
2798+
if (WARN_ON_ONCE(dev_iommu_priv_get(dev)))
27992799
return -EBUSY;
28002800

28012801
smmu = arm_smmu_get_by_fwnode(fwspec->iommu_fwnode);
@@ -2810,7 +2810,7 @@ static int arm_smmu_add_device(struct device *dev)
28102810
master->smmu = smmu;
28112811
master->sids = fwspec->ids;
28122812
master->num_sids = fwspec->num_ids;
2813-
fwspec->iommu_priv = master;
2813+
dev_iommu_priv_set(dev, master);
28142814

28152815
/* Check the SIDs are in range of the SMMU and our stream table */
28162816
for (i = 0; i < master->num_sids; i++) {
@@ -2852,7 +2852,7 @@ static int arm_smmu_add_device(struct device *dev)
28522852
iommu_device_unlink(&smmu->iommu, dev);
28532853
err_free_master:
28542854
kfree(master);
2855-
fwspec->iommu_priv = NULL;
2855+
dev_iommu_priv_set(dev, NULL);
28562856
return ret;
28572857
}
28582858

@@ -2865,7 +2865,7 @@ static void arm_smmu_remove_device(struct device *dev)
28652865
if (!fwspec || fwspec->ops != &arm_smmu_ops)
28662866
return;
28672867

2868-
master = fwspec->iommu_priv;
2868+
master = dev_iommu_priv_get(dev);
28692869
smmu = master->smmu;
28702870
arm_smmu_detach_dev(master);
28712871
iommu_group_remove_device(dev);

0 commit comments

Comments
 (0)