From patchwork Tue Oct 25 09:02:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp892453wru; Tue, 25 Oct 2022 02:09:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WhDG7VE2hDST1Mk1W32aw/mJ+/HOmmU+iWyOVVj7JDwpOLYdUyUN2S6UW6xjMEoAOZdub X-Received: by 2002:a17:907:8a23:b0:78d:b042:eece with SMTP id sc35-20020a1709078a2300b0078db042eecemr30250721ejc.494.1666688962435; Tue, 25 Oct 2022 02:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688962; cv=none; d=google.com; s=arc-20160816; b=KtPsh/LpjI3y1XFkhv45mLomGIVFHuf2aJJiWmOClvecmc8cXCXHsHHe8hMhTlRkAq m/pn1XNt1uEdVI3WtnQlprTFQMI4qLem0l9qcKeL2TfMV44kxz/k5zNilhSmRXCc3fly t297KhQY9R9vG71SD63JAERMM1KMR3/kRH/v8vuPt0G7kjnylzjO6PCzzHQeJJwq6vNR zQhdV2dyUrd5FF4f8EV/X76/En4l6WqfRFLo6OyTpjoAX+zUPQI4b1bG20WR8skoCR68 +ZigPuo8XFqQL44piZkQJVWc02yevr5QXl998X2Dy+X0B+r3BldXhurdLQ7K3J6a7D0p DC5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FR9gdycklEYsEQXBcnBkLdNuDhMCTk+kb2MA7DN0G8M=; b=sFQYOFEpOiIPpXBwwcn3dM416VWCVWZyPuwpLhaKm9Hvgy2rojHlDXiq0ys/q3ePZ/ Q+QxGkuHjUbeQ1ueqFMabs9cNQ1qYr6FSqMA3sYUlKGj2GzFp46Wmydc89cx3v3lAtfG DSMe5vzvYHqLwn5LEIRk/1kLJEocj9tZmG35DIeNzEf9LtvnAmRMSJG2LGB4/15nMNww lFjmmmVtzyShAJuqTl7tnaiu2VkQRb6ytc5vb49eR3qaV1MZuEhBJY6aCzpcyG1vkUJd gYpcuLeWuA319vBT6dbbWO0zTtZ/1RzjU7ohrvFxZbxHwtPYK4VnYygCPB5ipHipR4mn p7wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PAwd3TXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv28-20020a1709072bdc00b0078e0fd161dasi2253514ejc.87.2022.10.25.02.08.56; Tue, 25 Oct 2022 02:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PAwd3TXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232091AbiJYJD7 (ORCPT + 99 others); Tue, 25 Oct 2022 05:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231951AbiJYJDt (ORCPT ); Tue, 25 Oct 2022 05:03:49 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0EE15A336; Tue, 25 Oct 2022 02:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1666688612; x=1698224612; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ul7BWlxhjD0J6EB9rCSizho6eFo0osfoJ9tcx8Tf/VE=; b=PAwd3TXi78DZ0Buooa/KLIU9o410IN/966q5h9XmmTwo55c6800VtxHy h5c2WDy7wduKDEwxp8VUINAm1yDCPJn3UqnxlBS9iziQlTyQJPynaoOLS xRmoUPqNWlxzyb1L5obZqQHcYdGBLqswBSQXawiuM8wD6z2wlEEU5yGgZ B5BTqxHMXL5HJtmIpzaGaJnCMnM/80xVD5ur879giiiQBdW5wT7kH/ySa gOAHSlab0iwuxV+OZIWjRKRxgtGX+TkhfSd8PpnLBRMHDeyAYAl17reX8 TlmMgmqYE3tHmkeb4N1ABoDIRZkDnuhQ7271LGSwG1fje64YVYSqjAuNO g==; X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="120221233" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Oct 2022 02:03:30 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 25 Oct 2022 02:03:27 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 25 Oct 2022 02:03:25 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , "Tudor Ambarus" , Subject: [PATCH v2 05/32] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Date: Tue, 25 Oct 2022 12:02:39 +0300 Message-ID: <20221025090306.297886-6-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025090306.297886-1-tudor.ambarus@microchip.com> References: <20221025090306.297886-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747650045163898158?= X-GMAIL-MSGID: =?utf-8?q?1747650045163898158?= The method was wrong because it violated the dmaengine API. For aborted transfers the complete callback should not be called. Fix the behavior and do not call the complete callback on device_terminate_all. Fixes: 808347f6a317 ("dmaengine: at_hdmac: add DMA slave transfers") Reported-by: Peter Rosin Signed-off-by: Tudor Ambarus Cc: stable@vger.kernel.org Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/ --- drivers/dma/at_hdmac.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index cb5522417db6..11816484843e 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1437,11 +1437,8 @@ static int atc_terminate_all(struct dma_chan *chan) struct at_dma_chan *atchan = to_at_dma_chan(chan); struct at_dma *atdma = to_at_dma(chan->device); int chan_id = atchan->chan_common.chan_id; - struct at_desc *desc, *_desc; unsigned long flags; - LIST_HEAD(list); - dev_vdbg(chan2dev(chan), "%s\n", __func__); /* @@ -1460,15 +1457,11 @@ static int atc_terminate_all(struct dma_chan *chan) cpu_relax(); /* active_list entries will end up before queued entries */ - list_splice_init(&atchan->queue, &list); - list_splice_init(&atchan->active_list, &list); + list_splice_tail_init(&atchan->queue, &atchan->free_list); + list_splice_tail_init(&atchan->active_list, &atchan->free_list); spin_unlock_irqrestore(&atchan->lock, flags); - /* Flush all pending and queued descriptors */ - list_for_each_entry_safe(desc, _desc, &list, desc_node) - atc_chain_complete(atchan, desc); - clear_bit(ATC_IS_PAUSED, &atchan->status); /* if channel dedicated to cyclic operations, free it */ clear_bit(ATC_IS_CYCLIC, &atchan->status);