MLK-22302-1: dmaengine: imx-sdma: fix build warning with CONFIG_PM_SLEEP=n
authorRobin Gong <yibin.gong@nxp.com>
Tue, 23 Jul 2019 15:42:29 +0000 (23:42 +0800)
committerRobin Gong <yibin.gong@nxp.com>
Tue, 23 Jul 2019 16:50:48 +0000 (00:50 +0800)
Fix build waring with CONFIG_PM_SLEEP=n.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
(cherry picked from commit 14ba28430da19e26445e05ae77195d88f1a0e7cf)

drivers/dma/imx-sdma.c

index c1fb76d..e231d26 100644 (file)
@@ -1110,31 +1110,6 @@ static int sdma_load_context(struct sdma_channel *sdmac)
        return ret;
 }
 
-static int sdma_save_restore_context(struct sdma_engine *sdma, bool save)
-{
-       struct sdma_context_data *context = sdma->context;
-       struct sdma_buffer_descriptor *bd0 = sdma->bd0;
-       unsigned long flags;
-       int ret;
-
-       spin_lock_irqsave(&sdma->channel_0_lock, flags);
-
-       if (save)
-               bd0->mode.command = C0_GETDM;
-       else
-               bd0->mode.command = C0_SETDM;
-
-       bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
-       bd0->mode.count = MAX_DMA_CHANNELS * sizeof(*context) / 4;
-       bd0->buffer_addr = sdma->context_phys;
-       bd0->ext_buffer_addr = 2048;
-       ret = sdma_run_channel0(sdma);
-
-       spin_unlock_irqrestore(&sdma->channel_0_lock, flags);
-
-       return ret;
-}
-
 static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
 {
        return container_of(chan, struct sdma_channel, vc.chan);
@@ -2492,6 +2467,31 @@ static int sdma_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static int sdma_save_restore_context(struct sdma_engine *sdma, bool save)
+{
+       struct sdma_context_data *context = sdma->context;
+       struct sdma_buffer_descriptor *bd0 = sdma->bd0;
+       unsigned long flags;
+       int ret;
+
+       spin_lock_irqsave(&sdma->channel_0_lock, flags);
+
+       if (save)
+               bd0->mode.command = C0_GETDM;
+       else
+               bd0->mode.command = C0_SETDM;
+
+       bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
+       bd0->mode.count = MAX_DMA_CHANNELS * sizeof(*context) / 4;
+       bd0->buffer_addr = sdma->context_phys;
+       bd0->ext_buffer_addr = 2048;
+       ret = sdma_run_channel0(sdma);
+
+       spin_unlock_irqrestore(&sdma->channel_0_lock, flags);
+
+       return ret;
+}
+
 static int sdma_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);