@@ -301,7 +301,7 @@ int tb_switch_nvm_read(struct tb_switch *sw, unsigned int address, void *buf,
return dma_port_flash_read(sw->dma_port, address, buf, size);
}
-static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes)
+static ssize_t nvm_read(void *priv, unsigned int offset, void *val, size_t bytes)
{
struct tb_nvm *nvm = priv;
struct tb_switch *sw = tb_to_switch(nvm->dev);
@@ -321,10 +321,10 @@ static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes)
pm_runtime_mark_last_busy(&sw->dev);
pm_runtime_put_autosuspend(&sw->dev);
- return ret;
+ return ret < 0 ? ret : bytes;
}
-static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes)
+static ssize_t nvm_write(void *priv, unsigned int offset, void *val, size_t bytes)
{
struct tb_nvm *nvm = priv;
struct tb_switch *sw = tb_to_switch(nvm->dev);
@@ -342,7 +342,7 @@ static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes)
ret = tb_nvm_write_buf(nvm, offset, val, bytes);
mutex_unlock(&sw->tb->lock);
- return ret;
+ return ret < 0 ? ret : bytes;
}
static int tb_switch_nvm_add(struct tb_switch *sw)
Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty <joychakr@google.com> --- drivers/thunderbolt/switch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)