boot: Precursor series for global bootmeths
v5 cover boot: Precursor series for global bootmeths
This series contains a few patches pulled out from the global-bootmeth series. No functional change is intended.
I left out this one:
boot: Move showing of bootflows out of the command
since Tom has already said he doesn't want it.
Changes in v5:
- Move 'usb' rename into a separate patch
- Rework commit message
Changes in v4:
- Series pulled out from previous glob-us3 series
- Drop patch 'Add more debugging to iter_incr()'
Changes in v3:
- Drop the spacing changes
Simon Glass (4):
boot: Improve comments related to global bootmeths
boot: Move obtaining the label into a common file
boot: Rename usb to ums
boot: Move preparing bootdev into a function
boot/bootflow.c | 60 ++++++++++++++++++++++++++++++++++-------- boot/bootmeth-uclass.c | 1 + cmd/bootflow.c | 8 +++--- include/bootflow.h | 11 +++++++- test/boot/bootflow.c | 4 +-- 5 files changed, 67 insertions(+), 17 deletions(-)
Signature · 4 lines
2.43.0 base-commit: 48f21e66e360552c75d70a50421d0e0ed1f59e90 branch: glob-us5
PATCH v5 1/4 boot: Improve comments related to global bootmeths
Add a few comments about global bootmeths and first_glob_method
---
(no changes since v3)
Changes in v3:
- Drop the spacing changes
boot/bootflow.c | 1 + boot/bootmeth-uclass.c | 1 + include/bootflow.h | 3 ++- test/boot/bootflow.c | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-)
boot/bootflow.c +1 -0
@@ -344,6 +344,7 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow)struct udevice *dev;int ret; +/* handle global bootmeths if needed */ if (IS_ENABLED (CONFIG_BOOTMETH_GLOBAL ) && iter->doing_global) {bootflow_iter_set_dev (iter,NULL ,0 ); ret =bootmeth_get_bootflow (iter->method, bflow);
boot/bootmeth-uclass.c +1 -0
@@ -204,6 +204,7 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global) goto err_order; } +/* start with the global bootmeths */ if (IS_ENABLED (CONFIG_BOOTMETH_GLOBAL ) && include_global && iter->first_glob_method !=-1 && iter->first_glob_method != count) { iter->cur_method = iter->first_glob_method;
include/bootflow.h +2 -1
@@ -250,7 +250,8 @@ enum bootflow_meth_flags_t {* @cur_label: Current label being processed * @num_methods: Number of bootmeth devices in @method_order * @cur_method: Current method number, an index into @method_order -* @first_glob_method: First global method, if any, else -1 +* @first_glob_method: Index of first global method within @method_order[], if +* any, else -1 * @cur_prio: Current priority being scanned * @method_order: List of bootmeth devices to use, in order. The normal methods * appear first, then the global ones, if any
test/boot/bootflow.c +1 -1
@@ -401,7 +401,7 @@ static int bootflow_system(struct unit_test_state *uts)ut_assertok (device_probe (dev));sandbox_set_fake_efi_mgr_dev (dev, true); -/* We should get a single 'bootmgr' method right at the end */ +/* We should get a single 'bootmgr' method at the start */ bootstd_clear_glob ();ut_assertok (run_command ("bootflow scan -lH" ,0 )); ut_assert_skip_to_line(
Signature · 1 line
2.43.0
Re: [PATCH v5 1/4] boot: Improve comments related to global bootmeths
Quoted 4 lines · Simon Glass
Add a few comments about global bootmeths and
first_glob_methodSigned-off-by Simon Glass <[email protected]>Reviewed-by Heinrich Schuchardt <[email protected]>
You don't need to resend since b4 should pick it up, but you missed several reviewed-by tags.
Signature · 1 line
Tom
PATCH v5 2/4 boot: Move obtaining the label into a common file
In reply to Simon GlassThe 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
This updates the output from 'bootflow list'.
---
Changes in v5:
- Move 'usb' rename into a separate patch
boot/bootflow.c | 16 ++++++++++++++++ cmd/bootflow.c | 8 +++++--- include/bootflow.h | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-)
boot/bootflow.c +16 -0
@@ -11,6 +11,7 @@#include <bootmeth.h> #include <bootstd.h> #include <dm.h> +#include <efi_device_path.h> #include <env_internal.h> #include <malloc.h> #include <serial.h>
@@ -1010,3 +1011,18 @@ int bootflow_get_seq(const struct bootflow *bflow)return alist_calc_index (&std->bootflows, bflow); } + +const char *bootflow_guess_label (const struct bootflow *bflow) +{ +const char *name =NULL ; + +if (bflow->dev) { +struct udevice *media =dev_get_parent (bflow->dev); + + name =dev_get_uclass_name (media); + } +if (!name) + name ="(none)" ; + +return name; +}
cmd/bootflow.c +5 -3
@@ -70,10 +70,12 @@ static void report_bootflow_err(struct bootflow *bflow, int err)*/ static void show_bootflow (int index,struct bootflow *bflow,bool errors) { +const char *name =bootflow_guess_label (bflow); +printf ("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n" , index, - bflow->method->name,bootflow_state_get_name (bflow->state), - bflow->dev ?dev_get_uclass_name (dev_get_parent (bflow->dev)) : -"(none)" , bflow->part, bflow->name, bflow->fname ?:"" ); + bflow->method ? bflow->method->name :"(none)" , +bootflow_state_get_name (bflow->state), name, bflow->part, + bflow->name, bflow->fname ?:"" );if (errors)report_bootflow_err (bflow, bflow->err); }
include/bootflow.h +8 -0
@@ -692,4 +692,12 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,*/ int bootflow_menu_poll (struct expo *exp,int *seqp); +/** +* bootflow_guess_label() - Produce a plausible label for a bootflow +* +* This uses the uclass name or EFI device-path to come up with a useful label +* for display to the user. Ideally it will say "mmc", "usb", nvme", etc. +*/ +const char *bootflow_guess_label (const struct bootflow *bflow); +#endif
Signature · 1 line
2.43.0
Re: [PATCH v5 2/4] boot: Move obtaining the label into a common file
Quoted 30 lines · Simon Glass
The 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
This updates the output from 'bootflow list'.
Signed-off-by Simon Glass <[email protected]>---
Changes in v5:
- Move 'usb' rename into a separate patchboot/bootflow.c | 16 ++++++++++++++++ cmd/bootflow.c | 8 +++++--- include/bootflow.h | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-)boot/bootflow.c +1
-0@@ -11,6 +11,7 @@#include <bootmeth.h> #include <bootstd.h> #include <dm.h> +#include <efi_device_path.h> #include <env_internal.h> #include <malloc.h> #include <serial.h>
boot/bootflow.c int bootflow_get_seq(const struct bootflow *bflow) · line 1017
Quoted 7 lines
boot/bootflow.c +4
-0@@ -1010,3 +1011,18 @@ int bootflow_get_seq(const struct bootflow *bflow)return alist_calc_index (&std->bootflows, bflow); } + +const char *bootflow_guess_label (const struct bootflow *bflow) +{ +const char *name =NULL ;
Why would you not return bootflow->name if it is allocated?
boot/bootflow.c int bootflow_get_seq(const struct bootflow *bflow) · line 1025
Quoted 8 lines
boot/bootflow.c +8
-0+ +if (bflow->dev) { +struct udevice *media =dev_get_parent (bflow->dev); + + name =dev_get_uclass_name (media); + } +if (!name) + name ="(none)" ;
Label "(none)" makes no sense to bootflows created for BOOTMETHF_GLOBAL. Can't we return a string for the bootmeth instead?
cmd/bootflow.c static void report_bootflow_err(struct bootflow *bflow, int err) · line 73
Quoted 12 lines
boot/bootflow.c +3
-0+ +return name; +}cmd/bootflow.c +1
-0@@ -70,10 +70,12 @@ static void report_bootflow_err(struct bootflow *bflow, int err)*/ static void show_bootflow (int index,struct bootflow *bflow,bool errors) { +const char *name =bootflow_guess_label (bflow);
Why would we guess a name if bflow->name != NULL?
Quoted 16 lines
cmd/bootflow.c +4
-3+printf ("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n" , index, - bflow->method->name,bootflow_state_get_name (bflow->state), - bflow->dev ?dev_get_uclass_name (dev_get_parent (bflow->dev)) : -"(none)" , bflow->part, bflow->name, bflow->fname ?:"" ); + bflow->method ? bflow->method->name :"(none)" , +bootflow_state_get_name (bflow->state), name, bflow->part, + bflow->name, bflow->fname ?:"" );if (errors)report_bootflow_err (bflow, bflow->err); }include/bootflow.h +0
-0
include/bootflow.h int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, · line 699
Quoted 8 lines
include/bootflow.h +5
-0@@ -692,4 +692,12 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,*/ int bootflow_menu_poll (struct expo *exp,int *seqp); +/** +* bootflow_guess_label() - Produce a plausible label for a bootflow +* +* This uses the uclass name or EFI device-path to come up with a useful label +* for display to the user. Ideally it will say "mmc", "usb", nvme", etc.
Please, describe the fallback.
The documentation is comprehensible but unfortunately incomplete for what we want to generate in doc/api
Please, add '@bootflow:', 'Return:'.
cf. https://www.kernel.org/doc/html/v4.16/doc-guide/kernel-doc.html#function-documentation
Best regards
Heinrich
Quoted 4 lines
include/bootflow.h +3
-0+*/ +const char *bootflow_guess_label (const struct bootflow *bflow); +#endif
Re: [PATCH v5 2/4] boot: Move obtaining the label into a common file
Hi Heinrich,
Quoted 33 lines · Heinrich Schuchardt
Quoted 31 lines · Simon Glass
The 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
This updates the output from 'bootflow list'.
Signed-off-by Simon Glass <[email protected]>---
Changes in v5:
- Move 'usb' rename into a separate patchboot/bootflow.c | 16 ++++++++++++++++ cmd/bootflow.c | 8 +++++--- include/bootflow.h | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-)boot/bootflow.c +1
-0@@ -11,6 +11,7 @@#include <bootmeth.h> #include <bootstd.h> #include <dm.h> +#include <efi_device_path.h> #include <env_internal.h> #include <malloc.h> #include <serial.h> @@ -1010,3 +1011,18 @@ int bootflow_get_seq(const struct bootflow *bflow)
Quoted 8 lines
boot/bootflow.c int bootflow_get_seq(const struct bootflow *bflow) · line 1017
Quoted 6 lines
boot/bootflow.c +4
-0return alist_calc_index (&std->bootflows, bflow); } + +const char *bootflow_guess_label (const struct bootflow *bflow) +{ +const char *name =NULL ;Why would you not return
bootflow->nameif it is allocated?
This is intended to show the label of the bootdev which produced the bootflow. If you look below you can see that the bootflow name is already shown, so we don't want to show it twice.
Quoted 12 lines
boot/bootflow.c int bootflow_get_seq(const struct bootflow *bflow) · line 1025
Quoted 9 lines
boot/bootflow.c +8
-0+ +if (bflow->dev) { +struct udevice *media =dev_get_parent (bflow->dev); + + name =dev_get_uclass_name (media); + } +if (!name) + name ="(none)" ;Label "(none)" makes no sense to bootflows created for
BOOTMETHF_GLOBAL. Can't we return a string for the bootmeth instead?
Similarly, the bootmeth name is already shown. See below.
Quoted 15 lines
cmd/bootflow.c static void report_bootflow_err(struct bootflow *bflow, int err) · line 73
Quoted 13 lines
boot/bootflow.c +3
-0+ +return name; +}cmd/bootflow.c +1
-0@@ -70,10 +70,12 @@ static void report_bootflow_err(struct bootflow *bflow, int err)*/ static void show_bootflow (int index,struct bootflow *bflow,bool errors) { +const char *name =bootflow_guess_label (bflow);Why would we guess a name if
bflow->name!= NULL?
It isn't the name we are trying to guess, it is the bootdev. We are trying to show a friendly name for the bootdev.
Quoted 28 lines
Quoted 17 lines
cmd/bootflow.c +4
-3+printf ("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n" , index, - bflow->method->name,bootflow_state_get_name (bflow->state), - bflow->dev ?dev_get_uclass_name (dev_get_parent (bflow->dev)) : -"(none)" , bflow->part, bflow->name, bflow->fname ?:"" ); + bflow->method ? bflow->method->name :"(none)" , +bootflow_state_get_name (bflow->state), name, bflow->part, + bflow->name, bflow->fname ?:"" );if (errors)report_bootflow_err (bflow, bflow->err); }include/bootflow.h +0
-0include/bootflow.h int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, · line 699
Quoted 8 lines
include/bootflow.h +5
-0@@ -692,4 +692,12 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,*/ int bootflow_menu_poll (struct expo *exp,int *seqp); +/** +* bootflow_guess_label() - Produce a plausible label for a bootflow +* +* This uses the uclass name or EFI device-path to come up with a useful label +* for display to the user. Ideally it will say "mmc", "usb", nvme", etc. Please, describe the fallback.
Quoted 7 lines
The documentation is comprehensible but unfortunately incomplete for what we want to generate in doc/api
Please, add '@bootflow:', 'Return:'.
cf.
https://www.kernel.org/doc/html/v4.16/doc-guide/kernel-doc.html#function-documentation
OK
Quoted 9 lines
Best regards
Heinrich
include/bootflow.h int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, · line 703
Quoted 4 lines
include/bootflow.h +3
-0+*/ +const char *bootflow_guess_label (const struct bootflow *bflow); +#endif
Regards,
Simon
Re: [PATCH v5 2/4] boot: Move obtaining the label into a common file
In reply to Simon GlassQuoted 7 lines · Simon Glass
The 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
This updates the output from 'bootflow list'.
Signed-off-by Simon Glass <[email protected]>
You were supposed to drop this patch since it was only needed for another patch you have dropped. Thanks.
Signature · 1 line
Tom
Re: [PATCH v5 2/4] boot: Move obtaining the label into a common file
Hi Tom,
Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass
The 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
Quoted 6 lines
Quoted 3 lines
This updates the output from 'bootflow list'.
Signed-off-by Simon Glass <[email protected]>You were supposed to drop this patch since it was only needed for another patch you have dropped. Thanks.
Oh I didn't know that. So in fact are there only two patches remaining?:
boot: Move preparing bootdev into a function
boot: Improve comments related to global bootmeths
Regards,
Simon
Re: [PATCH v5 2/4] boot: Move obtaining the label into a common file
Quoted 14 lines · Simon Glass
Hi Tom,
Quoted 11 lines · Tom Rini
Quoted 7 lines · Simon Glass
The 'bootflow list' command supports looking at the EFI device-path when available. Move this piece into a common function so it can be used elsewhere.
This updates the output from 'bootflow list'.
Signed-off-by Simon Glass <[email protected]>
Quoted 7 lines
Quoted 2 lines
You were supposed to drop this patch since it was only needed for another patch you have dropped. Thanks.
Oh I didn't know that. So in fact are there only two patches remaining?:
boot: Move preparing bootdev into a function
boot: Improve comments related to global bootmeths
Yes, thanks. And if there's no further feedback I'll just grab those parts of this series.
Signature · 1 line
Tom
PATCH v5 3/4 boot: Rename usb to ums
In reply to Simon GlassThe name 'usb' is quite generic and could apply to any USB device. Rename it 'ums', for USB Mass Storage.
---
(no changes since v1)
boot/bootflow.c | 5 ++++- include/bootflow.h | 2 +- test/boot/bootflow.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)
boot/bootflow.c +4 -1
@@ -1019,7 +1019,10 @@ const char *bootflow_guess_label(const struct bootflow *bflow)if (bflow->dev) {struct udevice *media =dev_get_parent (bflow->dev); - name =dev_get_uclass_name (media); +if (device_get_uclass_id (media) ==UCLASS_MASS_STORAGE ) + name ="ums" ; +else + name =dev_get_uclass_name (media); }if (!name) name ="(none)" ;
include/bootflow.h +1 -1
@@ -696,7 +696,7 @@ int bootflow_menu_poll(struct expo *exp, int *seqp);* bootflow_guess_label() - Produce a plausible label for a bootflow * * This uses the uclass name or EFI device-path to come up with a useful label -* for display to the user. Ideally it will say "mmc", "usb", nvme", etc. +* for display to the user. Ideally it will say "mmc", "ums", nvme", etc. */ const char *bootflow_guess_label (const struct bootflow *bflow);
test/boot/bootflow.c +1 -1
@@ -1301,7 +1301,7 @@ static int bootflow_efi(struct unit_test_state *uts)ut_assert_nextlinen ("---" );ut_assert_nextlinen (" 0 extlinux" );ut_assert_nextlinen ( -" 1 efi ready usb_mass_ 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" ); +" 1 efi ready ums 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" );ut_assert_nextlinen ("---" );ut_assert_skip_to_line ("(2 bootflows, 2 valid)" );ut_assert_console_end ();
Signature · 1 line
2.43.0
Re: [PATCH v5 3/4] boot: Rename usb to ums
Quoted 19 lines · Simon Glass
The name 'usb' is quite generic and could apply to any USB device. Rename it 'ums', for USB Mass Storage.
Signed-off-by Simon Glass <[email protected]>Suggested-by Tom Rini <[email protected]>---
(no changes since v1)
boot/bootflow.c | 5 ++++- include/bootflow.h | 2 +- test/boot/bootflow.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)boot/bootflow.c +0
-0
boot/bootflow.c const char *bootflow_guess_label(const struct bootflow *bflow) · line 1023
Quoted 6 lines
boot/bootflow.c +2
-1@@ -1019,7 +1019,10 @@ const char *bootflow_guess_label(const struct bootflow *bflow)if (bflow->dev) {struct udevice *media =dev_get_parent (bflow->dev); - name =dev_get_uclass_name (media); +if (device_get_uclass_id (media) ==UCLASS_MASS_STORAGE ) + name ="ums" ;
Using a different label ('ums') here than we use for the load command ('usb') just leads to confusing users.
We should use the same label for USB mass storage devices everywhere. Or use a long label like 'USB block device'.
Best regards
Heinrich
Quoted 31 lines
boot/bootflow.c +2
-0+else + name =dev_get_uclass_name (media); }if (!name) name ="(none)" ;include/bootflow.h +1
-1@@ -696,7 +696,7 @@ int bootflow_menu_poll(struct expo *exp, int *seqp);* bootflow_guess_label() - Produce a plausible label for a bootflow * * This uses the uclass name or EFI device-path to come up with a useful label -* for display to the user. Ideally it will say "mmc", "usb", nvme", etc. +* for display to the user. Ideally it will say "mmc", "ums", nvme", etc. */ const char *bootflow_guess_label (const struct bootflow *bflow);test/boot/bootflow.c +1
-1@@ -1301,7 +1301,7 @@ static int bootflow_efi(struct unit_test_state *uts)ut_assert_nextlinen ("---" );ut_assert_nextlinen (" 0 extlinux" );ut_assert_nextlinen ( -" 1 efi ready usb_mass_ 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" ); +" 1 efi ready ums 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" );ut_assert_nextlinen ("---" );ut_assert_skip_to_line ("(2 bootflows, 2 valid)" );ut_assert_console_end ();
Re: [PATCH v5 3/4] boot: Rename usb to ums
Hi Heinrich,
Quoted 31 lines · Heinrich Schuchardt
Quoted 19 lines · Simon Glass
The name 'usb' is quite generic and could apply to any USB device. Rename it 'ums', for USB Mass Storage.
Signed-off-by Simon Glass <[email protected]>Suggested-by Tom Rini <[email protected]>---
(no changes since v1)
boot/bootflow.c | 5 ++++- include/bootflow.h | 2 +- test/boot/bootflow.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)boot/bootflow.c +0
-0boot/bootflow.c const char *bootflow_guess_label(const struct bootflow *bflow) · line 1023
Quoted 6 lines
boot/bootflow.c +2
-1@@ -1019,7 +1019,10 @@ const char *bootflow_guess_label(const struct bootflow *bflow)if (bflow->dev) {struct udevice *media =dev_get_parent (bflow->dev); - name =dev_get_uclass_name (media); +if (device_get_uclass_id (media) ==UCLASS_MASS_STORAGE ) + name ="ums" ;Using a different label ('ums') here than we use for the load command ('usb') just leads to confusing users.
Quoted 2 lines
We should use the same label for USB mass storage devices everywhere. Or use a long label like 'USB block device'.
OK, well we can just drop this patch. It was a suggestion from a few people, but I'm not a huge fan of it either. We only have room for 8 characters here at present.
Regards,
Simon
Quoted 37 lines
Best regards
Heinrich
Quoted 31 lines
boot/bootflow.c +2
-0+else + name =dev_get_uclass_name (media); }if (!name) name ="(none)" ;include/bootflow.h +1
-1@@ -696,7 +696,7 @@ int bootflow_menu_poll(struct expo *exp, int *seqp);* bootflow_guess_label() - Produce a plausible label for a bootflow * * This uses the uclass name or EFI device-path to come up with a useful label -* for display to the user. Ideally it will say "mmc", "usb", nvme", etc. +* for display to the user. Ideally it will say "mmc", "ums", nvme", etc. */ const char *bootflow_guess_label (const struct bootflow *bflow);test/boot/bootflow.c +1
-1@@ -1301,7 +1301,7 @@ static int bootflow_efi(struct unit_test_state *uts)ut_assert_nextlinen ("---" );ut_assert_nextlinen (" 0 extlinux" );ut_assert_nextlinen ( -" 1 efi ready usb_mass_ 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" ); +" 1 efi ready ums 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI" );ut_assert_nextlinen ("---" );ut_assert_skip_to_line ("(2 bootflows, 2 valid)" );ut_assert_console_end ();
PATCH v5 4/4 boot: Move preparing bootdev into a function
In reply to Simon GlassWe will want to use this same logic in another place within iter_inc(), so split it out into its own function.
---
Changes in v5:
- Rework commit message
boot/bootflow.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-)
boot/bootflow.c +29 -11
@@ -178,6 +178,32 @@ static void scan_next_in_uclass(struct udevice **devp) *devp = dev; } +/** +* prepare_bootdev() - Get ready to use a bootdev +* +* @iter: Bootflow iterator being used +* @dev: UCLASS_BOOTDEV device to use +* @method_flags: Method flag for the bootdev +* Return 0 if OK, -ve if the bootdev failed to probe +*/ +static int prepare_bootdev (struct bootflow_iter *iter,struct udevice *dev, +int method_flags) +{ +int ret; + +/* +* Probe the bootdev. This does not probe any attached block device, +* since they are siblings +*/ + ret =device_probe (dev); +log_debug ("probe %s %d\n" , dev->name, ret); +if (ret) +return log_msg_ret ("probe" , ret); +bootflow_iter_set_dev (iter, dev, method_flags); + +return 0 ; +} +/** * iter_incr() - Move to the next item (method, part, bootdev) *
@@ -311,18 +337,10 @@ static int iter_incr(struct bootflow_iter *iter) }log_debug ("ret=%d, dev=%p %s\n" , ret, dev, dev ? dev->name :"none" ); -if (ret) { +if (ret)bootflow_iter_set_dev (iter,NULL ,0 ); - }else { -/* -* Probe the bootdev. This does not probe any attached -* block device, since they are siblings -*/ - ret =device_probe (dev); -log_debug ("probe %s %d\n" , dev->name, ret); -if (!log_msg_ret ("probe" , ret)) -bootflow_iter_set_dev (iter, dev, method_flags); - } +else + ret =prepare_bootdev (iter, dev, method_flags); }/* if there are no more bootdevs, give up */
Signature · 1 line
2.43.0
Re: [PATCH v5 4/4] boot: Move preparing bootdev into a function
Quoted 4 lines · Simon Glass
We will want to use this same logic in another place within
iter_inc(), so split it out into its own function.Signed-off-by Simon Glass <[email protected]>
Signature · 1 line
Tom
Re: (subset) [PATCH v5 0/4] boot: Precursor series for global bootmeths
In reply to Simon GlassQuoted 8 lines · Simon Glass
This series contains a few patches pulled out from the global-bootmeth series. No functional change is intended.
I left out this one:
boot: Move showing of bootflows out of the command
[...]
Applied to u-boot/master, thanks!
[1/4] boot: Improve comments related to global bootmeths
commit: f6cd0a36cee32e89449f71ce495dc8f4cd175ad8
[4/4] boot: Move preparing bootdev into a function
commit: 996ded5463fd48497b6aa904a5647c2533d73ab3Signature · 1 line
Tom