Skip to content

Commit fd27a52

Browse files
author
Christoph Hellwig
committed
ARM/dma-mapping: merge __dma_supported into arm_dma_supported
Merge __dma_supported into its only caller, and move the resulting function so that it doesn't need a forward declaration. Also mark it static as there are no callers outside of dma-mapping.c. Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 7607cb7 commit fd27a52

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

arch/arm/include/asm/dma-iommu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,5 @@ int arm_iommu_attach_device(struct device *dev,
3333
struct dma_iommu_mapping *mapping);
3434
void arm_iommu_detach_device(struct device *dev);
3535

36-
int arm_dma_supported(struct device *dev, u64 mask);
37-
3836
#endif /* __KERNEL__ */
3937
#endif

arch/arm/mm/dma-mapping.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,23 @@ static void arm_dma_sync_single_for_device(struct device *dev,
179179
__dma_page_cpu_to_dev(page, offset, size, dir);
180180
}
181181

182+
/*
183+
* Return whether the given device DMA address mask can be supported
184+
* properly. For example, if your device can only drive the low 24-bits
185+
* during bus mastering, then you would pass 0x00ffffff as the mask
186+
* to this function.
187+
*/
188+
static int arm_dma_supported(struct device *dev, u64 mask)
189+
{
190+
unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit);
191+
192+
/*
193+
* Translate the device's DMA mask to a PFN limit. This
194+
* PFN number includes the page which we can DMA to.
195+
*/
196+
return dma_to_pfn(dev, mask) >= max_dma_pfn;
197+
}
198+
182199
const struct dma_map_ops arm_dma_ops = {
183200
.alloc = arm_dma_alloc,
184201
.free = arm_dma_free,
@@ -219,19 +236,6 @@ const struct dma_map_ops arm_coherent_dma_ops = {
219236
};
220237
EXPORT_SYMBOL(arm_coherent_dma_ops);
221238

222-
static int __dma_supported(struct device *dev, u64 mask)
223-
{
224-
unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit);
225-
226-
/*
227-
* Translate the device's DMA mask to a PFN limit. This
228-
* PFN number includes the page which we can DMA to.
229-
*/
230-
if (dma_to_pfn(dev, mask) < max_dma_pfn)
231-
return 0;
232-
return 1;
233-
}
234-
235239
static void __dma_clear_buffer(struct page *page, size_t size, int coherent_flag)
236240
{
237241
/*
@@ -1054,17 +1058,6 @@ void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
10541058
dir);
10551059
}
10561060

1057-
/*
1058-
* Return whether the given device DMA address mask can be supported
1059-
* properly. For example, if your device can only drive the low 24-bits
1060-
* during bus mastering, then you would pass 0x00ffffff as the mask
1061-
* to this function.
1062-
*/
1063-
int arm_dma_supported(struct device *dev, u64 mask)
1064-
{
1065-
return __dma_supported(dev, mask);
1066-
}
1067-
10681061
static const struct dma_map_ops *arm_get_dma_map_ops(bool coherent)
10691062
{
10701063
/*

0 commit comments

Comments
 (0)