All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] board-info: Use sysinfo_get()
@ 2021-07-04 19:32 Marek Vasut
  2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marek Vasut @ 2021-07-04 19:32 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Marcel Ziswiler, Simon Glass

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.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Simon Glass <sjg@chromium.org>
---
 common/board_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/board_info.c b/common/board_info.c
index 1cfe34f706..89a29c322c 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
  2021-07-04 19:32 [PATCH 1/2] board-info: Use sysinfo_get() Marek Vasut
@ 2021-07-04 19:32 ` Marek Vasut
  2021-07-05 15:29   ` Simon Glass
  2021-07-14 20:52   ` Tom Rini
  2021-07-05 15:29 ` [PATCH 1/2] board-info: Use sysinfo_get() Simon Glass
  2021-07-14 20:52 ` Tom Rini
  2 siblings, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2021-07-04 19:32 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Marcel Ziswiler, Simon Glass

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.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Simon Glass <sjg@chromium.org>
---
 common/board_info.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/board_info.c b/common/board_info.c
index 89a29c322c..e0f2d93922 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -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 */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] board-info: Use sysinfo_get()
  2021-07-04 19:32 [PATCH 1/2] board-info: Use sysinfo_get() Marek Vasut
  2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
@ 2021-07-05 15:29 ` Simon Glass
  2021-07-14 20:52 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2021-07-05 15:29 UTC (permalink / raw)
  To: Marek Vasut; +Cc: U-Boot Mailing List, Marek Vasut, Marcel Ziswiler

On Sun, 4 Jul 2021 at 13:32, Marek Vasut <marek.vasut@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  common/board_info.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
  2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
@ 2021-07-05 15:29   ` Simon Glass
  2021-07-14 20:52   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Simon Glass @ 2021-07-05 15:29 UTC (permalink / raw)
  To: Marek Vasut; +Cc: U-Boot Mailing List, Marek Vasut, Marcel Ziswiler

On Sun, 4 Jul 2021 at 13:32, Marek Vasut <marek.vasut@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  common/board_info.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

I wonder if we should have sysinfo_get_detect() ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] board-info: Use sysinfo_get()
  2021-07-04 19:32 [PATCH 1/2] board-info: Use sysinfo_get() Marek Vasut
  2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
  2021-07-05 15:29 ` [PATCH 1/2] board-info: Use sysinfo_get() Simon Glass
@ 2021-07-14 20:52 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-07-14 20:52 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Marcel Ziswiler, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

On Sun, Jul 04, 2021 at 09:32:04PM +0200, Marek Vasut wrote:

> 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.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Cc: Simon Glass <sjg@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
  2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
  2021-07-05 15:29   ` Simon Glass
@ 2021-07-14 20:52   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-07-14 20:52 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Marcel Ziswiler, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

On Sun, Jul 04, 2021 at 09:32:05PM +0200, Marek Vasut wrote:

> 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.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Cc: Simon Glass <sjg@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-14 20:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 19:32 [PATCH 1/2] board-info: Use sysinfo_get() Marek Vasut
2021-07-04 19:32 ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Marek Vasut
2021-07-05 15:29   ` Simon Glass
2021-07-14 20:52   ` Tom Rini
2021-07-05 15:29 ` [PATCH 1/2] board-info: Use sysinfo_get() Simon Glass
2021-07-14 20:52 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.