misc: Update read() and write() methods to return bytes xfered
At present these functions return 0 on success. For some devices we want
to know how many bytes were transferred. It seems useful to adjust the API
to be more like the POSIX read() and write() functions.
Update these two methods, a test and all users.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
diff --git a/drivers/misc/misc_sandbox.c b/drivers/misc/misc_sandbox.c
index e4164f7..f7c5b2e 100644
--- a/drivers/misc/misc_sandbox.c
+++ b/drivers/misc/misc_sandbox.c
@@ -20,7 +20,7 @@
memcpy(buf, priv->mem + offset, size);
- return 0;
+ return size;
}
int misc_sandbox_write(struct udevice *dev, int offset, const void *buf,
@@ -30,7 +30,7 @@
memcpy(priv->mem + offset, buf, size);
- return 0;
+ return size;
}
int misc_sandbox_ioctl(struct udevice *dev, unsigned long request, void *buf)