From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org, Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org,
Cyrille Pitchen <cyrille.pitchen@microchip.com>,
Vignesh R <vigneshr@ti.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [RFC PATCH 2/2] mtd: m25p80: Use the SPI mem direct API to possibly improve performances
Date: Thu, 7 Jun 2018 17:08:24 +0200 [thread overview]
Message-ID: <20180607170824.6c32bfc3@xps13> (raw)
In-Reply-To: <20180601143603.4047-3-boris.brezillon@bootlin.com>
Hi Boris,
On Fri, 1 Jun 2018 16:36:03 +0200, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> Make use of the SPI mem direct mapping API.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> drivers/mtd/devices/m25p80.c | 149 ++++++++++++++++++++++++++-----------------
> 1 file changed, 89 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 1dd5f0420b5a..285fc94118ae 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -31,6 +31,10 @@
> struct m25p {
> struct spi_mem *spimem;
> struct spi_nor spi_nor;
> + struct {
> + struct spi_mem_dirmap_desc *write;
> + struct spi_mem_dirmap_desc *read;
> + } dirmap;
> };
While reading this patch I was a bit confused with this naming. You
refer these descriptors as 'flash->dirmap->read/write' which is
confusing as this is not a function but a descriptor. Passing such
variable to a function called spi_meme_dirmap_read/write() is also
confusing IMHO (see below).
Would you mind renaming them with something like "read/write_desc"?
[...]
> @@ -107,39 +81,66 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
> u_char *buf)
> {
> struct m25p *flash = nor->priv;
> - struct spi_mem_op op =
> - SPI_MEM_OP(SPI_MEM_OP_CMD(nor->read_opcode, 1),
> - 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;
> +
> + return spi_mem_dirmap_read(flash->dirmap.read, from, len, buf);
^
The place where I had troubles understanding because of the naming.
Thanks,
Miquèl
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Vignesh R <vigneshr@ti.com>, Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@microchip.com>,
linux-spi@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-mtd@lists.infradead.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [RFC PATCH 2/2] mtd: m25p80: Use the SPI mem direct API to possibly improve performances
Date: Thu, 7 Jun 2018 17:08:24 +0200 [thread overview]
Message-ID: <20180607170824.6c32bfc3@xps13> (raw)
In-Reply-To: <20180601143603.4047-3-boris.brezillon@bootlin.com>
Hi Boris,
On Fri, 1 Jun 2018 16:36:03 +0200, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> Make use of the SPI mem direct mapping API.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> drivers/mtd/devices/m25p80.c | 149 ++++++++++++++++++++++++++-----------------
> 1 file changed, 89 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 1dd5f0420b5a..285fc94118ae 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -31,6 +31,10 @@
> struct m25p {
> struct spi_mem *spimem;
> struct spi_nor spi_nor;
> + struct {
> + struct spi_mem_dirmap_desc *write;
> + struct spi_mem_dirmap_desc *read;
> + } dirmap;
> };
While reading this patch I was a bit confused with this naming. You
refer these descriptors as 'flash->dirmap->read/write' which is
confusing as this is not a function but a descriptor. Passing such
variable to a function called spi_meme_dirmap_read/write() is also
confusing IMHO (see below).
Would you mind renaming them with something like "read/write_desc"?
[...]
> @@ -107,39 +81,66 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
> u_char *buf)
> {
> struct m25p *flash = nor->priv;
> - struct spi_mem_op op =
> - SPI_MEM_OP(SPI_MEM_OP_CMD(nor->read_opcode, 1),
> - 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;
> +
> + return spi_mem_dirmap_read(flash->dirmap.read, from, len, buf);
^
The place where I had troubles understanding because of the naming.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2018-06-07 15:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 14:36 [RFC PATCH 0/2] spi: spi-mem: Add a direct mapping API Boris Brezillon
2018-06-01 14:36 ` Boris Brezillon
2018-06-01 14:36 ` [RFC PATCH 1/2] spi: spi-mem: Add a new API to support direct mapping Boris Brezillon
2018-06-01 14:36 ` Boris Brezillon
2018-06-07 15:01 ` Miquel Raynal
2018-06-07 15:01 ` Miquel Raynal
2018-06-07 15:16 ` Boris Brezillon
2018-06-07 15:16 ` Boris Brezillon
2018-06-01 14:36 ` [RFC PATCH 2/2] mtd: m25p80: Use the SPI mem direct API to possibly improve performances Boris Brezillon
2018-06-01 14:36 ` Boris Brezillon
2018-06-07 15:08 ` Miquel Raynal [this message]
2018-06-07 15:08 ` Miquel Raynal
2018-06-07 15:18 ` Boris Brezillon
2018-06-07 15:18 ` Boris Brezillon
2018-06-07 15:23 ` Miquel Raynal
2018-06-07 15:23 ` Miquel Raynal
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=20180607170824.6c32bfc3@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=boris.brezillon@bootlin.com \
--cc=broonie@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@microchip.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=thomas.petazzoni@bootlin.com \
--cc=vigneshr@ti.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 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.