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: 10807455 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 8365D14E1 for ; Tue, 12 Feb 2019 07:26:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C4A22915C for ; Tue, 12 Feb 2019 07:26:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60EFF2A4EB; Tue, 12 Feb 2019 07:26:45 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 03B5D2915C for ; Tue, 12 Feb 2019 07:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728229AbfBLH0I (ORCPT ); Tue, 12 Feb 2019 02:26:08 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59634 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbfBLH0I (ORCPT ); Tue, 12 Feb 2019 02:26:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=DQRosv6F/JNDXaNNATTNtmbVxExkGx6fJzLxjv+dNf0=; b=RosC/wCxACXyDEaxwovI0VdYkd miNeWvCXMcfPzcKiL8tO2szO4X1y2wZMlg4lmv+NZVsnV/HXtgQRAPo1Pli0LZmJgxSfqLEQ0qnGZ XejjnF/ajHCEPM8l12yyPh9XKk39iflPMSTXY6c3EF47aELrLSqjch0FlVLGLkqQ6x0FtEvhb1aH3 gPTdRBdPSIc6IsTNBvzHS9qNIU3P5JC07ZsQZlWIKjr4iW8+vbuFfi6VqCGRodsjLgY2o+GCgkzuh wErcGJEc8KDqJ7AtHjiMoiJPpMnOGrveP1WC2p32vHBpsoUTADm9gL3PhsXelZH+YDkT1d8rdBuYi 5b4CX4cQ==; 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 Cc: Russell King , Nicolas Pitre , Aaro Koskinen , Ben Dooks , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org 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-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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;