[U-Boot] [PATCH] bdinfo: Don't print IP or MAC addresses on boards without network support

Signed-off-by: Stefan Roese sr@denx.de --- common/cmd_bdinfo.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 11c1547..03ed594 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -93,6 +93,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) print_str ("pevfreq", strmhz(buf, bd->bi_pevfreq)); #endif
+#ifdef CONFIG_CMD_NET print_eth(0); #if defined(CONFIG_HAS_ETH1) print_eth(1); @@ -114,6 +115,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed)); #endif printf ("IP addr = %pI4\n", &bd->bi_ip_addr); +#endif /* CONFIG_CMD_NET */ printf ("baudrate = %6ld bps\n", bd->bi_baudrate ); return 0; } @@ -130,8 +132,10 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) print_num ("flashsize", (ulong)bd->bi_flashsize); print_num ("flashoffset", (ulong)bd->bi_flashoffset);
+#ifdef CONFIG_CMD_NET print_eth(0); printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); +#endif printf ("baudrate = %ld bps\n", bd->bi_baudrate);
return 0; @@ -288,8 +292,10 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) print_num("flashsize", (ulong)bd->bi_flashsize); print_num("flashoffset", (ulong)bd->bi_flashoffset);
+#ifdef CONFIG_CMD_NET print_eth(0); printf("ip_addr = %pI4\n", &bd->bi_ip_addr); +#endif printf("baudrate = %d bps\n", bd->bi_baudrate);
return 0; @@ -308,8 +314,10 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) print_num ("flashsize", (ulong)bd->bi_flashsize); print_num ("flashoffset", (ulong)bd->bi_flashoffset);
+#ifdef CONFIG_CMD_NET print_eth(0); printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); +#endif printf ("baudrate = %d bps\n", bd->bi_baudrate);
return 0;

Dear Stefan Roese,
In message 1261547803-11526-1-git-send-email-sr@denx.de you wrote:
Signed-off-by: Stefan Roese sr@denx.de
common/cmd_bdinfo.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
I don't consider this a good idea.
Please keep in mind that the "bdinfo" command is (or rather was) mainly intended for (old) PPC boards that pass hardware information to the Linux kernel by means of struct bd_info.
Even if you comment out printing of network related fields, these are still being passed to the kernel on such systems, so we should rather
1) make sure they are properly initialized in all cases (with well-defined dummy-values if no other values are present), 2) keep printing all fields actually passed to the Linux kernel, and in the right order, as was the intention of this command.
Also, I disagree with this change as you are exporting U-Boot settings to Linux, which is IMHO not always correct. There might be cases where you don't have network support in U-Boot, but the Linux kernel might have it, and you want to pass network configuration parameters even if they are unused in U-Boot (consider for example the case where U-Boot has no network driver yet).
Thinking about this again, I tend to reject _both_ your patches.
Best regards,
Wolfgang Denk
participants (2)
-
Stefan Roese
-
Wolfgang Denk