Re: [PATCH net-next v2 06/10] devlink: add devlink_dev_driver_name() helper and use it in trace events

From
Jiri Pirko <jiri@resnulli.us>
Date
2026-03-02 09:44:18
Also in
linux-doc, linux-rdma, netdev
Reply to
Jakub Kicinski, 2026-02-28
Sat, Feb 28, 2026 at 11:58:05PM +0100, kuba@kernel.org wrote:
On Wed, 25 Feb 2026 14:34:18 +0100 Jiri Pirko wrote:
quoted
+const char *devlink_dev_driver_name(const struct devlink *devlink)
+{
+	struct device *dev = devlink->dev;
+
+	return dev ? dev->driver->name : NULL;
+}
+EXPORT_SYMBOL_GPL(devlink_dev_driver_name);
You say we need this in prep for shared instances, which is fair, but
shared instances should presumably share across the same driver, most
of the time? So perhaps we should do a similar thing here as you did to
the bus/dev name? Maybe when shared instance is allocated:

devlink->driver_name = kasprintf("%s+", dev->driver);

And then:

+const char *devlink_dev_driver_name(const struct devlink *devlink)
+{
+	struct device *dev = devlink->dev;
+
+	return dev ? dev->driver->name : devlink->driver_name;
+}
+EXPORT_SYMBOL_GPL(devlink_dev_driver_name);

?
Good idea. Will add is in some form.
Thread (21 messages) 21 messages, 2 authors, last reply 2026-03-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help