From 8729b1ae2cbda83059a55811614a2b0dbfdf7e53 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 6 Nov 2018 15:21:39 -0700 Subject: 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 Reviewed-by: Patrick Delaunay --- test/dm/misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/dm') diff --git a/test/dm/misc.c b/test/dm/misc.c index 61279665ef2..4d4232adf1e 100644 --- a/test/dm/misc.c +++ b/test/dm/misc.c @@ -21,9 +21,9 @@ static int dm_test_misc(struct unit_test_state *uts) ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "misc-test", &dev)); /* Read / write tests */ - ut_assertok(misc_write(dev, 0, "TEST", 4)); - ut_assertok(misc_write(dev, 4, "WRITE", 5)); - ut_assertok(misc_read(dev, 0, buf, 9)); + ut_asserteq(4, misc_write(dev, 0, "TEST", 4)); + ut_asserteq(5, misc_write(dev, 4, "WRITE", 5)); + ut_asserteq(9, misc_read(dev, 0, buf, 9)); ut_assertok(memcmp(buf, "TESTWRITE", 9)); -- cgit v1.2.3