@@ -1221,7 +1221,7 @@ __iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot,
1221
1221
static dma_addr_t
1222
1222
__iommu_create_mapping (struct device * dev , struct page * * pages , size_t size )
1223
1223
{
1224
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1224
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1225
1225
unsigned int count = PAGE_ALIGN (size ) >> PAGE_SHIFT ;
1226
1226
dma_addr_t dma_addr , iova ;
1227
1227
int i , ret = DMA_ERROR_CODE ;
@@ -1257,7 +1257,7 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size)
1257
1257
1258
1258
static int __iommu_remove_mapping (struct device * dev , dma_addr_t iova , size_t size )
1259
1259
{
1260
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1260
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1261
1261
1262
1262
/*
1263
1263
* add optional in-page offset from iova to size and align
@@ -1472,7 +1472,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,
1472
1472
enum dma_data_direction dir , struct dma_attrs * attrs ,
1473
1473
bool is_coherent )
1474
1474
{
1475
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1475
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1476
1476
dma_addr_t iova , iova_base ;
1477
1477
int ret = 0 ;
1478
1478
unsigned int count ;
@@ -1693,7 +1693,7 @@ static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *p
1693
1693
unsigned long offset , size_t size , enum dma_data_direction dir ,
1694
1694
struct dma_attrs * attrs )
1695
1695
{
1696
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1696
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1697
1697
dma_addr_t dma_addr ;
1698
1698
int ret , prot , len = PAGE_ALIGN (size + offset );
1699
1699
@@ -1746,7 +1746,7 @@ static void arm_coherent_iommu_unmap_page(struct device *dev, dma_addr_t handle,
1746
1746
size_t size , enum dma_data_direction dir ,
1747
1747
struct dma_attrs * attrs )
1748
1748
{
1749
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1749
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1750
1750
dma_addr_t iova = handle & PAGE_MASK ;
1751
1751
int offset = handle & ~PAGE_MASK ;
1752
1752
int len = PAGE_ALIGN (size + offset );
@@ -1771,7 +1771,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle,
1771
1771
size_t size , enum dma_data_direction dir ,
1772
1772
struct dma_attrs * attrs )
1773
1773
{
1774
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1774
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1775
1775
dma_addr_t iova = handle & PAGE_MASK ;
1776
1776
struct page * page = phys_to_page (iommu_iova_to_phys (mapping -> domain , iova ));
1777
1777
int offset = handle & ~PAGE_MASK ;
@@ -1790,7 +1790,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle,
1790
1790
static void arm_iommu_sync_single_for_cpu (struct device * dev ,
1791
1791
dma_addr_t handle , size_t size , enum dma_data_direction dir )
1792
1792
{
1793
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1793
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1794
1794
dma_addr_t iova = handle & PAGE_MASK ;
1795
1795
struct page * page = phys_to_page (iommu_iova_to_phys (mapping -> domain , iova ));
1796
1796
unsigned int offset = handle & ~PAGE_MASK ;
@@ -1804,7 +1804,7 @@ static void arm_iommu_sync_single_for_cpu(struct device *dev,
1804
1804
static void arm_iommu_sync_single_for_device (struct device * dev ,
1805
1805
dma_addr_t handle , size_t size , enum dma_data_direction dir )
1806
1806
{
1807
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
1807
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
1808
1808
dma_addr_t iova = handle & PAGE_MASK ;
1809
1809
struct page * page = phys_to_page (iommu_iova_to_phys (mapping -> domain , iova ));
1810
1810
unsigned int offset = handle & ~PAGE_MASK ;
@@ -1965,7 +1965,7 @@ static int __arm_iommu_attach_device(struct device *dev,
1965
1965
return err ;
1966
1966
1967
1967
kref_get (& mapping -> kref );
1968
- dev -> archdata . mapping = mapping ;
1968
+ to_dma_iommu_mapping ( dev ) = mapping ;
1969
1969
1970
1970
pr_debug ("Attached IOMMU controller to %s device.\n" , dev_name (dev ));
1971
1971
return 0 ;
@@ -2010,7 +2010,7 @@ static void __arm_iommu_detach_device(struct device *dev)
2010
2010
2011
2011
iommu_detach_device (mapping -> domain , dev );
2012
2012
kref_put (& mapping -> kref , release_iommu_mapping );
2013
- dev -> archdata . mapping = NULL ;
2013
+ to_dma_iommu_mapping ( dev ) = NULL ;
2014
2014
2015
2015
pr_debug ("Detached IOMMU controller from %s device.\n" , dev_name (dev ));
2016
2016
}
@@ -2061,7 +2061,7 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
2061
2061
2062
2062
static void arm_teardown_iommu_dma_ops (struct device * dev )
2063
2063
{
2064
- struct dma_iommu_mapping * mapping = dev -> archdata . mapping ;
2064
+ struct dma_iommu_mapping * mapping = to_dma_iommu_mapping ( dev ) ;
2065
2065
2066
2066
if (!mapping )
2067
2067
return ;
0 commit comments