1 From a99477d72b500b48cb3614aad0ce096fe4e3f437 Mon Sep 17 00:00:00 2001
2 From: Michal Suchanek <hramrach@gmail.com>
3 Date: Wed, 2 Dec 2015 10:38:20 +0000
4 Subject: [PATCH 094/113] mtd: spi-nor: stop passing around retlen
7 not apply changes of drivers/mtd/devices/m25p80.c
9 @@ -74,7 +74,7 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
12 static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
13 - size_t *retlen, const u_char *buf)
16 struct m25p *flash = nor->priv;
17 struct spi_device *spi = flash->spi;
18 @@ -106,7 +106,6 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
19 ret = m.actual_length - cmd_sz;
26 @@ -127,7 +126,7 @@ static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
27 * may be any size provided it is within the physical boundaries.
29 static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
30 - size_t *retlen, u_char *buf)
33 struct m25p *flash = nor->priv;
34 struct spi_device *spi = flash->spi;
35 @@ -161,7 +160,6 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
36 ret = m.actual_length - m25p_cmdsz(nor) - dummy;
45 Do not pass retlen to hardware driver read/write functions. Update it in
46 spi-nor generic driver instead.
48 Signed-off-by: Michal Suchanek <hramrach@gmail.com>
49 Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
50 Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
52 drivers/mtd/spi-nor/fsl-quadspi.c | 16 ++++++----------
53 drivers/mtd/spi-nor/spi-nor.c | 21 +++++++++++++--------
54 include/linux/mtd/spi-nor.h | 4 ++--
55 3 files changed, 21 insertions(+), 20 deletions(-)
57 --- a/drivers/mtd/spi-nor/fsl-quadspi.c
58 +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
59 @@ -620,7 +620,7 @@ static inline void fsl_qspi_invalid(stru
61 static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
62 u8 opcode, unsigned int to, u32 *txbuf,
63 - unsigned count, size_t *retlen)
68 @@ -647,11 +647,8 @@ static ssize_t fsl_qspi_nor_write(struct
70 ret = fsl_qspi_runcmd(q, opcode, to, count);
81 @@ -862,7 +859,7 @@ static int fsl_qspi_write_reg(struct spi
84 ret = fsl_qspi_nor_write(q, nor, opcode, 0,
85 - (u32 *)buf, len, NULL);
90 @@ -874,12 +871,11 @@ static int fsl_qspi_write_reg(struct spi
93 static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
94 - size_t len, size_t *retlen, const u_char *buf)
95 + size_t len, const u_char *buf)
97 struct fsl_qspi *q = nor->priv;
99 ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to,
100 - (u32 *)buf, len, retlen);
103 /* invalid the data in the AHB buffer. */
105 @@ -887,7 +883,7 @@ static ssize_t fsl_qspi_write(struct spi
108 static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
109 - size_t len, size_t *retlen, u_char *buf)
110 + size_t len, u_char *buf)
112 struct fsl_qspi *q = nor->priv;
113 u8 cmd = nor->read_opcode;
114 --- a/drivers/mtd/spi-nor/spi-nor.c
115 +++ b/drivers/mtd/spi-nor/spi-nor.c
116 @@ -920,12 +920,13 @@ static int spi_nor_read(struct mtd_info
120 - ret = nor->read(nor, from, len, retlen, buf);
121 + ret = nor->read(nor, from, len, buf);
123 spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
131 @@ -952,7 +953,7 @@ static int sst_write(struct mtd_info *mt
132 nor->program_opcode = SPINOR_OP_BP;
134 /* write one byte. */
135 - ret = nor->write(nor, to, 1, retlen, buf);
136 + ret = nor->write(nor, to, 1, buf);
139 WARN(ret != 1, "While writing 1 byte written %i bytes\n",
140 @@ -968,7 +969,7 @@ static int sst_write(struct mtd_info *mt
141 nor->program_opcode = SPINOR_OP_AAI_WP;
143 /* write two bytes. */
144 - ret = nor->write(nor, to, 2, retlen, buf + actual);
145 + ret = nor->write(nor, to, 2, buf + actual);
148 WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
149 @@ -991,7 +992,7 @@ static int sst_write(struct mtd_info *mt
152 nor->program_opcode = SPINOR_OP_BP;
153 - ret = nor->write(nor, to, 1, retlen, buf + actual);
154 + ret = nor->write(nor, to, 1, buf + actual);
157 WARN(ret != 1, "While writing 1 byte written %i bytes\n",
158 @@ -1000,8 +1001,10 @@ static int sst_write(struct mtd_info *mt
166 spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
169 @@ -1030,15 +1033,17 @@ static int spi_nor_write(struct mtd_info
171 /* do all the bytes fit onto one page? */
172 if (page_offset + len <= nor->page_size) {
173 - ret = nor->write(nor, to, len, retlen, buf);
174 + ret = nor->write(nor, to, len, buf);
179 /* the size of data remaining on the first page */
180 page_size = nor->page_size - page_offset;
181 - ret = nor->write(nor, to, page_size, retlen, buf);
182 + ret = nor->write(nor, to, page_size, buf);
187 /* write everything in nor->page_size chunks */
188 for (i = ret; i < len; ) {
189 @@ -1052,10 +1057,10 @@ static int spi_nor_write(struct mtd_info
193 - ret = nor->write(nor, to + i, page_size, retlen,
195 + ret = nor->write(nor, to + i, page_size, buf + i);
202 --- a/include/linux/mtd/spi-nor.h
203 +++ b/include/linux/mtd/spi-nor.h
204 @@ -171,9 +171,9 @@ struct spi_nor {
205 int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
207 ssize_t (*read)(struct spi_nor *nor, loff_t from,
208 - size_t len, size_t *retlen, u_char *read_buf);
209 + size_t len, u_char *read_buf);
210 ssize_t (*write)(struct spi_nor *nor, loff_t to,
211 - size_t len, size_t *retlen, const u_char *write_buf);
212 + size_t len, const u_char *write_buf);
213 int (*erase)(struct spi_nor *nor, loff_t offs);
215 int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);