From patchwork Mon May 20 14:47:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 10951559 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 898151395 for ; Mon, 20 May 2019 14:48:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76D63288E6 for ; Mon, 20 May 2019 14:48:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B6B02890C; Mon, 20 May 2019 14:48:01 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 14BE22890F for ; Mon, 20 May 2019 14:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:To :From:References:In-Reply-To:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+QFE01pGe7vUhxfEY/8P31jHaRCRnWZvURhUCzl0L/8=; b=kVntkNOWavMCol PkGzz3nY+VwVPHaQi0ekFHpYsZJjs2eKk38QjdD1+vOM0j1nhXylFKhtbOKjTW2lhn03d6ZExJLIm zkCa3tmoy1POts84735bDXbZWcyYMFtYqbxE55FtYQziSnNPr/NMoQCkY2ECXLbSKC94koP/aGUdJ I9KwtwWyXDTd7Qdb2+rcr0J98SmXMfgabmmeLc1n5B2Sr/IxhYOhmKS8eI2DV0V+NxtOWsQQRP9Ho oTakxBkry+4n2AT3G/bNbtLB8F5G70yk3ilVZ0XuDYTWfpHDN+pERfSqjwWFG3A9mhIfnCmDv/hbL jnJHHxrY2vx2CKzhGanQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSja2-0000Hk-OG; Mon, 20 May 2019 14:47:58 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSjZP-0007zl-0R for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 14:47:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:To:From:References:In-Reply-To :Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dVXNwRaht4mbhZtEHlBmOsgFUVlPVkYwCCg6xIosRPE=; b=G57yju6Vm0d0zf4YHcaAgv9U8T 9XEnylhU03pXEtbzgBJgxUaTcSZN6IrSHXj1QNteDfE72P6zJo9hIXl9eZ2porZDQcX1hVDZH48l1 jztDmSRAW2X2mxWWotT+ULRQ4Fizhuol4Z+uGpOLOPBTm4aoBPRMSd/8PvuL2cqPg5s9XqrpzIK+i Z2Vhqe5vvdKYT/WTq5Hu6rN7Sb/g7nxvvVSkPeCJc9IOgrfdzaXOOAwBI2ehKiK+7K+WSChbI/wJS guxU3724cVsVzgvRtdgTqFQmwZFtLp4YYYmQ2LGhvRYK0ibhoaXOZFWyw5DRk+U4JxPhLXYRluyrU oRcPjD7w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:43228 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1hSjZL-0003Ou-1d; Mon, 20 May 2019 15:47:15 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1hSjZK-0000Y9-Gf; Mon, 20 May 2019 15:47:14 +0100 In-Reply-To: <20190520144615.gzrztyhoncyfc5xr@shell.armlinux.org.uk> References: <20190520144615.gzrztyhoncyfc5xr@shell.armlinux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/8] ARM: riscpc: dma: eliminate "cur_sg" scatterlist usage MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 20 May 2019 15:47:14 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_074719_653368_089A6C01 X-CRM114-Status: GOOD ( 14.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP All we really need is the DMA address and size, we don't need the baggage of a full scatterlist structure. Signed-off-by: Russell King --- arch/arm/mach-rpc/dma.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c index c4c96661eb89..37750c6493b4 100644 --- a/arch/arm/mach-rpc/dma.c +++ b/arch/arm/mach-rpc/dma.c @@ -30,7 +30,8 @@ struct iomd_dma { unsigned int state; unsigned long base; /* Controller base address */ int irq; /* Controller IRQ */ - struct scatterlist cur_sg; /* Current controller buffer */ + dma_addr_t cur_addr; + unsigned int cur_len; dma_addr_t dma_addr; unsigned int dma_len; }; @@ -53,13 +54,13 @@ typedef enum { #define CR (IOMD_IO0CR - IOMD_IO0CURA) #define ST (IOMD_IO0ST - IOMD_IO0CURA) -static void iomd_get_next_sg(struct scatterlist *sg, struct iomd_dma *idma) +static void iomd_get_next_sg(struct iomd_dma *idma) { unsigned long end, offset, flags = 0; if (idma->dma.sg) { - sg->dma_address = idma->dma_addr; - offset = sg->dma_address & ~PAGE_MASK; + idma->cur_addr = idma->dma_addr; + offset = idma->cur_addr & ~PAGE_MASK; end = offset + idma->dma_len; @@ -69,7 +70,7 @@ static void iomd_get_next_sg(struct scatterlist *sg, struct iomd_dma *idma) if (offset + TRANSFER_SIZE >= end) flags |= DMA_END_L; - sg->length = end - TRANSFER_SIZE; + idma->cur_len = end - TRANSFER_SIZE; idma->dma_len -= end - offset; idma->dma_addr += end - offset; @@ -87,11 +88,11 @@ static void iomd_get_next_sg(struct scatterlist *sg, struct iomd_dma *idma) } } else { flags = DMA_END_S | DMA_END_L; - sg->dma_address = 0; - sg->length = 0; + idma->cur_addr = 0; + idma->cur_len = 0; } - sg->length |= flags; + idma->cur_len |= flags; } static irqreturn_t iomd_dma_handle(int irq, void *dev_id) @@ -107,26 +108,26 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id) return IRQ_HANDLED; if ((idma->state ^ status) & DMA_ST_AB) - iomd_get_next_sg(&idma->cur_sg, idma); + iomd_get_next_sg(idma); switch (status & (DMA_ST_OFL | DMA_ST_AB)) { case DMA_ST_OFL: /* OIA */ case DMA_ST_AB: /* .IB */ - iomd_writel(idma->cur_sg.dma_address, base + CURA); - iomd_writel(idma->cur_sg.length, base + ENDA); + iomd_writel(idma->cur_addr, base + CURA); + iomd_writel(idma->cur_len, base + ENDA); idma->state = DMA_ST_AB; break; case DMA_ST_OFL | DMA_ST_AB: /* OIB */ case 0: /* .IA */ - iomd_writel(idma->cur_sg.dma_address, base + CURB); - iomd_writel(idma->cur_sg.length, base + ENDB); + iomd_writel(idma->cur_addr, base + CURB); + iomd_writel(idma->cur_len, base + ENDB); idma->state = 0; break; } if (status & DMA_ST_OFL && - idma->cur_sg.length == (DMA_END_S|DMA_END_L)) + idma->cur_len == (DMA_END_S|DMA_END_L)) break; } while (1);