]> git.baikalelectronics.ru Git - uboot.git/commitdiff
bootstd: Drop the old bootflow_scan_first()
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jan 2023 17:48:16 +0000 (10:48 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 23 Jan 2023 23:11:41 +0000 (18:11 -0500)
This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootflow.c
cmd/bootflow.c
include/bootflow.h
test/boot/bootdev.c
test/boot/bootflow.c

index 50d9c2e813a2db46813893ff5a30eb237c7dcd9f..750732f70830ebb5c2408311aa6adbf68223caca 100644 (file)
@@ -324,9 +324,9 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow)
        return 0;
 }
 
-int bootflow_scan_bootdev(struct udevice *dev, const char *label,
-                         struct bootflow_iter *iter, int flags,
-                         struct bootflow *bflow)
+int bootflow_scan_first(struct udevice *dev, const char *label,
+                       struct bootflow_iter *iter, int flags,
+                       struct bootflow *bflow)
 {
        int ret;
 
@@ -371,18 +371,6 @@ int bootflow_scan_bootdev(struct udevice *dev, const char *label,
        return 0;
 }
 
-int bootflow_scan_first(struct bootflow_iter *iter, int flags,
-                       struct bootflow *bflow)
-{
-       int ret;
-
-       ret = bootflow_scan_bootdev(NULL, NULL, iter, flags, bflow);
-       if (ret)
-               return log_msg_ret("start", ret);
-
-       return 0;
-}
-
 int bootflow_scan_next(struct bootflow_iter *iter, struct bootflow *bflow)
 {
        int ret;
index 72d5a8424e936b0b78caaf828c78f78957afb666..692bc6d117f778bc76e61d67b2d69bfc17ef3d87 100644 (file)
@@ -161,7 +161,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
        else
                bootstd_clear_glob();
        for (i = 0,
-            ret = bootflow_scan_bootdev(dev, label, &iter, flags, &bflow);
+            ret = bootflow_scan_first(dev, label, &iter, flags, &bflow);
             i < 1000 && ret != -ENODEV;
             i++, ret = bootflow_scan_next(&iter, &bflow)) {
                bflow.err = ret;
index 1b7920a95729c9e80afa5a85d076505d10c2c32c..c2368912061a789cc87b68e3e3b5ba9153327d3b 100644 (file)
@@ -249,7 +249,7 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter,
                                const struct udevice *bmeth);
 
 /**
- * bootflow_scan_bootdev() - find the first bootflow in a bootdev
+ * bootflow_scan_first() - find the first bootflow for a device or label
  *
  * If @flags includes BOOTFLOWF_ALL then bootflows with errors are returned too
  *
@@ -264,25 +264,8 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter,
  * Return: 0 if found,  -ENODEV if no device, other -ve on other error
  *     (iteration can continue)
  */
-int bootflow_scan_bootdev(struct udevice *dev, const char *label,
-                         struct bootflow_iter *iter, int flags,
-                         struct bootflow *bflow);
-
-/**
- * bootflow_scan_first() - find the first bootflow
- *
- * This works through the available bootdev devices until it finds one that
- * can supply a bootflow. It then returns that
- *
- * If @flags includes BOOTFLOWF_ALL then bootflows with errors are returned too
- *
- * @iter:      Place to store private info (inited by this call), with
- * @flags:     Flags for bootdev (enum bootflow_flags_t)
- * @bflow:     Place to put the bootflow if found
- * Return: 0 if found, -ENODEV if no device, other -ve on other error (iteration
- *     can continue)
- */
-int bootflow_scan_first(struct bootflow_iter *iter, int flags,
+int bootflow_scan_first(struct udevice *dev, const char *label,
+                       struct bootflow_iter *iter, int flags,
                        struct bootflow *bflow);
 
 /**
index 1724e34af3eff2a1b68877eec1598047adc548ab..5d5ce7f48cf25556138ed13729fd5fc225949a4a 100644 (file)
@@ -203,7 +203,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
         * mmc2 - nothing connected
         */
        ut_assertok(env_set("boot_targets", NULL));
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(2, iter.num_devs);
        ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
        ut_asserteq_str("mmc1.bootdev", iter.dev_order[1]->name);
@@ -211,7 +211,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
 
        /* Use the environment variable to override it */
        ut_assertok(env_set("boot_targets", "mmc1 mmc2"));
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(2, iter.num_devs);
        ut_asserteq_str("mmc1.bootdev", iter.dev_order[0]->name);
        ut_asserteq_str("mmc2.bootdev", iter.dev_order[1]->name);
@@ -224,7 +224,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
        ut_assertok(env_set("boot_targets", NULL));
        ut_assertok(bootstd_test_drop_bootdev_order(uts));
 
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(3, iter.num_devs);
        ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
        ut_asserteq_str("mmc1.bootdev", iter.dev_order[1]->name);
@@ -239,7 +239,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
        iter.dev_order[2]->seq_ = 2;
        bootflow_iter_uninit(&iter);
 
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(3, iter.num_devs);
        ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
        ut_asserteq_str("mmc0.bootdev", iter.dev_order[1]->name);
@@ -268,7 +268,7 @@ static int bootdev_test_prio(struct unit_test_state *uts)
 
        /* 3 MMC and 3 USB bootdevs: MMC should come before USB */
        console_record_reset_enable();
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(6, iter.num_devs);
        ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
        ut_asserteq_str("usb_mass_storage.lun0.bootdev",
@@ -282,7 +282,8 @@ static int bootdev_test_prio(struct unit_test_state *uts)
        ucp->prio = 1;
 
        bootflow_iter_uninit(&iter);
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, BOOTFLOWF_HUNT,
+                                       &bflow));
        ut_asserteq(6, iter.num_devs);
        ut_asserteq_str("usb_mass_storage.lun0.bootdev",
                        iter.dev_order[0]->name);
@@ -415,7 +416,8 @@ static int bootdev_test_hunt_scan(struct unit_test_state *uts)
        ut_assertok(bootstd_get_priv(&std));
 
        ut_assertok(bootstd_test_drop_bootdev_order(uts));
-       ut_assertok(bootflow_scan_first(&iter, BOOTFLOWF_SHOW | BOOTFLOWF_HUNT |
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter,
+                                       BOOTFLOWF_SHOW | BOOTFLOWF_HUNT |
                                        BOOTFLOWF_SKIP_GLOBAL, &bflow));
        ut_asserteq(BIT(MMC_HUNTER) | BIT(1), std->hunters_used);
 
index 0b3a2fa6acc260d4358546bfc17a0c774494a396..b9284fc464af696ef67ab66ff90d201d8b2417f6 100644 (file)
@@ -276,7 +276,8 @@ static int bootflow_iter(struct unit_test_state *uts)
 
        /* The first device is mmc2.bootdev which has no media */
        ut_asserteq(-EPROTONOSUPPORT,
-                   bootflow_scan_first(&iter, BOOTFLOWF_ALL | BOOTFLOWF_SKIP_GLOBAL, &bflow));
+                   bootflow_scan_first(NULL, NULL, &iter,
+                                       BOOTFLOWF_ALL | BOOTFLOWF_SKIP_GLOBAL, &bflow));
        ut_asserteq(2, iter.num_methods);
        ut_asserteq(0, iter.cur_method);
        ut_asserteq(0, iter.part);
@@ -415,7 +416,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
 
        /* Try to boot the bootmgr flow, which will fail */
        console_record_reset_enable();
-       ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
+       ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
        ut_asserteq(3, iter.num_methods);
        ut_asserteq_str("sandbox", iter.method->name);
        ut_assertok(inject_response(uts));