From patchwork Thu Nov 30 11:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13474241 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Q8UHR8wp" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8067D54 for ; Thu, 30 Nov 2023 03:13:19 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B5DD6E000B; Thu, 30 Nov 2023 11:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701342798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XClNDtyud7j7WgjvCaT6bz7tPpueCUv3M+YJKIhqVZU=; b=Q8UHR8wpehZGD+c07ORJulu8+guUSHLgAAZ1FiFV7KzzZN2rGHDL5OeMIf7UqG9ix+/LOs gdp0amtwKHCBI8S15LN6jxXGqTq7zCRyTXhGdYCEU/sxqUalAPNt4mt9hhhX+lPWngYcVr lZ/e0F3refEP5/qe5fb62M7lE9VyWvH6msZ/kh/UMeADV8lN4X2EpleAtAd3QdSHRd1kBL qRtzUaMs17Pbt/VFOoeI4owLFpe3eBKREShiKXHJsRx+Pg3GWYtdd3niHsdDOUQTJYBDyL Aa5Wd6K5Qa49KYRofIE79ggkUGrH8XVcT40Nm4r8O2SudrzbYJ3gtjfzpGhNWg== From: Miquel Raynal To: Lizhi Hou , Brian Xu , Raj Kumar Rampelli , Vinod Koul Cc: Thomas Petazzoni , Michal Simek , dmaengine@vger.kernel.org, Miquel Raynal Subject: [PATCH v2 2/4] dmaengine: xilinx: xdma: Clarify the logic between cyclic/sg modes Date: Thu, 30 Nov 2023 12:13:13 +0100 Message-Id: <20231130111315.729430-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130111315.729430-1-miquel.raynal@bootlin.com> References: <20231130111315.729430-1-miquel.raynal@bootlin.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: miquel.raynal@bootlin.com We support both modes, but they perform totally different taks in the interrupt handler. Clarify what shall be done in each case. Signed-off-by: Miquel Raynal --- drivers/dma/xilinx/xdma.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 2c9c72d4b5a2..4efef1b5f89c 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -765,26 +765,23 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id) regmap_write(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, st); vchan_cyclic_callback(vd); - goto out; - } - - desc->completed_desc_num += complete_desc_num; + } else { + desc->completed_desc_num += complete_desc_num; - /* - * if all data blocks are transferred, remove and complete the request - */ - if (desc->completed_desc_num == desc->desc_num) { - list_del(&vd->node); - vchan_cookie_complete(vd); - goto out; - } + /* if all data blocks are transferred, remove and complete the request */ + if (desc->completed_desc_num == desc->desc_num) { + list_del(&vd->node); + vchan_cookie_complete(vd); + goto out; + } - if (desc->completed_desc_num > desc->desc_num || - complete_desc_num != XDMA_DESC_BLOCK_NUM * XDMA_DESC_ADJACENT) - goto out; + if (desc->completed_desc_num > desc->desc_num || + complete_desc_num != XDMA_DESC_BLOCK_NUM * XDMA_DESC_ADJACENT) + goto out; - /* transfer the rest of data (SG only) */ - xdma_xfer_start(xchan); + /* transfer the rest of data */ + xdma_xfer_start(xchan); + } out: spin_unlock(&xchan->vchan.lock);