summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@nxp.com>2026-10-01 10:39:53 -0400
committerVinod Koul <vkoul@kernel.org>2026-10-09 11:53:04 +0200
commit511afae96d89847f753fcab6b3a597f0281be9d5 (patch)
treeff8dcda56bc7da0360e037b7123135ecb4095bd0 /drivers/dma
parent562b6ed45db52934aaab9fbc856db3db79753155 (diff)
dmaengine: move driver-private helpers out of include/linux/dmaengine.h
Move the following functions and declarations from the public header include/linux/dmaengine.h into the driver-private header drivers/dma/dmaengine.h, since they are only used by DMA engine drivers and not by DMA engine consumers: - dma_async_device_register() - dmaenginem_async_device_register() - dma_async_device_unregister() - dma_async_device_channel_register() - dma_async_device_channel_unregister() - is_slave_direction() - dmaengine_get_direction_text() Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261001143955.2195063-1-Frank.Li@oss.nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmaengine.h32
-rw-r--r--drivers/dma/dw/dw.c1
2 files changed, 33 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
index 53f16d3f0029..42a3cfa7e597 100644
--- a/drivers/dma/dmaengine.h
+++ b/drivers/dma/dmaengine.h
@@ -182,6 +182,38 @@ dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
+static inline char *
+dmaengine_get_direction_text(enum dma_transfer_direction dir)
+{
+ switch (dir) {
+ case DMA_DEV_TO_MEM:
+ return "DEV_TO_MEM";
+ case DMA_MEM_TO_DEV:
+ return "MEM_TO_DEV";
+ case DMA_MEM_TO_MEM:
+ return "MEM_TO_MEM";
+ case DMA_DEV_TO_DEV:
+ return "DEV_TO_DEV";
+ default:
+ return "invalid";
+ }
+}
+
+static inline bool is_slave_direction(enum dma_transfer_direction direction)
+{
+ return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM) ||
+ (direction == DMA_DEV_TO_DEV);
+}
+
+int dma_async_device_register(struct dma_device *device);
+int dmaenginem_async_device_register(struct dma_device *device);
+void dma_async_device_unregister(struct dma_device *device);
+int dma_async_device_channel_register(struct dma_device *device,
+ struct dma_chan *chan,
+ const char *name);
+void dma_async_device_channel_unregister(struct dma_device *device,
+ struct dma_chan *chan);
+
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
diff --git a/drivers/dma/dw/dw.c b/drivers/dma/dw/dw.c
index 6766142884b6..e56974e7d4af 100644
--- a/drivers/dma/dw/dw.c
+++ b/drivers/dma/dw/dw.c
@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/types.h>
+#include "../dmaengine.h"
#include "internal.h"
static void dw_dma_initialize_chan(struct dw_dma_chan *dwc)