Skip to content

Commit

Permalink
dmaengine: Add helper function to convert direction value to text
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Vinod Koul committed Jan 21, 2020
1 parent 6755ec0 commit 816ebf4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/linux/dmaengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 816ebf4

Please sign in to comment.