Linux 4.18.10
[linux/fpc-iii.git] / drivers / spi / internals.h
blob4a28a8395552d29d2ac2200b82346752ad07d4b8
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Copyright (C) 2018 Exceet Electronics GmbH
4 * Copyright (C) 2018 Bootlin
6 * Author: Boris Brezillon <boris.brezillon@bootlin.com>
8 * Helpers needed by the spi or spi-mem logic. Should not be used outside of
9 * spi-mem.c and spi.c.
12 #ifndef __LINUX_SPI_INTERNALS_H
13 #define __LINUX_SPI_INTERNALS_H
15 #include <linux/device.h>
16 #include <linux/dma-direction.h>
17 #include <linux/scatterlist.h>
18 #include <linux/spi/spi.h>
20 void spi_flush_queue(struct spi_controller *ctrl);
22 #ifdef CONFIG_HAS_DMA
23 int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
24 struct sg_table *sgt, void *buf, size_t len,
25 enum dma_data_direction dir);
26 void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
27 struct sg_table *sgt, enum dma_data_direction dir);
28 #else /* !CONFIG_HAS_DMA */
29 static inline int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
30 struct sg_table *sgt, void *buf, size_t len,
31 enum dma_data_direction dir)
33 return -EINVAL;
36 static inline void spi_unmap_buf(struct spi_controller *ctlr,
37 struct device *dev, struct sg_table *sgt,
38 enum dma_data_direction dir)
41 #endif /* CONFIG_HAS_DMA */
43 #endif /* __LINUX_SPI_INTERNALS_H */