dma.c 1.3 KB

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