[U-Boot] [PATCHv2 03/21] net: core: Inform the user of the device MAC address

Simon Glass sjg at chromium.org
Sat Apr 15 23:39:43 UTC 2017


Hi Oliver,

On 10 April 2017 at 09:33, Olliver Schinagl <oliver at schinagl.nl> wrote:
> In certain conditions we currently print the MAC address. For example a
> warning when a random mac address is in use or a missmatch between HW
> and ENV.
>
> If all things went well however (but even if there is a miss-match) we
> do not inform the user what the final MAC address of the device is.
>
> Lets print the final MAC address of the device with which it has been
> setup.
>
> Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
> ---
>  net/eth-uclass.c | 9 ++++++---
>  net/eth_legacy.c | 3 +++
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index c3cc3152a2..781376955a 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -413,11 +413,12 @@ int eth_initialize(void)
>                 }
>
>                 bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
> +               putc('\n');
>                 do {
> -                       if (num_devices)
> -                               printf(", ");
> +                       struct eth_pdata *pdata = dev->platdata;
>
> -                       printf("eth%d: %s", dev->seq, dev->name);
> +                       printf("eth%d:  %s [%pM]\n", dev->seq, dev->name,
> +                                                    pdata->enetaddr);
>
>                         if (ethprime && dev == prime_dev)
>                                 printf(" [PRIME]");
> @@ -525,6 +526,8 @@ static int eth_post_probe(struct udevice *dev)
>  #endif
>         }
>
> +       printf("%s ", dev->name);
> +
>         return 0;
>  }
>
> diff --git a/net/eth_legacy.c b/net/eth_legacy.c
> index e4bd0f4c1a..687763682a 100644
> --- a/net/eth_legacy.c
> +++ b/net/eth_legacy.c
> @@ -179,6 +179,9 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
>                                dev->name);
>         }
>
> +       printf("%s (eth%d) has MAC address: %pM\n",
> +              dev->name, eth_number, dev->enetaddr);

As a general rule I don't think we should be adding new features to
legacy code. If people want the new features they can switch over to
driver model.

Regards,
Simon


More information about the U-Boot mailing list