dw_dmac: introduce dwc_dump_chan_regs to dump registers
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 19 Jun 2012 10:34:03 +0000 (13:34 +0300)
committerVinod Koul <vinod.koul@linux.intel.com>
Thu, 21 Jun 2012 02:35:34 +0000 (08:05 +0530)
There is three places where values of the most significant registers were
printed. Make such piece of code as separate function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.linux@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
drivers/dma/dw_dmac.c

index 9794f00810f6dc326c4be949b3ce47fd1e3d0e56..467599a4b9b68b7ffec2b5acb41917d0f8c02577 100644 (file)
@@ -191,6 +191,19 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 
 /*----------------------------------------------------------------------*/
 
+static void dwc_dump_chan_regs(struct dw_dma_chan *dwc)
+{
+       dev_err(chan2dev(&dwc->chan),
+               "  SAR: 0x%x DAR: 0x%x LLP: 0x%x CTL: 0x%x:%08x\n",
+               channel_readl(dwc, SAR),
+               channel_readl(dwc, DAR),
+               channel_readl(dwc, LLP),
+               channel_readl(dwc, CTL_HI),
+               channel_readl(dwc, CTL_LO));
+}
+
+/*----------------------------------------------------------------------*/
+
 /* Called with dwc->lock held and bh disabled */
 static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
 {
@@ -200,13 +213,7 @@ static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
        if (dma_readl(dw, CH_EN) & dwc->mask) {
                dev_err(chan2dev(&dwc->chan),
                        "BUG: Attempted to start non-idle channel\n");
-               dev_err(chan2dev(&dwc->chan),
-                       "  SAR: 0x%x DAR: 0x%x LLP: 0x%x CTL: 0x%x:%08x\n",
-                       channel_readl(dwc, SAR),
-                       channel_readl(dwc, DAR),
-                       channel_readl(dwc, LLP),
-                       channel_readl(dwc, CTL_HI),
-                       channel_readl(dwc, CTL_LO));
+               dwc_dump_chan_regs(dwc);
 
                /* The tasklet will hopefully advance the queue... */
                return;
@@ -490,13 +497,7 @@ static void dwc_handle_cyclic(struct dw_dma *dw, struct dw_dma_chan *dwc,
 
                spin_lock_irqsave(&dwc->lock, flags);
 
-               dev_err(chan2dev(&dwc->chan),
-                       "  SAR: 0x%x DAR: 0x%x LLP: 0x%x CTL: 0x%x:%08x\n",
-                       channel_readl(dwc, SAR),
-                       channel_readl(dwc, DAR),
-                       channel_readl(dwc, LLP),
-                       channel_readl(dwc, CTL_HI),
-                       channel_readl(dwc, CTL_LO));
+               dwc_dump_chan_regs(dwc);
 
                channel_clear_bit(dw, CH_EN, dwc->mask);
                while (dma_readl(dw, CH_EN) & dwc->mask)
@@ -1131,13 +1132,7 @@ int dw_dma_cyclic_start(struct dma_chan *chan)
        if (dma_readl(dw, CH_EN) & dwc->mask) {
                dev_err(chan2dev(&dwc->chan),
                        "BUG: Attempted to start non-idle channel\n");
-               dev_err(chan2dev(&dwc->chan),
-                       "  SAR: 0x%x DAR: 0x%x LLP: 0x%x CTL: 0x%x:%08x\n",
-                       channel_readl(dwc, SAR),
-                       channel_readl(dwc, DAR),
-                       channel_readl(dwc, LLP),
-                       channel_readl(dwc, CTL_HI),
-                       channel_readl(dwc, CTL_LO));
+               dwc_dump_chan_regs(dwc);
                spin_unlock_irqrestore(&dwc->lock, flags);
                return -EBUSY;
        }