diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2019-12-23 13:04:46 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-01-21 11:06:12 +0530 |
commit | 816ebf48442eef1c61db26d2ec055f5c8ac83b21 (patch) | |
tree | 452bc742be0c2e19ed2293066593ac191af175f4 /include | |
parent | 6755ec06d1333765d2b935e4e4a5bd011332bac6 (diff) |
dmaengine: Add helper function to convert direction value to text
dmaengine_get_direction_text() can be useful when the direction is printed
out. The text is easier to comprehend than the number.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191223110458.30766-7-peter.ujfalusi@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dmaengine.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index b44b9c608709..62225d46908b 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1545,4 +1545,23 @@ static inline struct dma_chan return __dma_request_channel(mask, fn, fn_param, NULL); } + +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: + break; + } + + return "invalid"; +} #endif /* DMAENGINE_H */ |