Skip to contentSkip to conversation

board-info: Use sysinfo_get()

PATCH In review Marek Vasut 3 participants 6 messages Jul 4, 2021 – Jul 14, 2021

lore
Share & tools
lore
#0 lore raw

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.

Cc Marcel Ziswiler <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/board_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_info.c +1 -1
index 1cfe34f706..89a29c322c 100644
@@ -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
#1 lore raw

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.

Cc Marcel Ziswiler <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/board_info.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
common/board_info.c +6 -2
index 89a29c322c..e0f2d93922 100644
@@ -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
Reviewed-by on v1 2/2
#2 lore raw

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. Call sysinfo_detect() before sysinfo_get_str() to make sure the sysinfo is detected and sysinfo_get_str() returns valid value instead of -EPERM.

Quoted 6 lines
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() ?

#3 lore raw

Re: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()

In reply to Marek Vasut
Quoted 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. Call sysinfo_detect() before sysinfo_get_str() to make sure the sysinfo is detected and sysinfo_get_str() returns valid value instead of -EPERM.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
Reviewed-by on v1 1/2
#4 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

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.

Quoted 6 lines
Cc Marcel Ziswiler <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/board_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#5 lore raw
In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

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.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom