summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor/fsl-quadspi.c
diff options
context:
space:
mode:
authorMichal Suchanek2016-05-06 02:31:47 +0200
committerBrian Norris2016-06-02 02:22:28 +0200
commit59451e1233bd315c5379a631838a03d80e689581 (patch)
treede1e470748fc0889960466435abb6f672d311ca1 /drivers/mtd/spi-nor/fsl-quadspi.c
parentMAINTAINERS: Add file patterns for mtd device tree bindings (diff)
downloadkernel-qcow2-linux-59451e1233bd315c5379a631838a03d80e689581.tar.gz
kernel-qcow2-linux-59451e1233bd315c5379a631838a03d80e689581.tar.xz
kernel-qcow2-linux-59451e1233bd315c5379a631838a03d80e689581.zip
mtd: spi-nor: change return value of read/write
Change the return value of spi-nor device read and write methods to allow returning amount of data transferred and errors as read(2)/write(2) does. Also, start handling positive returns in spi_nor_read(), since we want to convert drivers to start returning the read-length both via *retlen and the return code. (We don't need to do the same transition process for spi_nor_write(), since ->write() didn't used to have a return code at all.) Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Michal Suchanek <hramrach@gmail.com> Tested-by: Michal Suchanek <hramrach@gmail.com>
Diffstat (limited to 'drivers/mtd/spi-nor/fsl-quadspi.c')
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 9ab2b51d54b8..74dc155e1b3b 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -868,7 +868,7 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
return ret;
}
-static void fsl_qspi_write(struct spi_nor *nor, loff_t to,
+static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
size_t len, size_t *retlen, const u_char *buf)
{
struct fsl_qspi *q = nor->priv;
@@ -878,9 +878,10 @@ static void fsl_qspi_write(struct spi_nor *nor, loff_t to,
/* invalid the data in the AHB buffer. */
fsl_qspi_invalid(q);
+ return 0;
}
-static int fsl_qspi_read(struct spi_nor *nor, loff_t from,
+static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
size_t len, size_t *retlen, u_char *buf)
{
struct fsl_qspi *q = nor->priv;