mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
To: Jon Hunter <jonathanh@nvidia.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_ether: Don't warn in gether_setup_name_default()
Date: Tue, 10 Jan 2023 17:31:30 +0100	[thread overview]
Message-ID: <87cab5a1-a122-2b10-43b4-7a5819ff55ef@collabora.com> (raw)
In-Reply-To: <20230106161759.66019-1-jonathanh@nvidia.com>

Hi,

Hasn't there been a similar patch already?

W dniu 6.01.2023 o 17:17, Jon Hunter pisze:
> The function gether_setup_name_default() is called by various USB
> ethernet gadget drivers. This function always generates the MAC address
> for the ethernet gadget device and always prints a warning when
> generating the MAC address. Given that these messages are expected, make
> these prints informational instead of warnings.
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>   drivers/usb/gadget/function/u_ether.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
> index 8f12f3f8f6ee..c19d66cd1446 100644
> --- a/drivers/usb/gadget/function/u_ether.c
> +++ b/drivers/usb/gadget/function/u_ether.c
> @@ -845,13 +845,13 @@ struct net_device *gether_setup_name_default(const char *netname)
>   	snprintf(net->name, sizeof(net->name), "%s%%d", netname);
>   
>   	eth_random_addr(dev->dev_mac);
> -	pr_warn("using random %s ethernet address\n", "self");
> +	pr_info("using random %s ethernet address\n", "self");

As far as I can tell this function is called by all Ethernet gadgets,
and using random Ethernet addresses is the default behavior for all of them,
including legacy gadgets. Why to inform about the default situation happening?
So in fact maybe it would be better to eliminate the pr_warn() altogether,
instead of replacing it with pr_info()? If the user does not care to
explicitly set some non-default address(es), why would she care to know
that a randomly selected address has been chosen? Note that learning
_what_ specific address has been chosen is perfectly doable without
these pr_info() calls.

Regards,

Andrzej

>   
>   	/* by default we always have a random MAC address */
>   	net->addr_assign_type = NET_ADDR_RANDOM;
>   
>   	eth_random_addr(dev->host_mac);
> -	pr_warn("using random %s ethernet address\n", "host");
> +	pr_info("using random %s ethernet address\n", "host");
>   
>   	net->netdev_ops = &eth_netdev_ops;
>   


  reply	other threads:[~2023-01-10 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 16:17 Jon Hunter
2023-01-10 16:31 ` Andrzej Pietrasiewicz [this message]
2023-01-11 10:35   ` Jon Hunter
2023-01-11 11:24     ` Andrzej Pietrasiewicz

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=87cab5a1-a122-2b10-43b4-7a5819ff55ef@collabora.com \
    --to=andrzej.p@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®