From: Max Filippov <jcmvbkbc@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/7] cmd/bdinfo: extract print_eth_ip_addr
Date: Thu, 28 Jul 2016 03:57:22 +0300 [thread overview]
Message-ID: <1469667444-4686-6-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1469667444-4686-1-git-send-email-jcmvbkbc@gmail.com>
print_eth_ip_addr outputs eth configurations for up to 6 interfaces and
configured IP address.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
cmd/bdinfo.c | 113 +++++++++++++++++++----------------------------------------
1 file changed, 36 insertions(+), 77 deletions(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0bef930..4ffb757 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -123,6 +123,29 @@ static inline void print_bi_flash(const bd_t *bd)
#endif
}
+static inline void print_eth_ip_addr(void)
+{
+#if defined(CONFIG_CMD_NET)
+ print_eth(0);
+#if defined(CONFIG_HAS_ETH1)
+ print_eth(1);
+#endif
+#if defined(CONFIG_HAS_ETH2)
+ print_eth(2);
+#endif
+#if defined(CONFIG_HAS_ETH3)
+ print_eth(3);
+#endif
+#if defined(CONFIG_HAS_ETH4)
+ print_eth(4);
+#endif
+#if defined(CONFIG_HAS_ETH5)
+ print_eth(5);
+#endif
+ printf("IP addr = %s\n", getenv("ipaddr"));
+#endif
+}
+
#if defined(CONFIG_PPC)
void __weak board_detail(void)
{
@@ -180,24 +203,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
#endif
- print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
- print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
- print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
- print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
- print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
- print_eth(5);
-#endif
-
- printf("IP addr = %s\n", getenv("ipaddr"));
+ print_eth_ip_addr();
printf("baudrate = %6u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
board_detail();
@@ -218,11 +224,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num ("sram size", (ulong)bd->bi_sramsize);
#endif
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
-
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -278,10 +280,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%x (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
GENERATED_GBL_DATA_SIZE);
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
+ print_eth_ip_addr();
printf("baudrate = %6u bps\n", gd->baudrate);
return 0;
}
@@ -311,20 +310,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_mhz("inpfreq", bd->bi_inpfreq);
print_mhz("vcofreq", bd->bi_vcofreq);
#endif
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
- print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
- print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
- print_eth(3);
-#endif
-
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -346,9 +332,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_boot_params(bd);
print_bi_mem(bd);
print_bi_flash(bd);
-
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -363,9 +347,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_boot_params(bd);
print_bi_mem(bd);
print_bi_flash(bd);
-
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
@@ -382,9 +364,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_boot_params(bd);
print_bi_mem(bd);
print_bi_flash(bd);
-
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -444,11 +424,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_mem(bd);
print_bi_flash(bd);
-
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
}
@@ -474,8 +450,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_dram(bd);
#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
+ print_eth_ip_addr();
print_mhz("ethspeed", bd->bi_ethspeed);
#endif
printf("baudrate = %u bps\n", gd->baudrate);
@@ -491,11 +466,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_boot_params(bd);
print_bi_dram(bd);
+ print_eth_ip_addr();
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
print_num("FB base ", gd->fb_base);
#endif
@@ -511,11 +483,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("arch_number", bd->bi_arch_number);
print_bi_boot_params(bd);
print_bi_dram(bd);
-
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -529,12 +497,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_mem(bd);
print_bi_flash(bd);
-
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
-
+ print_eth_ip_addr();
printf("baudrate = %u bps\n", gd->baudrate);
return 0;
@@ -547,11 +510,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
bd_t *bd = gd->bd;
print_bi_mem(bd);
-
-#if defined(CONFIG_CMD_NET)
- print_eth(0);
- printf("ip_addr = %s\n", getenv("ipaddr"));
-#endif
+ print_eth_ip_addr();
printf("baudrate = %d bps\n", gd->baudrate);
return 0;
--
2.1.4
next prev parent reply other threads:[~2016-07-28 0:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 0:57 [U-Boot] [PATCH v2 0/7] cmd/bdinfo: extract common parts and reuse them Max Filippov
2016-07-28 0:57 ` [U-Boot] [PATCH v2 1/7] cmd/bdinfo: extract print_bi_boot_params Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:02 ` Simon Glass
2016-08-06 0:59 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-07-28 0:57 ` [U-Boot] [PATCH v2 2/7] cmd/bdinfo: extract print_bi_mem Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:02 ` Simon Glass
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,2/7] " Tom Rini
2016-07-28 0:57 ` [U-Boot] [PATCH v2 3/7] cmd/bdinfo: extract print_bi_dram Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:02 ` Simon Glass
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,3/7] " Tom Rini
2016-07-28 0:57 ` [U-Boot] [PATCH v2 4/7] cmd/bdinfo: extract print_bi_flash Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:03 ` Simon Glass
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,4/7] " Tom Rini
2016-07-28 0:57 ` Max Filippov [this message]
2016-07-29 13:29 ` [U-Boot] [PATCH v2 5/7] cmd/bdinfo: extract print_eth_ip_addr Tom Rini
2016-08-01 1:03 ` Simon Glass
2016-08-04 16:59 ` Joe Hershberger
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,5/7] " Tom Rini
2016-07-28 0:57 ` [U-Boot] [PATCH v2 6/7] cmd/bdinfo: extract print_baudrate Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:03 ` Simon Glass
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,6/7] " Tom Rini
2016-07-28 0:57 ` [U-Boot] [PATCH v2 7/7] cmd/bdinfo: extract print_std_bdinfo Max Filippov
2016-07-29 13:29 ` Tom Rini
2016-08-01 1:03 ` Simon Glass
2016-08-01 1:10 ` Max Filippov
2016-08-01 21:11 ` Tom Rini
2016-08-06 0:59 ` [U-Boot] [U-Boot,v2,7/7] " Tom Rini
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=1469667444-4686-6-git-send-email-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.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