@@ -1059,7 +1059,7 @@ static bool arm_smmu_free_sme(struct arm_smmu_device *smmu, int idx)
1059
1059
static int arm_smmu_master_alloc_smes (struct device * dev )
1060
1060
{
1061
1061
struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
1062
- struct arm_smmu_master_cfg * cfg = fwspec -> iommu_priv ;
1062
+ struct arm_smmu_master_cfg * cfg = dev_iommu_priv_get ( dev ) ;
1063
1063
struct arm_smmu_device * smmu = cfg -> smmu ;
1064
1064
struct arm_smmu_smr * smrs = smmu -> smrs ;
1065
1065
struct iommu_group * group ;
@@ -1159,11 +1159,11 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
1159
1159
1160
1160
static int arm_smmu_attach_dev (struct iommu_domain * domain , struct device * dev )
1161
1161
{
1162
- int ret ;
1163
- struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
1164
1162
struct arm_smmu_domain * smmu_domain = to_smmu_domain (domain );
1163
+ struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
1165
1164
struct arm_smmu_master_cfg * cfg ;
1166
1165
struct arm_smmu_device * smmu ;
1166
+ int ret ;
1167
1167
1168
1168
if (!fwspec || fwspec -> ops != & arm_smmu_ops ) {
1169
1169
dev_err (dev , "cannot attach to SMMU, is it on the same bus?\n" );
@@ -1177,7 +1177,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
1177
1177
* domains, just say no (but more politely than by dereferencing NULL).
1178
1178
* This should be at least a WARN_ON once that's sorted.
1179
1179
*/
1180
- cfg = fwspec -> iommu_priv ;
1180
+ cfg = dev_iommu_priv_get ( dev ) ;
1181
1181
if (!cfg )
1182
1182
return - ENODEV ;
1183
1183
@@ -1430,7 +1430,7 @@ static int arm_smmu_add_device(struct device *dev)
1430
1430
goto out_free ;
1431
1431
1432
1432
cfg -> smmu = smmu ;
1433
- fwspec -> iommu_priv = cfg ;
1433
+ dev_iommu_priv_set ( dev , cfg ) ;
1434
1434
while (i -- )
1435
1435
cfg -> smendx [i ] = INVALID_SMENDX ;
1436
1436
@@ -1468,7 +1468,7 @@ static void arm_smmu_remove_device(struct device *dev)
1468
1468
if (!fwspec || fwspec -> ops != & arm_smmu_ops )
1469
1469
return ;
1470
1470
1471
- cfg = fwspec -> iommu_priv ;
1471
+ cfg = dev_iommu_priv_get ( dev ) ;
1472
1472
smmu = cfg -> smmu ;
1473
1473
1474
1474
ret = arm_smmu_rpm_get (smmu );
@@ -1480,15 +1480,16 @@ static void arm_smmu_remove_device(struct device *dev)
1480
1480
1481
1481
arm_smmu_rpm_put (smmu );
1482
1482
1483
+ dev_iommu_priv_set (dev , NULL );
1483
1484
iommu_group_remove_device (dev );
1484
- kfree (fwspec -> iommu_priv );
1485
+ kfree (cfg );
1485
1486
iommu_fwspec_free (dev );
1486
1487
}
1487
1488
1488
1489
static struct iommu_group * arm_smmu_device_group (struct device * dev )
1489
1490
{
1491
+ struct arm_smmu_master_cfg * cfg = dev_iommu_priv_get (dev );
1490
1492
struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
1491
- struct arm_smmu_master_cfg * cfg = fwspec -> iommu_priv ;
1492
1493
struct arm_smmu_device * smmu = cfg -> smmu ;
1493
1494
struct iommu_group * group = NULL ;
1494
1495
int i , idx ;
0 commit comments