1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

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>
This commit is contained in:
Simon Glass
2018-11-06 15:21:39 -07:00
parent 96794a3eae
commit 8729b1ae2c
8 changed files with 27 additions and 15 deletions

View File

@@ -13,7 +13,7 @@
* @buf: pointer to data buffer
* @size: data size in bytes to read the device
*
* Return: 0 if OK, -ve on error
* Return: number of bytes read if OK (may be 0 if EOF), -ve on error
*/
int misc_read(struct udevice *dev, int offset, void *buf, int size);
@@ -24,7 +24,7 @@ int misc_read(struct udevice *dev, int offset, void *buf, int size);
* @buf: pointer to data buffer
* @size: data size in bytes to write the device
*
* Return: 0 if OK, -ve on error
* Return: number of bytes written if OK (may be < @size), -ve on error
*/
int misc_write(struct udevice *dev, int offset, void *buf, int size);
@@ -90,7 +90,7 @@ struct misc_ops {
* @buf: pointer to data buffer
* @size: data size in bytes to read the device
*
* Return: 0 if OK, -ve on error
* Return: number of bytes read if OK (may be 0 if EOF), -ve on error
*/
int (*read)(struct udevice *dev, int offset, void *buf, int size);
@@ -101,7 +101,7 @@ struct misc_ops {
* @buf: pointer to data buffer
* @size: data size in bytes to write the device
*
* Return: 0 if OK, -ve on error
* Return: number of bytes written if OK (may be < @size), -ve on error
*/
int (*write)(struct udevice *dev, int offset, const void *buf,
int size);