]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: cros_ec: exynos: Drop use of cros_ec_get_error()
authorSimon Glass <sjg@chromium.org>
Tue, 6 Nov 2018 22:21:26 +0000 (15:21 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Nov 2018 02:14:22 +0000 (19:14 -0700)
This function is really just a call to uclass_get_device() and there is no
reason why the caller cannot do it. Update sandbox and snow accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/common/board.c
board/sandbox/sandbox.c
common/cros_ec.c

index c4b6baedf04ea9091d003b72c1e8ef040e8b23c9..6fd26a3a91988e39413dcd6ad30a47893528aae1 100644 (file)
@@ -306,14 +306,16 @@ int checkboard(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
-       stdio_print_current_devices();
+       struct udevice *dev;
+       int ret;
 
-       if (cros_ec_get_error()) {
+       stdio_print_current_devices();
+       ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
+       if (ret && ret != -ENODEV) {
                /* Force console on */
                gd->flags &= ~GD_FLG_SILENT;
 
-               printf("cros-ec communications failure %d\n",
-                      cros_ec_get_error());
+               printf("cros-ec communications failure %d\n", ret);
                puts("\nPlease reset with Power+Refresh\n\n");
                panic("Cannot init cros-ec device");
                return -1;
index 0e87674826a44379e83277c576bd40e9ce13819f..397e7561d4d9a39ee0ad90b5331e2b723f7b702d 100644 (file)
@@ -59,12 +59,15 @@ int board_init(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
-       if (cros_ec_get_error()) {
+       struct udevice *dev;
+       int ret;
+
+       ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
+       if (ret && ret != -ENODEV) {
                /* Force console on */
                gd->flags &= ~GD_FLG_SILENT;
 
-               printf("cros-ec communications failure %d\n",
-                      cros_ec_get_error());
+               printf("cros-ec communications failure %d\n", ret);
                puts("\nPlease reset with Power+Refresh\n\n");
                panic("Cannot init cros-ec device");
                return -1;
index 4ca15e19d5fa398e5ef1ec29e2174d6dc3bff927..e66471ebd1b257ce7049b2ec579c1d339abed8af 100644 (file)
@@ -25,15 +25,3 @@ struct udevice *board_get_cros_ec_dev(void)
        }
        return dev;
 }
-
-int cros_ec_get_error(void)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
-       if (ret && ret != -ENODEV)
-               return ret;
-
-       return 0;
-}