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:
@@ -29,7 +29,7 @@ static ulong vexpress_osc_clk_get_rate(struct clk *clk)
|
||||
|
||||
data = CLK_FUNCTION | priv->osc;
|
||||
err = misc_read(vexpress_cfg, 0, &data, sizeof(data));
|
||||
if (err)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return data;
|
||||
@@ -53,7 +53,7 @@ static ulong vexpress_osc_clk_set_rate(struct clk *clk, ulong rate)
|
||||
buffer[0] = CLK_FUNCTION | priv->osc;
|
||||
buffer[1] = rate;
|
||||
err = misc_write(vexpress_cfg, 0, buffer, 2 * sizeof(u32));
|
||||
if (err)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return rate;
|
||||
|
||||
Reference in New Issue
Block a user