From patchwork Tue Feb 12 07:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10807465 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 C1B8014E1 for ; Tue, 12 Feb 2019 07:26:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC1F92915C for ; Tue, 12 Feb 2019 07:26:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0DBD2A3CA; Tue, 12 Feb 2019 07:26:56 +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=unavailable 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 55DF62915C for ; Tue, 12 Feb 2019 07:26:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725916AbfBLH0t (ORCPT ); Tue, 12 Feb 2019 02:26:49 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58996 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbfBLH0A (ORCPT ); Tue, 12 Feb 2019 02:26:00 -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=ziHP/B7eY+NBjALraVBoRKxJXXxl1F0JJMvkdVloYqE=; b=tCKaoWrDAxPhH0QZm07AWbPc16 aZDS+f9ojEpl58L9vbK2sp0Oj+AlVrW5aFKZqXHKW1dza2OAV1RQoZp3in1/ZxyporPoxC+RUwsn/ funk3sbFKyGL1TEYAh3UN7dkvXSopVS6Bu/gkA2v7PAK7X/2U7DaPZxAJQPNemNLJ2AEwxTxRgCYf X7b1O48YOvffuPuJzck54tvC2xfWimjKoftoKROteUm6+uJjETXJwpOOZkscrDn9LcPr271X2g2Z6 WR7wnxleN5yLwciB0Tg8sX82MluwF5vLEYLuJ56wascFixrjbpVFORLhfePPZwqxp/0/cLMhtoWEQ mYE+Zx5Q==; 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 1gtSRx-0002b4-DI; Tue, 12 Feb 2019 07:25:49 +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 07/14] mmc: omap: handle chained sglists Date: Tue, 12 Feb 2019 08:25:21 +0100 Message-Id: <20190212072528.13167-8-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/omap.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 6741c95f2281..8cd39bc087fa 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c @@ -147,7 +147,7 @@ struct mmc_omap_host { struct mmc_data *stop_data; unsigned int sg_len; - int sg_idx; + struct scatterlist *cur_sg; u32 buffer_offset; u32 buffer_bytes_left; u32 total_bytes_left; @@ -645,11 +645,8 @@ mmc_omap_cmd_timer(struct timer_list *t) static void mmc_omap_sg_to_buf(struct mmc_omap_host *host) { - struct scatterlist *sg; - - sg = host->data->sg + host->sg_idx; - host->buffer_bytes_left = sg->length; - host->buffer_offset = sg->offset; + host->buffer_bytes_left = host->cur_sg->length; + host->buffer_offset = host->cur_sg->offset; if (host->buffer_bytes_left > host->total_bytes_left) host->buffer_bytes_left = host->total_bytes_left; } @@ -666,13 +663,12 @@ mmc_omap_clk_timer(struct timer_list *t) static void mmc_omap_xfer_data(struct mmc_omap_host *host, int write) { - struct scatterlist *sg = host->data->sg + host->sg_idx; + struct scatterlist *sg = host->cur_sg; int n, nwords; void *p; if (host->buffer_bytes_left == 0) { - host->sg_idx++; - BUG_ON(host->sg_idx == host->sg_len); + host->cur_sg = sg_next(host->cur_sg); mmc_omap_sg_to_buf(host); } n = 64; @@ -984,7 +980,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) } } - host->sg_idx = 0; + host->cur_sg = host->data->sg; if (use_dma) { enum dma_data_direction dma_data_dir; struct dma_async_tx_descriptor *tx;