Subject: Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits

From: Jakub Kicinski <[email-masked]>
Date: Thu, 10 Nov 2022 08:59:07 -0800

On Thu, 10 Nov 2022 17:34:55 +0900 Vincent MAILHOL wrote:
> > While I'm typing - I've used dev_driver_string() to get the driver
> > name in the past. Perhaps something to consider?  
> 
> I am not sure of that one. If dev->dev.parent->driver is not set, it
> defaults to dev_bus_name() which is .bus_info, isn't it?
> https://elixir.bootlin.com/linux/latest/source/drivers/base/core.c#L2181

I don't think so?  We put dev_name() into bus_info, which is usually
the address of the device on the bus (e.g. (D)BDF for PCI, like
0000:00:14.3). The name of the bus is pci. dev_driver_string() will
also fall back to printing class name.

>  For the end user, it might be better to display an empty driver name
> in 'ethtool -i' rather than reporting the bus_info twice?
> 
> I mean, if you ask me for my opinion, then my answer is "I am not
> sure". If you have confidence that dev_driver_string() is better, then
> I will send a v2 right away.

Well, it doesn't matter. I asked because handful of popular drivers 
use dev_driver_string(). But.. these are drivers so parent->driver 
will be set and it ends up not making any difference.