]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: sh: rz-dmac: Add helper to check if the channel is paused
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tue, 26 May 2026 08:47:00 +0000 (11:47 +0300)
committerVinod Koul <vkoul@kernel.org>
Thu, 4 Jun 2026 15:28:32 +0000 (20:58 +0530)
Add the rz_dmac_chan_is_paused() helper to check if the channel is paused.
This helper will be reused in subsequent patches.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Tested-by: John Madieu <john.madieu.xa@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://patch.msgid.link/20260526084710.3491480-9-claudiu.beznea@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sh/rz-dmac.c

index 76bac11c217cd46668b3b1e553ba24e82faf6af4..217657513fa76d9f9287c89fbfc7d96d717deed6 100644 (file)
@@ -286,6 +286,13 @@ static bool rz_dmac_chan_is_enabled(struct rz_dmac_chan *channel)
        return !!(val & CHSTAT_EN);
 }
 
+static bool rz_dmac_chan_is_paused(struct rz_dmac_chan *channel)
+{
+       u32 val = rz_dmac_ch_readl(channel, CHSTAT, 1);
+
+       return !!(val & CHSTAT_SUS);
+}
+
 static void rz_dmac_enable_hw(struct rz_dmac_chan *channel)
 {
        struct dma_chan *chan = &channel->vc.chan;
@@ -822,12 +829,9 @@ static enum dma_status rz_dmac_tx_status(struct dma_chan *chan,
                return status;
 
        scoped_guard(spinlock_irqsave, &channel->vc.lock) {
-               u32 val;
-
                residue = rz_dmac_chan_get_residue(channel, cookie);
 
-               val = rz_dmac_ch_readl(channel, CHSTAT, 1);
-               if (val & CHSTAT_SUS)
+               if (rz_dmac_chan_is_paused(channel))
                        status = DMA_PAUSED;
        }