Skip to content

Commit 3d09ff4

Browse files
author
Christoph Hellwig
committed
iommu/dma: remove most stubs in iommu-dma.h
The direct calls from mapping.c all guarded by use_dma_iommu(), so don't bother to provide stubs, but instead just expose the prototypes unconditionally. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]>
1 parent bb0e391 commit 3d09ff4

File tree

1 file changed

+8
-100
lines changed

1 file changed

+8
-100
lines changed

include/linux/iommu-dma.h

Lines changed: 8 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ static inline bool use_dma_iommu(struct device *dev)
1414
{
1515
return dev->dma_iommu;
1616
}
17+
#else
18+
static inline bool use_dma_iommu(struct device *dev)
19+
{
20+
return false;
21+
}
22+
#endif /* CONFIG_IOMMU_DMA */
23+
1724
dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
1825
unsigned long offset, size_t size, enum dma_data_direction dir,
1926
unsigned long attrs);
@@ -58,104 +65,5 @@ void iommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
5865
int nelems, enum dma_data_direction dir);
5966
void iommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
6067
int nelems, enum dma_data_direction dir);
61-
#else
62-
static inline bool use_dma_iommu(struct device *dev)
63-
{
64-
return false;
65-
}
66-
static inline dma_addr_t iommu_dma_map_page(struct device *dev,
67-
struct page *page, unsigned long offset, size_t size,
68-
enum dma_data_direction dir, unsigned long attrs)
69-
{
70-
return DMA_MAPPING_ERROR;
71-
}
72-
static inline void iommu_dma_unmap_page(struct device *dev,
73-
dma_addr_t dma_handle, size_t size, enum dma_data_direction dir,
74-
unsigned long attrs)
75-
{
76-
}
77-
static inline int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
78-
int nents, enum dma_data_direction dir, unsigned long attrs)
79-
{
80-
return -EINVAL;
81-
}
82-
static inline void iommu_dma_unmap_sg(struct device *dev,
83-
struct scatterlist *sg, int nents, enum dma_data_direction dir,
84-
unsigned long attrs)
85-
{
86-
}
87-
static inline void *iommu_dma_alloc(struct device *dev, size_t size,
88-
dma_addr_t *handle, gfp_t gfp, unsigned long attrs)
89-
{
90-
return NULL;
91-
}
92-
static inline int iommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
93-
void *cpu_addr, dma_addr_t dma_addr, size_t size,
94-
unsigned long attrs)
95-
{
96-
return -EINVAL;
97-
}
98-
static inline int iommu_dma_get_sgtable(struct device *dev,
99-
struct sg_table *sgt, void *cpu_addr, dma_addr_t dma_addr,
100-
size_t size, unsigned long attrs)
101-
{
102-
return -EINVAL;
103-
}
104-
static inline unsigned long iommu_dma_get_merge_boundary(struct device *dev)
105-
{
106-
return 0;
107-
}
108-
static inline size_t iommu_dma_opt_mapping_size(void)
109-
{
110-
return 0;
111-
}
112-
static inline size_t iommu_dma_max_mapping_size(struct device *dev)
113-
{
114-
return 0;
115-
}
116-
static inline void iommu_dma_free(struct device *dev, size_t size,
117-
void *cpu_addr, dma_addr_t handle, unsigned long attrs)
118-
{
119-
}
120-
static inline dma_addr_t iommu_dma_map_resource(struct device *dev,
121-
phys_addr_t phys, size_t size, enum dma_data_direction dir,
122-
unsigned long attrs)
123-
{
124-
return DMA_MAPPING_ERROR;
125-
}
126-
static inline void iommu_dma_unmap_resource(struct device *dev,
127-
dma_addr_t handle, size_t size, enum dma_data_direction dir,
128-
unsigned long attrs)
129-
{
130-
}
131-
static inline struct sg_table *
132-
iommu_dma_alloc_noncontiguous(struct device *dev, size_t size,
133-
enum dma_data_direction dir, gfp_t gfp, unsigned long attrs)
134-
{
135-
return NULL;
136-
}
137-
static inline void iommu_dma_free_noncontiguous(struct device *dev, size_t size,
138-
struct sg_table *sgt, enum dma_data_direction dir)
139-
{
140-
}
141-
static inline void iommu_dma_sync_single_for_cpu(struct device *dev,
142-
dma_addr_t dma_handle, size_t size,
143-
enum dma_data_direction dir)
144-
{
145-
}
146-
static inline void iommu_dma_sync_single_for_device(struct device *dev,
147-
dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
148-
{
149-
}
150-
static inline void iommu_dma_sync_sg_for_cpu(struct device *dev,
151-
struct scatterlist *sgl, int nelems,
152-
enum dma_data_direction dir)
153-
{
154-
}
155-
static inline void iommu_dma_sync_sg_for_device(struct device *dev,
156-
struct scatterlist *sgl, int nelems,
157-
enum dma_data_direction dir)
158-
{
159-
}
160-
#endif /* CONFIG_IOMMU_DMA */
68+
16169
#endif /* _LINUX_IOMMU_DMA_H */

0 commit comments

Comments
 (0)