Message ID | 20200504231732.98778-18-sjg@chromium.org |
---|---|
State | Superseded |
Headers | show |
Series | Tidy up the 'bd' command. | expand |
Hi Simon, On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg at chromium.org> wrote: > > This code pre-dates driver model and the migration date is nearly upon us. > Pare the print_eths() function down and enable it for driver model, since > it works correctly. > > The IP address is already printed in print_eth_ip_addr() so we can remove > that. > > Signed-off-by: Simon Glass <sjg at chromium.org> > --- > > cmd/bdinfo.c | 21 ++------------------- > 1 file changed, 2 insertions(+), 19 deletions(-) > > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c > index 6fa8b32389..ba69575fc2 100644 > --- a/cmd/bdinfo.c > +++ b/cmd/bdinfo.c > @@ -34,26 +34,10 @@ static void print_eth(int idx) > printf("%-12s= %s\n", name, val); > } > > -#ifndef CONFIG_DM_ETH > -__maybe_unused > static void print_eths(void) > { > - struct eth_device *dev; > - int i = 0; > - > - do { > - dev = eth_get_dev_by_index(i); > - if (dev) { > - printf("eth%dname = %s\n", i, dev->name); > - print_eth(i); > - i++; > - } > - } while (dev); > - > printf("current eth = %s\n", eth_get_name()); Now this is an one-line function. Should we inline it? > - printf("ip_addr = %s\n", env_get("ipaddr")); > } > -#endif > > static void print_lnum(const char *name, unsigned long long value) > { > @@ -116,9 +100,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) > print_num("relocaddr", gd->relocaddr); > print_num("reloc off", gd->reloc_off); > printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); > -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) > - print_eths(); > -#endif > + if (IS_ENABLED(CONFIG_CMD_NET)) > + print_eths(); > print_num("fdt_blob", (ulong)gd->fdt_blob); > print_num("new_fdt", (ulong)gd->new_fdt); > print_num("fdt_size", (ulong)gd->fdt_size); > -- Regards, Bin
Hi Bin, On Wed, 6 May 2020 at 02:10, Bin Meng <bmeng.cn at gmail.com> wrote: > > Hi Simon, > > On Tue, May 5, 2020 at 7:19 AM Simon Glass <sjg at chromium.org> wrote: > > > > This code pre-dates driver model and the migration date is nearly upon us. > > Pare the print_eths() function down and enable it for driver model, since > > it works correctly. > > > > The IP address is already printed in print_eth_ip_addr() so we can remove > > that. > > > > Signed-off-by: Simon Glass <sjg at chromium.org> > > --- > > > > cmd/bdinfo.c | 21 ++------------------- > > 1 file changed, 2 insertions(+), 19 deletions(-) > > > > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c > > index 6fa8b32389..ba69575fc2 100644 > > --- a/cmd/bdinfo.c > > +++ b/cmd/bdinfo.c > > @@ -34,26 +34,10 @@ static void print_eth(int idx) > > printf("%-12s= %s\n", name, val); > > } > > > > -#ifndef CONFIG_DM_ETH > > -__maybe_unused > > static void print_eths(void) > > { > > - struct eth_device *dev; > > - int i = 0; > > - > > - do { > > - dev = eth_get_dev_by_index(i); > > - if (dev) { > > - printf("eth%dname = %s\n", i, dev->name); > > - print_eth(i); > > - i++; > > - } > > - } while (dev); > > - > > printf("current eth = %s\n", eth_get_name()); > > Now this is an one-line function. Should we inline it? Yes it goes away in a later commit. Trying to avoid too much confusing for reviewers. Regards. Simon
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 6fa8b32389..ba69575fc2 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -34,26 +34,10 @@ static void print_eth(int idx) printf("%-12s= %s\n", name, val); } -#ifndef CONFIG_DM_ETH -__maybe_unused static void print_eths(void) { - struct eth_device *dev; - int i = 0; - - do { - dev = eth_get_dev_by_index(i); - if (dev) { - printf("eth%dname = %s\n", i, dev->name); - print_eth(i); - i++; - } - } while (dev); - printf("current eth = %s\n", eth_get_name()); - printf("ip_addr = %s\n", env_get("ipaddr")); } -#endif static void print_lnum(const char *name, unsigned long long value) { @@ -116,9 +100,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) - print_eths(); -#endif + if (IS_ENABLED(CONFIG_CMD_NET)) + print_eths(); print_num("fdt_blob", (ulong)gd->fdt_blob); print_num("new_fdt", (ulong)gd->new_fdt); print_num("fdt_size", (ulong)gd->fdt_size);
This code pre-dates driver model and the migration date is nearly upon us. Pare the print_eths() function down and enable it for driver model, since it works correctly. The IP address is already printed in print_eth_ip_addr() so we can remove that. Signed-off-by: Simon Glass <sjg at chromium.org> --- cmd/bdinfo.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)