From patchwork Tue Nov 6 05:01:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10669633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5242113BF for ; Tue, 6 Nov 2018 05:02:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 423B429B9F for ; Tue, 6 Nov 2018 05:02:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36F092A0A7; Tue, 6 Nov 2018 05:02:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CCD29B9F for ; Tue, 6 Nov 2018 05:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729798AbeKFOZb (ORCPT ); Tue, 6 Nov 2018 09:25:31 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38916 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729724AbeKFOZb (ORCPT ); Tue, 6 Nov 2018 09:25:31 -0500 Received: by mail-pl1-f193.google.com with SMTP id b5-v6so5577438pla.6 for ; Mon, 05 Nov 2018 21:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Ipu0OKiVTAGWTLE4fg/nM2ymSy+8y5EVSd0lvjhlhp8=; b=gutae7G74a5xWjvogNtC3uF7yCVomb6SNDj4i/rOZwIqyQrrPMcLKpUVx0rsnX15Ju kE3KVj6sicYEePLve7JYvmafJCZsUduo0QgnTSQFHG2AvthQXdg3uIeN7/WCdzg61MOC MlSY9nCD6TpzzC31M86yCd7b1Xa81FTIzHdoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Ipu0OKiVTAGWTLE4fg/nM2ymSy+8y5EVSd0lvjhlhp8=; b=h3EovYLIaPsouP/NYVnR3eP2KmKR0rpKi7ED71tyjh7D/rEhMeHdhGnIPm7E+YuiF8 CxpnclJ08SNsV8wbOBt6VBabP7qwni6eCG7k5fxUF/xlVGss3zjCsUHpurdFaCvrZ7pr O2tW3Dy7e6uEe9fxh9T5ojdeIS++MXEdvci4bWnv4bgjeRGgTyWska3+Bz6I6nVb61Oa aQNUPBLpXN+beXSisksApyJCsDOCWGj/hIXgSadZL8vNuZfHBqRiQ+hs0GL/OD1gd0sm GAHIK2/qn27dz8FSTYJ1T869oKiANW9+fQB8ONwX4+Qlyv1fYf4xHfpZrqkvurimTJmh PZJA== X-Gm-Message-State: AGRZ1gKp1H85dFzPklH+9zsyPeVsuBRs7UK03Md/vkIXfnz4pp1xer8N 8w43pvuSsTco//8Ik6JtwHZVlQ== X-Google-Smtp-Source: AJdET5ejAw5ZSntam1RDEA1skDfRYO2Q88ZXm3BjphhZKf+kfSrc0digFKk9c1c/5ZbHRlQdO8x+IA== X-Received: by 2002:a17:902:4222:: with SMTP id g31-v6mr24679107pld.236.1541480528979; Mon, 05 Nov 2018 21:02:08 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id o7-v6sm55735416pfb.23.2018.11.05.21.02.06 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 21:02:08 -0800 (PST) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org, eric.long@unisoc.com Cc: broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH 3/7] dmaengine: sprd: Fix the last link-list configuration Date: Tue, 6 Nov 2018 13:01:33 +0800 Message-Id: <95cbea4b835bb2689036afe78ff0b2239a24f352.1541480353.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Long We will pass sglen as 0 configure the last link-list configuration when filling the descriptor, which will cause the incorrect link-list configuration. Thus we should check if the sglen is 0 to configure the correct link-list configuration. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 4f3587b..e6a74dc 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -697,7 +697,8 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, hw->cfg |= SPRD_DMA_LINKLIST_EN; /* link-list index */ - temp = (sg_index + 1) % sglen; + temp = sglen ? (sg_index + 1) % sglen : 0; + /* Next link-list configuration's physical address offset */ temp = temp * sizeof(*hw) + SPRD_DMA_CHN_SRC_ADDR; /*