diff mbox series

[V3,4/9] common: board_f: Use cpu_get_current_dev in print_cpuinfo

Message ID 20200503135855.11484-4-peng.fan@nxp.com
State New
Headers show
Series [V3,1/9] uclass: cpu: Add new API to get udevice for current CPU | expand

Commit Message

Peng Fan May 3, 2020, 1:58 p.m. UTC
From: Ye Li <ye.li at nxp.com>

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---

V3:
 None
V2:
 None

 common/board_f.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Stefano Babic May 4, 2020, 7:34 a.m. UTC | #1
> From: Ye Li <ye.li at nxp.com>
> Current print_cpuinfo gets the first udevice in CPU class to return
> the cpu info. This has problem if the boot CPU is not fixed.
> Changing to use new API cpu_get_current_dev to fix the issue.
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 5c650f046c..5223453511 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -183,11 +183,11 @@  static int print_cpuinfo(void)
 	char desc[512];
 	int ret;
 
-	ret = uclass_first_device_err(UCLASS_CPU, &dev);
-	if (ret) {
-		debug("%s: Could not get CPU device (err = %d)\n",
-		      __func__, ret);
-		return ret;
+	dev = cpu_get_current_dev();
+	if (!dev) {
+		debug("%s: Could not get CPU device\n",
+		      __func__);
+		return -ENODEV;
 	}
 
 	ret = cpu_get_desc(dev, desc, sizeof(desc));