|
@@ -46,6 +46,8 @@
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
#include <trace/events/spi.h>
|
|
|
|
|
|
+#include "internals.h"
|
|
|
+
|
|
|
static DEFINE_IDR(spi_master_idr);
|
|
|
|
|
|
static void spidev_release(struct device *dev)
|
|
@@ -740,9 +742,9 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
|
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_HAS_DMA
|
|
|
-static int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
- struct sg_table *sgt, void *buf, size_t len,
|
|
|
- enum dma_data_direction dir)
|
|
|
+int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
+ struct sg_table *sgt, void *buf, size_t len,
|
|
|
+ enum dma_data_direction dir)
|
|
|
{
|
|
|
const bool vmalloced_buf = is_vmalloc_addr(buf);
|
|
|
unsigned int max_seg_size = dma_get_max_seg_size(dev);
|
|
@@ -821,8 +823,8 @@ static int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
- struct sg_table *sgt, enum dma_data_direction dir)
|
|
|
+void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
+ struct sg_table *sgt, enum dma_data_direction dir)
|
|
|
{
|
|
|
if (sgt->orig_nents) {
|
|
|
dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir);
|
|
@@ -907,19 +909,6 @@ static int __spi_unmap_msg(struct spi_controller *ctlr, struct spi_message *msg)
|
|
|
return 0;
|
|
|
}
|
|
|
#else /* !CONFIG_HAS_DMA */
|
|
|
-static inline int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
|
|
|
- struct sg_table *sgt, void *buf, size_t len,
|
|
|
- enum dma_data_direction dir)
|
|
|
-{
|
|
|
- return -EINVAL;
|
|
|
-}
|
|
|
-
|
|
|
-static inline void spi_unmap_buf(struct spi_controller *ctlr,
|
|
|
- struct device *dev, struct sg_table *sgt,
|
|
|
- enum dma_data_direction dir)
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
static inline int __spi_map_msg(struct spi_controller *ctlr,
|
|
|
struct spi_message *msg)
|
|
|
{
|