summaryrefslogtreecommitdiff
path: root/cmd/ufetch.c
diff options
context:
space:
mode:
authorJ. Neuschäfer <j.ne@posteo.net>2024-12-11 23:25:26 +0100
committerCaleb Connolly <caleb.connolly@linaro.org>2025-01-22 16:43:54 +0100
commitc38d5bad35078c9e6c38f1c84b366fddd75af302 (patch)
tree2f54f93ffe0d013e8d5e900c5e11998965ef68f6 /cmd/ufetch.c
parente288366364c39f684a0c4a0ea9336f0873cb9b67 (diff)
cmd: Allow building ufetch without CONFIG_BLK
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. Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Signed-off-by: J. Neuschäfer <j.ne@posteo.net> Link: https://lore.kernel.org/r/20241211-ufetch-v2-2-2b5432ffaeb1@posteo.net Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Diffstat (limited to 'cmd/ufetch.c')
-rw-r--r--cmd/ufetch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd/ufetch.c b/cmd/ufetch.c
index 5f3ef847b26..83cec0f6d5c 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) {
@@ -199,7 +197,12 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
print_size(size, "\n");
break;
case STORAGE:
- default:
+ 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,8 +216,10 @@ 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");
}
+ }
}
printf(RESET "\n\n");