All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Nicolas Pitre <nico@fluxnic.net>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Ben Dooks <ben-linux@fluff.org>,
	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 12/14] mmc: sh_mmcif: handle chained sglists
Date: Tue, 12 Feb 2019 08:25:26 +0100	[thread overview]
Message-ID: <20190212072528.13167-13-hch@lst.de> (raw)
In-Reply-To: <20190212072528.13167-1-hch@lst.de>

Use the proper sg_next() helper to move to the next scatterlist element
to support chained scatterlists.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mmc/host/sh_mmcif.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 24c3f13bafdb..9e59dbe6ef30 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -234,7 +234,6 @@ struct sh_mmcif_host {
 	enum sh_mmcif_wait_for wait_for;
 	struct delayed_work timeout_work;
 	size_t blocksize;
-	int sg_idx;
 	int sg_blkidx;
 	bool power;
 	bool ccs_enable;		/* Command Completion Signal support */
@@ -606,13 +605,13 @@ static bool sh_mmcif_next_block(struct sh_mmcif_host *host)
 
 	if (host->sg_blkidx == data->sg->length) {
 		host->sg_blkidx = 0;
-		if (++host->sg_idx < data->sg_len) {
-			data->sg++;
-			host->pio_offset = data->sg->offset / 4;
-		}
+		data->sg = sg_next(data->sg);
+		if (!data->sg)
+			return false;
+		host->pio_offset = data->sg->offset / 4;
 	}
 
-	return host->sg_idx != data->sg_len;
+	return true;
 }
 
 static void sh_mmcif_single_read(struct sh_mmcif_host *host,
@@ -665,7 +664,6 @@ static void sh_mmcif_multi_read(struct sh_mmcif_host *host,
 		BLOCK_SIZE_MASK;
 
 	host->wait_for = MMCIF_WAIT_FOR_MREAD;
-	host->sg_idx = 0;
 	host->sg_blkidx = 0;
 	host->pio_offset = data->sg->offset / 4;
 
@@ -752,7 +750,6 @@ static void sh_mmcif_multi_write(struct sh_mmcif_host *host,
 		BLOCK_SIZE_MASK;
 
 	host->wait_for = MMCIF_WAIT_FOR_MWRITE;
-	host->sg_idx = 0;
 	host->sg_blkidx = 0;
 	host->pio_offset = data->sg->offset / 4;
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
	Nicolas Pitre <nico@fluxnic.net>,
	linux-mmc@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	Ben Dooks <ben-linux@fluff.org>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 12/14] mmc: sh_mmcif: handle chained sglists
Date: Tue, 12 Feb 2019 08:25:26 +0100	[thread overview]
Message-ID: <20190212072528.13167-13-hch@lst.de> (raw)
In-Reply-To: <20190212072528.13167-1-hch@lst.de>

Use the proper sg_next() helper to move to the next scatterlist element
to support chained scatterlists.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mmc/host/sh_mmcif.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 24c3f13bafdb..9e59dbe6ef30 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -234,7 +234,6 @@ struct sh_mmcif_host {
 	enum sh_mmcif_wait_for wait_for;
 	struct delayed_work timeout_work;
 	size_t blocksize;
-	int sg_idx;
 	int sg_blkidx;
 	bool power;
 	bool ccs_enable;		/* Command Completion Signal support */
@@ -606,13 +605,13 @@ static bool sh_mmcif_next_block(struct sh_mmcif_host *host)
 
 	if (host->sg_blkidx == data->sg->length) {
 		host->sg_blkidx = 0;
-		if (++host->sg_idx < data->sg_len) {
-			data->sg++;
-			host->pio_offset = data->sg->offset / 4;
-		}
+		data->sg = sg_next(data->sg);
+		if (!data->sg)
+			return false;
+		host->pio_offset = data->sg->offset / 4;
 	}
 
-	return host->sg_idx != data->sg_len;
+	return true;
 }
 
 static void sh_mmcif_single_read(struct sh_mmcif_host *host,
@@ -665,7 +664,6 @@ static void sh_mmcif_multi_read(struct sh_mmcif_host *host,
 		BLOCK_SIZE_MASK;
 
 	host->wait_for = MMCIF_WAIT_FOR_MREAD;
-	host->sg_idx = 0;
 	host->sg_blkidx = 0;
 	host->pio_offset = data->sg->offset / 4;
 
@@ -752,7 +750,6 @@ static void sh_mmcif_multi_write(struct sh_mmcif_host *host,
 		BLOCK_SIZE_MASK;
 
 	host->wait_for = MMCIF_WAIT_FOR_MWRITE;
-	host->sg_idx = 0;
 	host->sg_blkidx = 0;
 	host->pio_offset = data->sg->offset / 4;
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-02-12  7:26 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12  7:25 remove block layer bounce buffering for MMC v2 Christoph Hellwig
2019-02-12  7:25 ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 01/14] scatterlist: add sg_kmap_atomic / sg_kunmap_atomic helpers Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 02/14] mmc: remove the unused use_blk_mq field from struct mmc_host Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 03/14] mmc: add a need_kmap flag to " Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 04/14] mmc: davinci: handle highmem pages Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 05/14] mmc: moxart: " Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 06/14] mmc: omap: " Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12 18:39   ` Tony Lindgren
2019-02-12 18:39     ` Tony Lindgren
2019-02-12  7:25 ` [PATCH 07/14] mmc: omap: handle chained sglists Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 08/14] mmc: s3cmci: handle highmem pages Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 09/14] mmc: s3cmci: handle chained sglists Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 10/14] mmc: mvsdio: handle highmem pages Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 11/14] mmc: sh_mmcif: " Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` Christoph Hellwig [this message]
2019-02-12  7:25   ` [PATCH 12/14] mmc: sh_mmcif: handle chained sglists Christoph Hellwig
2019-02-12  7:25 ` [PATCH 13/14] mmc: core: don't use block layer bounce buffers Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-12  7:25 ` [PATCH 14/14] dma-mapping: remove dma_max_pfn Christoph Hellwig
2019-02-12  7:25   ` Christoph Hellwig
2019-02-25 13:54 ` remove block layer bounce buffering for MMC v2 Ulf Hansson
2019-02-25 13:54   ` Ulf Hansson
2019-03-08  9:18   ` Christoph Hellwig
2019-03-08  9:18     ` Christoph Hellwig
2019-03-08  9:18     ` Christoph Hellwig
2019-03-08  9:43     ` Ulf Hansson
2019-03-08  9:43       ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190212072528.13167-13-hch@lst.de \
    --to=hch@lst.de \
    --cc=aaro.koskinen@iki.fi \
    --cc=ben-linux@fluff.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nico@fluxnic.net \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.