Re: [RFC PATCH 2/2] mtd: m25p80: Use the SPI mem direct API to possibly improve performances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Boris,

On Fri,  1 Jun 2018 16:36:03 +0200, Boris Brezillon
<boris.brezillon@xxxxxxxxxxx> wrote:

> Make use of the SPI mem direct mapping API.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux