}
 
 static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
-                       size_t *retlen, const u_char *buf)
+                           const u_char *buf)
 {
        struct m25p *flash = nor->priv;
        struct spi_device *spi = flash->spi;
        ret = m.actual_length - cmd_sz;
        if (ret < 0)
                return -EIO;
-       *retlen += ret;
        return ret;
 }
 
  * may be any size provided it is within the physical boundaries.
  */
 static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
-                       size_t *retlen, u_char *buf)
+                          u_char *buf)
 {
        struct m25p *flash = nor->priv;
        struct spi_device *spi = flash->spi;
                msg.data_nbits = m25p80_rx_nbits(nor);
 
                ret = spi_flash_read(spi, &msg);
-               *retlen = msg.retlen;
                if (ret < 0)
                        return ret;
                return msg.retlen;
        ret = m.actual_length - m25p_cmdsz(nor) - dummy;
        if (ret < 0)
                return -EIO;
-       *retlen += ret;
        return ret;
 }
 
 
 
 static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
                                u8 opcode, unsigned int to, u32 *txbuf,
-                               unsigned count, size_t *retlen)
+                               unsigned count)
 {
        int ret, i, j;
        u32 tmp;
        /* Trigger it */
        ret = fsl_qspi_runcmd(q, opcode, to, count);
 
-       if (ret == 0) {
-               if (retlen)
-                       *retlen += count;
+       if (ret == 0)
                return count;
-       }
 
        return ret;
 }
 
        } else if (len > 0) {
                ret = fsl_qspi_nor_write(q, nor, opcode, 0,
-                                       (u32 *)buf, len, NULL);
+                                       (u32 *)buf, len);
                if (ret > 0)
                        return 0;
        } else {
 }
 
 static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
-               size_t len, size_t *retlen, const u_char *buf)
+                             size_t len, const u_char *buf)
 {
        struct fsl_qspi *q = nor->priv;
-
        ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to,
-                               (u32 *)buf, len, retlen);
+                                        (u32 *)buf, len);
 
        /* invalid the data in the AHB buffer. */
        fsl_qspi_invalid(q);
 }
 
 static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
-               size_t len, size_t *retlen, u_char *buf)
+                            size_t len, u_char *buf)
 {
        struct fsl_qspi *q = nor->priv;
        u8 cmd = nor->read_opcode;
        memcpy(buf, q->ahb_addr + q->chip_base_addr + from - q->memmap_offs,
                len);
 
-       *retlen += len;
        return len;
 }
 
 
 }
 
 static ssize_t mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
-                              size_t *retlen, u_char *buffer)
+                              u_char *buffer)
 {
        int i, ret;
        int addr = (int)from;
        mt8173_nor_set_read_mode(mt8173_nor);
        mt8173_nor_set_addr(mt8173_nor, addr);
 
-       for (i = 0; i < length; i++, (*retlen)++) {
+       for (i = 0; i < length; i++) {
                ret = mt8173_nor_execute_cmd(mt8173_nor, MTK_NOR_PIO_READ_CMD);
                if (ret < 0)
                        return ret;
 }
 
 static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
-                               size_t *retlen, const u_char *buf)
+                               const u_char *buf)
 {
        int ret;
        struct mt8173_nor *mt8173_nor = nor->priv;
                }
                to += SFLASH_WRBUF_SIZE;
                buf += SFLASH_WRBUF_SIZE;
-               (*retlen) += SFLASH_WRBUF_SIZE;
        }
        ret = mt8173_nor_write_buffer_disable(mt8173_nor);
        if (ret < 0) {
                        dev_err(mt8173_nor->dev, "write single byte failed!\n");
                        return ret;
                }
-               (*retlen) += len;
        }
 
        return len;
 
 }
 
 static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
-                             size_t *retlen, u_char *buf)
+                             u_char *buf)
 {
        struct nxp_spifi *spifi = nor->priv;
        int ret;
                return ret;
 
        memcpy_fromio(buf, spifi->flash_base + from, len);
-       *retlen += len;
 
        return len;
 }
 
 static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
-                              size_t *retlen, const u_char *buf)
+                              const u_char *buf)
 {
        struct nxp_spifi *spifi = nor->priv;
        u32 cmd;
                return ret;
 
        writel(to, spifi->io_base + SPIFI_ADDR);
-       *retlen += len;
 
        cmd = SPIFI_CMD_DOUT |
              SPIFI_CMD_DATALEN(len) |
 
        if (ret)
                return ret;
 
-       ret = nor->read(nor, from, len, retlen, buf);
+       ret = nor->read(nor, from, len, buf);
 
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
        if (ret < 0)
                return ret;
 
+       *retlen += ret;
        return 0;
 }
 
                nor->program_opcode = SPINOR_OP_BP;
 
                /* write one byte. */
-               ret = nor->write(nor, to, 1, retlen, buf);
+               ret = nor->write(nor, to, 1, buf);
                if (ret < 0)
                        goto sst_write_err;
                WARN(ret != 1, "While writing 1 byte written %i bytes\n",
                nor->program_opcode = SPINOR_OP_AAI_WP;
 
                /* write two bytes. */
-               ret = nor->write(nor, to, 2, retlen, buf + actual);
+               ret = nor->write(nor, to, 2, buf + actual);
                if (ret < 0)
                        goto sst_write_err;
                WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
                write_enable(nor);
 
                nor->program_opcode = SPINOR_OP_BP;
-               ret = nor->write(nor, to, 1, retlen, buf + actual);
+               ret = nor->write(nor, to, 1, buf + actual);
                if (ret < 0)
                        goto sst_write_err;
                WARN(ret != 1, "While writing 1 byte written %i bytes\n",
                if (ret)
                        goto sst_write_err;
                write_disable(nor);
+               actual += 1;
        }
 sst_write_err:
+       *retlen += actual;
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
        return ret;
 }
 
        /* do all the bytes fit onto one page? */
        if (page_offset + len <= nor->page_size) {
-               ret = nor->write(nor, to, len, retlen, buf);
+               ret = nor->write(nor, to, len, buf);
                if (ret < 0)
                        goto write_err;
+               *retlen += ret;
        } else {
                /* the size of data remaining on the first page */
                page_size = nor->page_size - page_offset;
-               ret = nor->write(nor, to, page_size, retlen, buf);
+               ret = nor->write(nor, to, page_size, buf);
                if (ret < 0)
                        goto write_err;
+               *retlen += ret;
 
                /* write everything in nor->page_size chunks */
                for (i = ret; i < len; ) {
 
                        write_enable(nor);
 
-                       ret = nor->write(nor, to + i, page_size, retlen,
-                                        buf + i);
+                       ret = nor->write(nor, to + i, page_size, buf + i);
                        if (ret < 0)
                                goto write_err;
+                       *retlen += ret;
                        i += ret;
                }
        }
 
        int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
 
        ssize_t (*read)(struct spi_nor *nor, loff_t from,
-                       size_t len, size_t *retlen, u_char *read_buf);
+                       size_t len, u_char *read_buf);
        ssize_t (*write)(struct spi_nor *nor, loff_t to,
-                       size_t len, size_t *retlen, const u_char *write_buf);
+                       size_t len, const u_char *write_buf);
        int (*erase)(struct spi_nor *nor, loff_t offs);
 
        int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);