blob: b492d59ac77ef0f4eda13cabc1b104c077c22754 [file] [log] [blame]
Robin Murphy90ac7062018-12-06 13:14:44 -08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Dummy DMA ops that always fail.
4 */
Christoph Hellwig0a0f0d82020-09-22 15:31:03 +02005#include <linux/dma-map-ops.h>
Robin Murphy90ac7062018-12-06 13:14:44 -08006
7static int dma_dummy_mmap(struct device *dev, struct vm_area_struct *vma,
8 void *cpu_addr, dma_addr_t dma_addr, size_t size,
9 unsigned long attrs)
10{
11 return -ENXIO;
12}
13
14static dma_addr_t dma_dummy_map_page(struct device *dev, struct page *page,
15 unsigned long offset, size_t size, enum dma_data_direction dir,
16 unsigned long attrs)
17{
18 return DMA_MAPPING_ERROR;
19}
20
21static int dma_dummy_map_sg(struct device *dev, struct scatterlist *sgl,
22 int nelems, enum dma_data_direction dir,
23 unsigned long attrs)
24{
Martin Oliveira66ab6312021-07-29 14:15:38 -060025 return -EINVAL;
Robin Murphy90ac7062018-12-06 13:14:44 -080026}
27
28static int dma_dummy_supported(struct device *hwdev, u64 mask)
29{
30 return 0;
31}
32
33const struct dma_map_ops dma_dummy_ops = {
34 .mmap = dma_dummy_mmap,
35 .map_page = dma_dummy_map_page,
36 .map_sg = dma_dummy_map_sg,
37 .dma_supported = dma_dummy_supported,
38};