diff mbox series

[U-Boot,2/2] dma: Add stub of dma_memcpy and dma_get_device

Message ID 20191115113042.21334-2-vigneshr@ti.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/2] Kconfig: Rename CONFIG_SPL_DMA_SUPPORT to CONFIG_SPL_DMA | expand

Commit Message

Raghavendra, Vignesh Nov. 15, 2019, 11:30 a.m. UTC
Add stub for dma_memcpy() and dma_get_device when CONFIG_DMA is
disabled. This avoids ifdefs in driver code using DMA APIs

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 include/dma.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Simon Glass Dec. 27, 2019, 12:45 p.m. UTC | #1
On Fri, 15 Nov 2019 at 04:31, Vignesh Raghavendra <vigneshr@ti.com> wrote:
>
> Add stub for dma_memcpy() and dma_get_device when CONFIG_DMA is
> disabled. This avoids ifdefs in driver code using DMA APIs
>
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  include/dma.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Jan. 16, 2020, 2:40 p.m. UTC | #2
On Fri, Nov 15, 2019 at 05:00:42PM +0530, Vignesh Raghavendra wrote:

> Add stub for dma_memcpy() and dma_get_device when CONFIG_DMA is
> disabled. This avoids ifdefs in driver code using DMA APIs
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/dma.h b/include/dma.h
index d1c3d0df7d91..32885571f7d4 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -292,6 +292,7 @@  int dma_receive(struct dma *dma, void **dst, void *metadata);
 int dma_send(struct dma *dma, void *src, size_t len, void *metadata);
 #endif /* CONFIG_DMA_CHANNELS */
 
+#if CONFIG_IS_ENABLED(DMA)
 /*
  * dma_get_device - get a DMA device which supports transfer
  * type of transfer_type
@@ -315,5 +316,15 @@  int dma_get_device(u32 transfer_type, struct udevice **devp);
 	     transferred and on failure return error code.
  */
 int dma_memcpy(void *dst, void *src, size_t len);
+#else
+static inline int dma_get_device(u32 transfer_type, struct udevice **devp)
+{
+	return -ENOSYS;
+}
 
+static inline int dma_memcpy(void *dst, void *src, size_t len)
+{
+	return -ENOSYS;
+}
+#endif /* CONFIG_DMA */
 #endif	/* _DMA_H_ */