Skip to contentSkip to conversation

cmd: ufetch: print Net feature when NET_LWIP=y, prettyfy if NET=n

PATCH Applied Quentin Schulz 3 participants 6 messages May 5

lore
Share & tools
lore
#0 lore raw

v3 cover cmd: ufetch: print Net feature when NET_LWIP=y, prettyfy if NET=n

Make sure the Net feature is printed when NET_LWIP is enabled, not only when NET_LEGACY is.

Only print comma and following whitespace as separator if there was a feature printed before feature to be printed.

---
Changes in v3:
- migrated from bool plus ternary operator for setting the separator per printf to a const char* which contains the separator to print, as suggested by Simon,
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- added R-b trailers,
- fixed spurious colon character before separator in cat,
- Link to v1: https://patch.msgid.link/[email protected]

---
Quentin Schulz (2):
cmd: ufetch: show net feature when NET_LWIP is selected
cmd: ufetch: only show comma separator if there was a previous feature

 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

---
base-commit: 57460fde4ba84d67de4066ee1141e89e8139ed23
change-id: 20260428-ufetch-net-1ba7553a20c7

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

PATCH v3 1/2 cmd: ufetch: show net feature when NET_LWIP is selected

From: Quentin Schulz <[email protected]>

We've had a new lwIP networking stack for a couple of years already, so let's show there is a "net" feature if it's selected. Since NET_LEGACY || NET_LWIP is the same as NET, let's check on NET.

---
 cmd/ufetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/ufetch.c +1 -1
index f8dc904bdd0..bc5db08eee1 100644
@@ -159,7 +159,7 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
 			break;
 		case FEATURES:
 			printf("Features:" RESET " ");
-			if (IS_ENABLED(CONFIG_NET_LEGACY))
+			if (IS_ENABLED(CONFIG_NET))
 				printf("Net");
 			if (IS_ENABLED(CONFIG_EFI_LOADER))
 				printf(", EFI");
Signature · 1 line
2.54.0
#2 lore raw

PATCH v3 2/2 cmd: ufetch: only show comma separator if there was a previous feature

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

Currently, if NET is disabled, the next feature to be printed will start with a comma and a space which is not pretty. Add the comma and whitespace only when a previous feature has already been shown.

---
 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
cmd/ufetch.c +20 -9
index bc5db08eee1..e7b5d773f5e 100644
@@ -157,26 +157,37 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
 				printf(" (%d baud)", gd->baudrate);
 			putc('\n');
 			break;
-		case FEATURES:
+		case FEATURES: {
+			const char *sep = "";
+
 			printf("Features:" RESET " ");
-			if (IS_ENABLED(CONFIG_NET))
-				printf("Net");
-			if (IS_ENABLED(CONFIG_EFI_LOADER))
-				printf(", EFI");
-			if (IS_ENABLED(CONFIG_CMD_CAT))
-				printf(", cat :3");
+			if (IS_ENABLED(CONFIG_NET)) {
+				printf("%sNet", sep);
+				sep = ", ";
+			}
+			if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+				printf("%sEFI", sep);
+				sep = ", ";
+			}
+			if (IS_ENABLED(CONFIG_CMD_CAT)) {
+				printf("%scat :3", sep);
+				sep = ", ";
+			}
 #ifdef CONFIG_ARM64
 			switch (current_el()) {
 			case 2:
-				printf(", VMs");
+				printf("%sVMs", sep);
+				sep = ", ";
 				break;
 			case 3:
-				printf(", full control!");
+				printf("%sfull control!", sep);
+				sep = ", ";
 				break;
 			}
 #endif
 			printf("\n");
 			break;
+		}
 		case RELOCATION:
 			if (gd->flags & GD_FLG_SKIP_RELOC)
 				printf("Relocated:" RESET " no\n");
Signature · 1 line
2.54.0
Reviewed-by on v3 2/2
#3 lore raw

Re: [PATCH v3 2/2] cmd: ufetch: only show comma separator if there was a previous feature

Quoted 10 lines · Quentin Schulz

cmd: ufetch: only show comma separator if there was a previous feature

Currently, if NET is disabled, the next feature to be printed will start with a comma and a space which is not pretty. Add the comma and whitespace only when a previous feature has already been shown.

cmd/ufetch.c | 29 ++++++++++++++++++++---------

 1 file changed, 20 insertions(+), 9 deletions(-)
Reviewed-by on the v3 series
#4 lore raw
In reply to Quentin Schulz
Quoted 7 lines · Quentin Schulz

Make sure the Net feature is printed when NET_LWIP is enabled, not only when NET_LEGACY is.

Only print comma and following whitespace as separator if there was a feature printed before feature to be printed.

Quoted 27 lines

---
Changes in v3:
- migrated from bool plus ternary operator for setting the separator per printf to a const char* which contains the separator to print, as suggested by Simon,
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- added R-b trailers,
- fixed spurious colon character before separator in cat,
- Link to v1: https://patch.msgid.link/[email protected]

---
Quentin Schulz (2):
cmd: ufetch: show net feature when NET_LWIP is selected
cmd: ufetch: only show comma separator if there was a previous feature

 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

---
base-commit: 57460fde4ba84d67de4066ee1141e89e8139ed23
change-id: 20260428-ufetch-net-1ba7553a20c7

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
Signature · 1 line
// Casey (she/her)
#5 lore raw
In reply to Quentin Schulz
Quoted 8 lines · Quentin Schulz

Make sure the Net feature is printed when NET_LWIP is enabled, not only when NET_LEGACY is.

Only print comma and following whitespace as separator if there was a feature printed before feature to be printed.

[...]

Applied, thanks!

[1/2] cmd: ufetch: show net feature when NET_LWIP is selected

      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/b586802913b4

[2/2] cmd: ufetch: only show comma separator if there was a previous feature
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/b61bf7f71dfa

Best regards,

Signature · 1 line
// Casey (she/they)