From: "J. Neuschäfer via B4 Relay" <devnull+j.ne.posteo.net@kernel.org>
To: Caleb Connolly <caleb.connolly@linaro.org>,
Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, "J. Neuschäfer" <j.ne@posteo.net>
Subject: [PATCH 2/3] cmd: Allow building ufetch without CONFIG_BLK
Date: Thu, 05 Dec 2024 19:35:34 +0100 [thread overview]
Message-ID: <20241205-ufetch-v1-2-df861318bd49@posteo.net> (raw)
In-Reply-To: <20241205-ufetch-v1-0-df861318bd49@posteo.net>
From: "J. Neuschäfer" <j.ne@posteo.net>
The ufetch command is still quite useful on systems without block
device support; remove the CONFIG_BLK dependency and make sure the code
compiles/works with and without CONFIG_BLK.
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
---
cmd/Kconfig | 1 -
cmd/ufetch.c | 10 +++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4936a70f3ef16ddb093ceafa12d011ca1b89e95c..547fd2a91f7883e2ae5982897ec93c4483d67852 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -178,7 +178,6 @@ config CMD_CPU
config CMD_UFETCH
bool "U-Boot fetch"
- depends on BLK
help
Fetch utility for U-Boot (akin to neofetch). Prints information
about U-Boot and the board it is running on in a pleasing format.
diff --git a/cmd/ufetch.c b/cmd/ufetch.c
index 5f3ef847b268dc384271fc6774720e5fd2337157..7aed0b447bda104b837d37c6adcbb21b80237aba 100644
--- a/cmd/ufetch.c
+++ b/cmd/ufetch.c
@@ -92,11 +92,9 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
int num_lines = max((size_t)LAST_LINE + 1, ARRAY_SIZE(logo_lines));
const char *model, *compatible;
char *ipaddr;
- int n_cmds, n_cpus = 0, ret, compatlen;
+ int n_cmds, n_cpus = 0, compatlen;
size_t size;
ofnode np;
- struct udevice *dev;
- struct blk_desc *desc;
bool skip_ascii = false;
if (argc > 1 && strcmp(argv[1], "-n") == 0) {
@@ -200,6 +198,11 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
break;
case STORAGE:
default:
+#ifdef CONFIG_BLK
+ struct udevice *dev;
+ struct blk_desc *desc;
+ int ret;
+
ret = uclass_find_device_by_seq(UCLASS_BLK, line - STORAGE, &dev);
if (!ret && dev) {
desc = dev_get_uclass_plat(dev);
@@ -213,6 +216,7 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
} else if (ret == -ENODEV && (skip_ascii || line > ARRAY_SIZE(logo_lines))) {
break;
}
+#endif
printf("\n");
}
}
--
2.45.2
next prev parent reply other threads:[~2024-12-05 23:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 18:35 [PATCH 0/3] cmd: ufetch improvements J. Neuschäfer via B4 Relay
2024-12-05 18:35 ` [PATCH 1/3] cmd: ufetch: Fix type mismatch on 32-bit J. Neuschäfer via B4 Relay
2024-12-09 14:58 ` Caleb Connolly
2024-12-05 18:35 ` J. Neuschäfer via B4 Relay [this message]
2024-12-09 15:04 ` [PATCH 2/3] cmd: Allow building ufetch without CONFIG_BLK Caleb Connolly
2024-12-09 16:51 ` J. Neuschäfer
2024-12-09 16:55 ` Caleb Connolly
2024-12-05 18:35 ` [PATCH 3/3] cmd: ufetch: Show CPU architecture under "CPU" J. Neuschäfer via B4 Relay
2024-12-09 15:09 ` Caleb Connolly
2024-12-09 16:58 ` J. Neuschäfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241205-ufetch-v1-2-df861318bd49@posteo.net \
--to=devnull+j.ne.posteo.net@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=j.ne@posteo.net \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox