Message ID | 20190925145750.200592-12-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 4805a7af8ebd4c604e1e32355927ec5035685121 |
Delegated to: | Bin Meng |
Headers | show |
Series | x86: Add initial support for apollolake | expand |
On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote: > > This function returns -ENODEV when there is no device. This is > inconsistent with other functions, such as uclass_find_next_device(), > which returns 0. > > Update it and tidy up the incorrect '-1' values in the comments. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > drivers/core/uclass.c | 2 +- > include/dm/uclass-internal.h | 4 ++-- > test/dm/core.c | 3 +-- > 3 files changed, 4 insertions(+), 5 deletions(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
On Fri, Oct 4, 2019 at 5:44 PM Bin Meng <bmeng.cn@gmail.com> wrote: > > On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote: > > > > This function returns -ENODEV when there is no device. This is > > inconsistent with other functions, such as uclass_find_next_device(), > > which returns 0. > > > > Update it and tidy up the incorrect '-1' values in the comments. > > > > Signed-off-by: Simon Glass <sjg@chromium.org> > > --- > > > > drivers/core/uclass.c | 2 +- > > include/dm/uclass-internal.h | 4 ++-- > > test/dm/core.c | 3 +-- > > 3 files changed, 4 insertions(+), 5 deletions(-) > > > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> > Tested-by: Bin Meng <bmeng.cn@gmail.com> applied to u-boot-x86/next, thanks!
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index af575bbeb72..f217876cd2c 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -225,7 +225,7 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp) if (ret) return ret; if (list_empty(&uc->dev_head)) - return -ENODEV; + return 0; *devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node); diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index 6977995246d..6e3f15c2b08 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -69,7 +69,7 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp); * The device is not prepared for use - this is an internal function. * The function uclass_get_device_tail() can be used to probe the device. * - * @return 0 if OK (found or not found), -1 on error + * @return 0 if OK (found or not found), -ve on error */ int uclass_find_first_device(enum uclass_id id, struct udevice **devp); @@ -81,7 +81,7 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp); * The device is not prepared for use - this is an internal function. * The function uclass_get_device_tail() can be used to probe the device. * - * @return 0 if OK (found or not found), -1 on error + * @return 0 if OK (found or not found), -ve on error */ int uclass_find_next_device(struct udevice **devp); diff --git a/test/dm/core.c b/test/dm/core.c index edd55b05d6e..f74c4308439 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -749,8 +749,7 @@ static int dm_test_uclass_devices_find(struct unit_test_state *uts) ut_assert(dev); } - ret = uclass_find_first_device(UCLASS_TEST_DUMMY, &dev); - ut_assert(ret == -ENODEV); + ut_assertok(uclass_find_first_device(UCLASS_TEST_DUMMY, &dev)); ut_assert(!dev); return 0;
This function returns -ENODEV when there is no device. This is inconsistent with other functions, such as uclass_find_next_device(), which returns 0. Update it and tidy up the incorrect '-1' values in the comments. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/core/uclass.c | 2 +- include/dm/uclass-internal.h | 4 ++-- test/dm/core.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-)