dw_dmac: introduce to_dw_desc() macro
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 18 Oct 2012 14:34:12 +0000 (17:34 +0300)
committerVinod Koul <vinod.koul@intel.com>
Tue, 8 Jan 2013 06:04:52 +0000 (22:04 -0800)
The to_dw_desc() macro helps to retrieve the dw_desc node from the
corresponding list_head structure.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
drivers/dma/dw_dmac.c
drivers/dma/dw_dmac_regs.h

index 9a27fb70c9500cb2c5713b7cc6f514f022c2db20..476e9c8fb6ca71a37919ca0d79de83e0357db6b2 100644 (file)
@@ -93,7 +93,7 @@ static struct device *chan2parent(struct dma_chan *chan)
 
 static struct dw_desc *dwc_first_active(struct dw_dma_chan *dwc)
 {
-       return list_entry(dwc->active_list.next, struct dw_desc, desc_node);
+       return to_dw_desc(dwc->active_list.next);
 }
 
 static struct dw_desc *dwc_desc_get(struct dw_dma_chan *dwc)
@@ -600,9 +600,7 @@ static void dw_dma_tasklet(unsigned long data)
                        if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags)) {
                                if (dwc->tx_node_active != dwc->tx_list) {
                                        struct dw_desc *desc =
-                                               list_entry(dwc->tx_node_active,
-                                                          struct dw_desc,
-                                                          desc_node);
+                                               to_dw_desc(dwc->tx_node_active);
 
                                        dma_writel(dw, CLEAR.XFER, dwc->mask);
 
index 88a069f66b8941f08a79496befd439435b1efc10..8881e9b277a36d0bd268e81caf1612ca5fd3383e 100644 (file)
@@ -299,6 +299,8 @@ struct dw_desc {
        size_t                          len;
 };
 
+#define to_dw_desc(h)  list_entry(h, struct dw_desc, desc_node)
+
 static inline struct dw_desc *
 txd_to_dw_desc(struct dma_async_tx_descriptor *txd)
 {