diff options
author | Michal Suchanek <hramrach@gmail.com> | 2016-05-05 17:31:47 -0700 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2016-06-01 17:22:28 -0700 |
commit | 59451e1233bd315c5379a631838a03d80e689581 (patch) | |
tree | de1e470748fc0889960466435abb6f672d311ca1 /drivers/mtd/spi-nor/nxp-spifi.c | |
parent | becc7ae544c61395b5eba7b9913e14aa567ca07a (diff) | |
download | linux-59451e1233bd315c5379a631838a03d80e689581.tar.bz2 |
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/nxp-spifi.c')
-rw-r--r-- | drivers/mtd/spi-nor/nxp-spifi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c index ae428cb0e04b..187adba5e69f 100644 --- a/drivers/mtd/spi-nor/nxp-spifi.c +++ b/drivers/mtd/spi-nor/nxp-spifi.c @@ -172,8 +172,8 @@ static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) return nxp_spifi_wait_for_cmd(spifi); } -static int nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, - size_t *retlen, u_char *buf) +static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, + size_t *retlen, u_char *buf) { struct nxp_spifi *spifi = nor->priv; int ret; @@ -188,8 +188,8 @@ static int nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, return 0; } -static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, - size_t *retlen, const u_char *buf) +static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, + size_t *retlen, const u_char *buf) { struct nxp_spifi *spifi = nor->priv; u32 cmd; @@ -197,7 +197,7 @@ static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, ret = nxp_spifi_set_memory_mode_off(spifi); if (ret) - return; + return ret; writel(to, spifi->io_base + SPIFI_ADDR); *retlen += len; @@ -212,7 +212,7 @@ static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, while (len--) writeb(*buf++, spifi->io_base + SPIFI_DATA); - nxp_spifi_wait_for_cmd(spifi); + return nxp_spifi_wait_for_cmd(spifi); } static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs) |