From: Vignesh Raghavendra <vigneshr@ti.com>
To: Andrey Smirnov <andrew.smirnov@gmail.com>,
<linux-mtd@lists.infradead.org>
Cc: Marek Vasut <marek.vasut@gmail.com>,
<linux-kernel@vger.kernel.org>,
Boris Brezillon <boris.brezillon@bootlin.com>,
Brian Norris <computersforpeace@gmail.com>,
Chris Healy <cphealy@gmail.com>
Subject: Re: [PATCH 1/3] mtd: devices: m25p80: Simplify m25p80_read()
Date: Tue, 2 Apr 2019 12:06:36 +0530 [thread overview]
Message-ID: <72cf37d0-e0b8-a02c-1626-46f342cc72bd@ti.com> (raw)
In-Reply-To: <20190401044938.31237-1-andrew.smirnov@gmail.com>
Hi,
On 01/04/19 10:19 AM, Andrey Smirnov wrote:
> Spi_nor_read() already has an appropriate loop around .read() callback
> to handle the case when not all of the data requested was written in a
> signle ->read() call. Drop extra code doing the same thing in
> m25p80_read().
>
Thanks for the patch series! But we are in the process of completely
moving m25p80.c into spi-nor.c which should take care of this series.
See[1][2], I plan to post the next version shortly. Let me know if
something is missing.
[1] https://patchwork.ozlabs.org/patch/982925/
[2] https://patchwork.ozlabs.org/patch/982922/
Regards
Vignesh
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: linux-mtd@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/mtd/devices/m25p80.c | 22 +++++++---------------
> 1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 651bab6d4e31..114f8ccea85b 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -125,7 +125,6 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
> SPI_MEM_OP_ADDR(nor->addr_width, from, 1),
> SPI_MEM_OP_DUMMY(nor->read_dummy, 1),
> SPI_MEM_OP_DATA_IN(len, buf, 1));
> - size_t remaining = len;
> int ret;
>
> /* get transfer protocols. */
> @@ -137,22 +136,15 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
> /* convert the dummy cycles to the number of bytes */
> op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8;
>
> - while (remaining) {
> - op.data.nbytes = remaining < UINT_MAX ? remaining : UINT_MAX;
> - ret = spi_mem_adjust_op_size(flash->spimem, &op);
> - if (ret)
> - return ret;
> -
> - ret = spi_mem_exec_op(flash->spimem, &op);
> - if (ret)
> - return ret;
> + ret = spi_mem_adjust_op_size(flash->spimem, &op);
> + if (ret)
> + return ret;
>
> - op.addr.val += op.data.nbytes;
> - remaining -= op.data.nbytes;
> - op.data.buf.in += op.data.nbytes;
> - }
> + ret = spi_mem_exec_op(flash->spimem, &op);
> + if (ret)
> + return ret;
>
> - return len;
> + return op.data.nbytes;
> }
>
> /*
>
--
Regards
Vignesh
prev parent reply other threads:[~2019-04-02 6:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 4:49 Andrey Smirnov
2019-04-01 4:49 ` [PATCH 2/3] mtd: devices: m25p80: Drop extra length clamping in m25p80_write() Andrey Smirnov
2019-04-01 4:49 ` [PATCH 3/3] mtd: devices: m25p80: Share code between m25p80_read() and m25p80_write() Andrey Smirnov
2019-04-02 6:36 ` Vignesh Raghavendra [this message]
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=72cf37d0-e0b8-a02c-1626-46f342cc72bd@ti.com \
--to=vigneshr@ti.com \
--cc=andrew.smirnov@gmail.com \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=cphealy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®