From patchwork Thu Nov 25 09:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12693613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3829C433EF for ; Thu, 25 Nov 2021 09:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rPHK7PrqzTen9Gk9sAInxIJvYbANx3oSgRecaoM1boQ=; b=GcMAxWMjPmpvRu 1lpKTAHJZ1xm9RExF5TV/V+rUF7KDzWhxsAAKsRpiKxWG5gD41gp6Za3wvfpSs6gn86GdLjrT1Nzg up+jOsvYJldZxPxuhk1aGxKR1Gzm41B7Th+Afw2UcJhEUqOgcrWVUy7m6+0ulOJ7anW35T+tnNIlL nCdYNHZWEGQGOwpiu4m1SzI+It93OzyRRPFjn47Wc7A8mG5ulcT6r7YeqNbQNvUIaXFFE6iNMxhR5 +QMiLbAacnCuB/piPos+OdtT6+0izkp28KTYfDhtPlKxXE8cVupba8tgBP7jO+BCqsHtDYODNnZrW YlOlVDp0j4Sl2m+aqaow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqAfB-006odV-3l; Thu, 25 Nov 2021 09:03:29 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqAco-006nXI-MI for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 09:01:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1637830863; x=1669366863; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nuxqXU7uniwAlyc6jwMoADsVym2af+0HTfirATPA/GM=; b=M1Cln4hGeoj36lPEmmsS5IRAmBvJaPx+165qRNs8es4AqIL7g6uXvKUz j07J7VbfYPsp5MsPeFN47zgPGWtI6AOsCjakHfmBnJbWdN8IrBy9H/9Nq AFQ5mdxQfzVu1A5XxCeUDhcKeDyUm0Drkuv7W4TrAxWgE3KvCyROQUbti VWkeqK4PHGEg2TKNeeemN0EbxoNHldoOP7s16Zul/nZrRltojaiqj7tEj ipOtAlneykl7tVz+II8s6jJt1tbNoUABO96+Pdvh1qgsSH7kMBC09cIko LzoZ9G1xY6t8I8ttGAWZ5znImMKp6Be4dFDplrVpiS9yRUXoSfUBYW2tn w==; IronPort-SDR: +uerOeXV8bj+0gQ+9JOh+w5wh8uzTJguwAtWP/v4VJjgnBqUOQNEgJuBFAvYgHGfX9w9e7d/Mc XniK3hBz6VGEBnTRqrox8c1gYANjZbwJHpfAX6BusXot/8VM7YkiXINOsKjheLyQk5xYjMa0qg hOtONQFp0WIUlm+A98wpPBHkdV1HKR5Z9tAvc703FwxlymWYXLqDfJv6iNdAMFauJhndecyPKc 0BBw+hdOGhMCJiWztIpbe+1gMMPwwySoyOGrqUhKhROtJSeHsrJeW4IkNU8iEf2KW7AKmLEsK4 S9ajYuTp1g2Fg1NaMzxoturi X-IronPort-AV: E=Sophos;i="5.87,262,1631602800"; d="scan'208";a="144534265" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2021 02:01:01 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.2176.14; Thu, 25 Nov 2021 02:00:59 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 25 Nov 2021 02:00:56 -0700 From: Tudor Ambarus To: , , , , Subject: [PATCH v2 08/13] dmaengine: at_xdmac: Move the free desc to the tail of the desc list Date: Thu, 25 Nov 2021 11:00:23 +0200 Message-ID: <20211125090028.786832-9-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211125090028.786832-1-tudor.ambarus@microchip.com> References: <20211125090028.786832-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_010102_837528_A87A6FA1 X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , mripard@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org So that we don't use the same desc over and over again. Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 2cc9af222681..8804a86a9bcc 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -729,7 +729,8 @@ at_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, if (!desc) { dev_err(chan2dev(chan), "can't get descriptor\n"); if (first) - list_splice_init(&first->descs_list, &atchan->free_descs_list); + list_splice_tail_init(&first->descs_list, + &atchan->free_descs_list); goto spin_unlock; } @@ -817,7 +818,8 @@ at_xdmac_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, if (!desc) { dev_err(chan2dev(chan), "can't get descriptor\n"); if (first) - list_splice_init(&first->descs_list, &atchan->free_descs_list); + list_splice_tail_init(&first->descs_list, + &atchan->free_descs_list); spin_unlock_irqrestore(&atchan->lock, irqflags); return NULL; } @@ -1051,8 +1053,8 @@ at_xdmac_prep_interleaved(struct dma_chan *chan, src_addr, dst_addr, xt, chunk); if (!desc) { - list_splice_init(&first->descs_list, - &atchan->free_descs_list); + list_splice_tail_init(&first->descs_list, + &atchan->free_descs_list); return NULL; } @@ -1132,7 +1134,8 @@ at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, if (!desc) { dev_err(chan2dev(chan), "can't get descriptor\n"); if (first) - list_splice_init(&first->descs_list, &atchan->free_descs_list); + list_splice_tail_init(&first->descs_list, + &atchan->free_descs_list); return NULL; } @@ -1308,8 +1311,8 @@ at_xdmac_prep_dma_memset_sg(struct dma_chan *chan, struct scatterlist *sgl, sg_dma_len(sg), value); if (!desc && first) - list_splice_init(&first->descs_list, - &atchan->free_descs_list); + list_splice_tail_init(&first->descs_list, + &atchan->free_descs_list); if (!first) first = desc; @@ -1701,7 +1704,8 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) spin_lock_irq(&atchan->lock); /* Move the xfer descriptors into the free descriptors list. */ - list_splice_init(&desc->descs_list, &atchan->free_descs_list); + list_splice_tail_init(&desc->descs_list, + &atchan->free_descs_list); at_xdmac_advance_work(atchan); spin_unlock_irq(&atchan->lock); } @@ -1850,7 +1854,8 @@ static int at_xdmac_device_terminate_all(struct dma_chan *chan) /* Cancel all pending transfers. */ list_for_each_entry_safe(desc, _desc, &atchan->xfers_list, xfer_node) { list_del(&desc->xfer_node); - list_splice_init(&desc->descs_list, &atchan->free_descs_list); + list_splice_tail_init(&desc->descs_list, + &atchan->free_descs_list); } clear_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);