board-info: Use sysinfo_get()
PATCH 1/2 board-info: Use sysinfo_get()
Replace uclass_first_device_err(UCLASS_SYSINFO, &dev) with sysinfo_get(&dev). The board_info code may use sysinfo to print board information, so use the sysinfo functions consistently. The sysinfo_get() is internally implemented as return uclass_first_device_err(UCLASS_SYSINFO, &dev) anyway, so there is no functional change.
--- common/board_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_info.c +1 -1
@@ -31,7 +31,7 @@ int __weak show_board_info(void)if (IS_ENABLED (CONFIG_SYSINFO )) {/* This might provide more detail */ - ret =uclass_first_device_err (UCLASS_SYSINFO , &dev); + ret =sysinfo_get (&dev);if (!ret) ret = sysinfo_get_str(dev, SYSINFO_ID_BOARD_MODEL,
Signature · 1 line
2.30.2
PATCH 2/2 board-info: Call sysinfo_detect() before sysinfo_get_str()
The sysinfo_get_str() implementation checks whether the sysinfo was even detected. In U-Boot proper, sysinfo_detect() is not called anywhere but on one specific board. Call sysinfo_detect() before sysinfo_get_str() to make sure the sysinfo is detected and sysinfo_get_str() returns valid value instead of -EPERM.
--- common/board_info.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
common/board_info.c +6 -2
@@ -32,10 +32,14 @@ int __weak show_board_info(void)if (IS_ENABLED (CONFIG_SYSINFO )) {/* This might provide more detail */ ret =sysinfo_get (&dev); -if (!ret) - ret =sysinfo_get_str (dev, +if (!ret) { + ret =sysinfo_detect (dev); +if (!ret) { + ret =sysinfo_get_str (dev,SYSINFO_ID_BOARD_MODEL ,sizeof (str), str); + } + } }/* Fail back to the main 'model' if available */
Signature · 1 line
2.30.2
Re: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
Quoted 7 lines · Marek Vasut
The
sysinfo_get_str()implementation checks whether the sysinfo was even detected. In U-Boot proper,sysinfo_detect()is not called anywhere but on one specific board. Callsysinfo_detect()beforesysinfo_get_str()to make sure the sysinfo is detected andsysinfo_get_str()returns valid value instead of-EPERM.
Quoted 6 lines
Signed-off-by Marek Vasut <[email protected]>Cc Marcel Ziswiler <[email protected]>Cc Simon Glass <[email protected]>--- common/board_info.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
I wonder if we should have sysinfo_get_detect() ?
Re: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
In reply to Marek VasutQuoted 10 lines · Marek Vasut
The
sysinfo_get_str()implementation checks whether the sysinfo was even detected. In U-Boot proper,sysinfo_detect()is not called anywhere but on one specific board. Callsysinfo_detect()beforesysinfo_get_str()to make sure the sysinfo is detected andsysinfo_get_str()returns valid value instead of-EPERM.Signed-off-by Marek Vasut <[email protected]>Cc Marcel Ziswiler <[email protected]>Cc Simon Glass <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Quoted 7 lines · Marek Vasut
Replace
uclass_first_device_err(UCLASS_SYSINFO, &dev)withsysinfo_get(&dev). Theboard_infocode may use sysinfo to print board information, so use the sysinfo functions consistently. Thesysinfo_get()is internally implemented as returnuclass_first_device_err(UCLASS_SYSINFO, &dev)anyway, so there is no functional change.
Quoted 6 lines
Signed-off-by Marek Vasut <[email protected]>Cc Marcel Ziswiler <[email protected]>Cc Simon Glass <[email protected]>--- common/board_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines · Marek Vasut
Replace
uclass_first_device_err(UCLASS_SYSINFO, &dev)withsysinfo_get(&dev). Theboard_infocode may use sysinfo to print board information, so use the sysinfo functions consistently. Thesysinfo_get()is internally implemented as returnuclass_first_device_err(UCLASS_SYSINFO, &dev)anyway, so there is no functional change.Signed-off-by Marek Vasut <[email protected]>Cc Marcel Ziswiler <[email protected]>Cc Simon Glass <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom