Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3386927imu; Mon, 14 Jan 2019 02:00:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN7h+a/a92ZJ9WWlIrYiJ7K6vEbyObwKOOy8o3v+ynvxgjFeG9aQISHWRSUkFtDv4VnaE1LP X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr24043237plh.99.1547460047650; Mon, 14 Jan 2019 02:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547460047; cv=none; d=google.com; s=arc-20160816; b=QoirbqxWp1FG6+zluUxmRa5sN2MQcRonKRwyRSjA/tsPkwx9kuroX8BWWpYtmd4Y7n 1dIYpdi5dUtzQuFDKmR17A1UcazhWJymkHVqxY8ZBTzlKEuFDWfJqJ5bs0HlGIcc5QZs 0Ki4RJKVhTmlMZOPij2Aa1cvGQHEQCZWT1jGbmZv5K5h7n3GEHL9FcgqbJFniRvl8TH1 814rrH4TofI8hjWYOkHM0cPcFG4QgB/HJh+TwukRfwJUoDJSYzuxhcgzZZfbW6TfLFEi Fne0E2nqchjFWpsfhT6PTNj3PKuayeUMma0TKhCujxAr960dItbuxzAtRE8UwZr94x4Z l+OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OJytBFiMFV7AJYQkXOx0ilRvBkQf1Wlcn0Y5tk8Zi5s=; b=V/h0zFSc6wELFr8zC8Vr3UQcyBaS09utrkx6PZnjV4kAlSL/j7z2GUhoCZg04rtmUk ph7OAar2BK3TmQGeyOYCYr6r5PIkjW5nsiGAfuYKgqxd4/mc4WQA3Fms6/FSB8zxo+Sm 1ghxwRR5nEIuq3kgsCIuT9xmdvjrYiqZNvmtNvcoQzed3iP3Io27UbCHbg677iJS/h8y LiKmgnxHCikE/+SDShbCRSFGWkExoY2LgWfrMT9ee+RZ+UZmr7V26e9rIiTBZ7fBr86n 0G6kZnatJYZ3l21pJ7n6F/GghDQvGwOcRcfXE3YYg8/7F/He/Wa6T3kshIwPmBCEeprA /2zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lJiWOH+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37si18366265plb.140.2019.01.14.02.00.32; Mon, 14 Jan 2019 02:00:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lJiWOH+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbfANJ62 (ORCPT + 99 others); Mon, 14 Jan 2019 04:58:28 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58390 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbfANJ60 (ORCPT ); Mon, 14 Jan 2019 04:58:26 -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=OJytBFiMFV7AJYQkXOx0ilRvBkQf1Wlcn0Y5tk8Zi5s=; b=lJiWOH+0I1p3CnkZREUHJdGp2w 5Wop3vXBMkCICUUVPd4nIax85kVaYWHKVxPNMg1MPRTDo7ft3mZ4PAs7gruw8J4f6FJSP7GPMnBt6 RS1NweP8DchGW6RP9fV02BtHu3sk/aIH77XAbdXjxKiJgbi5kY+t4HLDuZq6iKhqngahSxetYi6o1 kTydsvq8bG7PO8oEfELl+voJoPJId1aP7xAw6kmQAT2CJ2xoctZFKFvHbALQ/HpZF77kbBVbLJiXz mzpXg8KWndNsclDN++ytzNhC8ztZ5SrMRhBU8PFDpD8DXUQehjsORPqHN7/5Ht/WBs7LE9l/5UwrX xYTvL21A==; Received: from 089144213167.atnat0022.highway.a1.net ([89.144.213.167] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1giz0d-0001xy-DN; Mon, 14 Jan 2019 09:58:20 +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 04/11] mmc: omap: handle chained sglists Date: Mon, 14 Jan 2019 10:57:57 +0100 Message-Id: <20190114095804.27978-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114095804.27978-1-hch@lst.de> References: <20190114095804.27978-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 0377ac6194a0..248707aba2df 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c @@ -148,7 +148,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; @@ -646,11 +646,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; } @@ -667,13 +664,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; @@ -985,7 +981,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; -- 2.20.1