dmaengine: introduce is_slave_direction function
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 10 Jan 2013 08:52:56 +0000 (10:52 +0200)
committerVinod Koul <vinod.koul@intel.com>
Sat, 12 Jan 2013 13:07:21 +0000 (05:07 -0800)
This function helps to distinguish the slave type of transfer by checking the
direction parameter.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
include/linux/dmaengine.h

index 4ca9cf73ad3f4ff7357da07625d6406048cfe7f1..bfcdecb5d87a16ad9af33dace1d9902d9d9823d2 100644 (file)
@@ -621,6 +621,11 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
                        (unsigned long)config);
 }
 
+static inline bool is_slave_direction(enum dma_transfer_direction direction)
+{
+       return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
+}
+
 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
        struct dma_chan *chan, dma_addr_t buf, size_t len,
        enum dma_transfer_direction dir, unsigned long flags)