From patchwork Tue Feb 12 07:25:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10807491 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 7550114E1 for ; Tue, 12 Feb 2019 07:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 599BC2A69E for ; Tue, 12 Feb 2019 07:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35EFA2A6AB; Tue, 12 Feb 2019 07:28:06 +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=unavailable 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 BF0712A69E for ; Tue, 12 Feb 2019 07:28:05 +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: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=21uxw8wzoS0IpgwF/L2aD2cCRN2EJ7zj9wcQMZ8yRGA=; b=nFIRdZx9LUQu4D P41ES5+irSREvDjO3p2niCYJgNUfCpR7v9rD+TwIRTxEcNtuaHLhm1+O6371zWgCn6r2p/H3pDmLh CEp5tb+aJ0kHz5dE9uSWRI08U1FzKoGdQD6QzHAQc5yRJ77HiFy0lhqJnE4I71j4bxJYf3qVPYDda q7Q2lwOK95q3gEMz9S+ionZk3oZiHGa4gNwXpt9VJPVFOcKluqog5dmbIKENlX5pMDvpd24fPYPcS khm/cqXnqt+xMzyyxjhuuql0pPwqdVKVYxpgX13THhisEJ529qK+585bpdZmUmcFru2Mc4QPvccfr cUiaDWcyBk1lhdz9R9Qw==; 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 1gtSU5-0004qa-2g; Tue, 12 Feb 2019 07:28:01 +0000 Received: from 089144210182.atnat0019.highway.a1.net ([89.144.210.182] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSS3-0002iH-Gu; Tue, 12 Feb 2019 07:25:55 +0000 From: Christoph Hellwig To: Ulf Hansson Subject: [PATCH 09/14] mmc: s3cmci: handle chained sglists Date: Tue, 12 Feb 2019 08:25:23 +0100 Message-Id: <20190212072528.13167-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212072528.13167-1-hch@lst.de> References: <20190212072528.13167-1-hch@lst.de> MIME-Version: 1.0 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: , Cc: Aaro Koskinen , Nicolas Pitre , linux-mmc@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Ben Dooks , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/s3cmci.c | 19 +++++++++---------- drivers/mmc/host/s3cmci.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 989fefea19f1..df7c27f78abf 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c @@ -319,20 +319,19 @@ static void s3cmci_check_sdio_irq(struct s3cmci_host *host) static inline int get_data_buffer(struct s3cmci_host *host) { - if (host->pio_sgptr >= host->mrq->data->sg_len) { - dbg(host, dbg_debug, "no more buffers (%i/%i)\n", - host->pio_sgptr, host->mrq->data->sg_len); + if (!host->next_sg) { + dbg(host, dbg_debug, "no more buffers (%i)\n", + host->mrq->data->sg_len); return -EBUSY; } - host->cur_sg = &host->mrq->data->sg[host->pio_sgptr]; + host->cur_sg = host->next_sg; + host->next_sg = sg_next(host->next_sg); host->pio_bytes = host->cur_sg->length; host->pio_offset = host->cur_sg->offset; - host->pio_sgptr++; - - dbg(host, dbg_sg, "new buffer (%i/%i)\n", - host->pio_sgptr, host->mrq->data->sg_len); + dbg(host, dbg_sg, "new buffer (%i)\n", + host->mrq->data->sg_len); return 0; } @@ -1051,8 +1050,8 @@ static int s3cmci_prepare_pio(struct s3cmci_host *host, struct mmc_data *data) BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR); - host->pio_sgptr = 0; - host->cur_sg = &host->mrq->data->sg[host->pio_sgptr]; + host->cur_sg = host->mrq->data->sg; + host->next_sg = sg_next(host->cur_sg); host->pio_bytes = 0; host->pio_count = 0; host->pio_active = rw ? XFER_WRITE : XFER_READ; diff --git a/drivers/mmc/host/s3cmci.h b/drivers/mmc/host/s3cmci.h index 4320f7d832dc..caf1078d07d1 100644 --- a/drivers/mmc/host/s3cmci.h +++ b/drivers/mmc/host/s3cmci.h @@ -51,7 +51,7 @@ struct s3cmci_host { int dma_complete; struct scatterlist *cur_sg; - u32 pio_sgptr; + struct scatterlist *next_sg; u32 pio_bytes; u32 pio_count; u32 pio_offset;