xref: /linux/rust/helpers/dma.c (revision e2f1081ca8f18c146e8f928486deac61eca2b517)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/dma-mapping.h>
4 
5 void *rust_helper_dma_alloc_attrs(struct device *dev, size_t size,
6 				  dma_addr_t *dma_handle, gfp_t flag,
7 				  unsigned long attrs)
8 {
9 	return dma_alloc_attrs(dev, size, dma_handle, flag, attrs);
10 }
11 
12 void rust_helper_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
13 				dma_addr_t dma_handle, unsigned long attrs)
14 {
15 	dma_free_attrs(dev, size, cpu_addr, dma_handle, attrs);
16 }
17 
18 int rust_helper_dma_set_mask_and_coherent(struct device *dev, u64 mask)
19 {
20 	return dma_set_mask_and_coherent(dev, mask);
21 }
22 
23 int rust_helper_dma_set_mask(struct device *dev, u64 mask)
24 {
25 	return dma_set_mask(dev, mask);
26 }
27 
28 int rust_helper_dma_set_coherent_mask(struct device *dev, u64 mask)
29 {
30 	return dma_set_coherent_mask(dev, mask);
31 }
32 
33 int rust_helper_dma_map_sgtable(struct device *dev, struct sg_table *sgt,
34 				enum dma_data_direction dir, unsigned long attrs)
35 {
36 	return dma_map_sgtable(dev, sgt, dir, attrs);
37 }
38 
39 size_t rust_helper_dma_max_mapping_size(struct device *dev)
40 {
41 	return dma_max_mapping_size(dev);
42 }
43