[2/2] mtd: m25p80: Use SPI_MEM_OP_NO_DUMMY instead of SPI_MEM_OP_DUMMY(0, x)

Message ID 20180601100325.11165-2-boris.brezillon@bootlin.com
State New
Delegated to: Boris Brezillon
Headers show
Series
  • [1/2] mtd: m25p80: Remove unneeded m25p->command field
Related show

Commit Message

Boris Brezillon June 1, 2018, 10:03 a.m.
SPI_MEM_OP_DUMMY(0, x) means there's 0 dummy bytes to send, which is
similar to SPI_MEM_OP_NO_DUMMY except it's less clear. Use
SPI_MEM_OP_NO_DUMMY instead of SPI_MEM_OP_DUMMY(0, x) in
m25p80_write().
Also stop updating op.dummy.buswidth since this value is only
meaningful if you have dummy bytes.

Reported-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 drivers/mtd/devices/m25p80.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Marek Vasut June 18, 2018, 9:41 a.m. | #1
On 06/01/2018 12:03 PM, Boris Brezillon wrote:
> SPI_MEM_OP_DUMMY(0, x) means there's 0 dummy bytes to send, which is
> similar to SPI_MEM_OP_NO_DUMMY except it's less clear. Use
> SPI_MEM_OP_NO_DUMMY instead of SPI_MEM_OP_DUMMY(0, x) in
> m25p80_write().
> Also stop updating op.dummy.buswidth since this value is only
> meaningful if you have dummy bytes.
> 
> Reported-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Acked-by: Marek Vasut <marek.vasut@gmail.com>

> ---
>  drivers/mtd/devices/m25p80.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 73dd74330227..1dd5f0420b5a 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -68,7 +68,7 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
>  	struct spi_mem_op op =
>  			SPI_MEM_OP(SPI_MEM_OP_CMD(nor->program_opcode, 1),
>  				   SPI_MEM_OP_ADDR(nor->addr_width, to, 1),
> -				   SPI_MEM_OP_DUMMY(0, 1),
> +				   SPI_MEM_OP_NO_DUMMY,
>  				   SPI_MEM_OP_DATA_OUT(len, buf, 1));
>  	size_t remaining = len;
>  	int ret;
> @@ -76,7 +76,6 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
>  	/* get transfer protocols. */
>  	op.cmd.buswidth = spi_nor_get_protocol_inst_nbits(nor->write_proto);
>  	op.addr.buswidth = spi_nor_get_protocol_addr_nbits(nor->write_proto);
> -	op.dummy.buswidth = op.addr.buswidth;
>  	op.data.buswidth = spi_nor_get_protocol_data_nbits(nor->write_proto);
>  
>  	if (nor->program_opcode == SPINOR_OP_AAI_WP && nor->sst_write_second)
>

Patch

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 73dd74330227..1dd5f0420b5a 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -68,7 +68,7 @@  static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	struct spi_mem_op op =
 			SPI_MEM_OP(SPI_MEM_OP_CMD(nor->program_opcode, 1),
 				   SPI_MEM_OP_ADDR(nor->addr_width, to, 1),
-				   SPI_MEM_OP_DUMMY(0, 1),
+				   SPI_MEM_OP_NO_DUMMY,
 				   SPI_MEM_OP_DATA_OUT(len, buf, 1));
 	size_t remaining = len;
 	int ret;
@@ -76,7 +76,6 @@  static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	/* get transfer protocols. */
 	op.cmd.buswidth = spi_nor_get_protocol_inst_nbits(nor->write_proto);
 	op.addr.buswidth = spi_nor_get_protocol_addr_nbits(nor->write_proto);
-	op.dummy.buswidth = op.addr.buswidth;
 	op.data.buswidth = spi_nor_get_protocol_data_nbits(nor->write_proto);
 
 	if (nor->program_opcode == SPINOR_OP_AAI_WP && nor->sst_write_second)