Skip to content

Commit 816ebf4

Browse files
Peter Ujfalusivinodkoul
authored andcommitted
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>
1 parent 6755ec0 commit 816ebf4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

include/linux/dmaengine.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,4 +1545,23 @@ static inline struct dma_chan
15451545

15461546
return __dma_request_channel(mask, fn, fn_param, NULL);
15471547
}
1548+
1549+
static inline char *
1550+
dmaengine_get_direction_text(enum dma_transfer_direction dir)
1551+
{
1552+
switch (dir) {
1553+
case DMA_DEV_TO_MEM:
1554+
return "DEV_TO_MEM";
1555+
case DMA_MEM_TO_DEV:
1556+
return "MEM_TO_DEV";
1557+
case DMA_MEM_TO_MEM:
1558+
return "MEM_TO_MEM";
1559+
case DMA_DEV_TO_DEV:
1560+
return "DEV_TO_DEV";
1561+
default:
1562+
break;
1563+
}
1564+
1565+
return "invalid";
1566+
}
15481567
#endif /* DMAENGINE_H */

0 commit comments

Comments
 (0)