Skip to contentSkip to conversation

net: fix register_netdev description

PATCH In review Ivan Safonov 2 participants 4 messages Oct 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: fix register_netdev description

register_netdev() does not expands the device name.

---
v2: Remove excessive blank line

 net/core/dev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/core/dev.c +2 -3
index cd479f5f22f6..861dbd6e46e8 100644
@@ -10611,9 +10611,8 @@ EXPORT_SYMBOL_GPL(init_dummy_netdev);
  *	chain. 0 is returned on success. A negative errno code is returned
  *	on a failure to set up the device, or if the name is a duplicate.
  *
- *	This is a wrapper around register_netdevice that takes the rtnl semaphore
- *	and expands the device name if you passed a format string to
- *	alloc_netdev.
+ *	This is a wrapper around register_netdevice that takes
+ *	the rtnl semaphore.
  */
 int register_netdev(struct net_device *dev)
 {
Signature · 1 line
2.44.2
#1 lore raw
Quoted 1 line · Ivan Safonov

register_netdev() does not expands the device name.

Please could you explain what makes you think it will not expand the device name.

Andrew

#2 lore raw
Quoted 7 lines · Andrew Lunn
Quoted 1 line · Ivan Safonov

register_netdev() does not expands the device name.

Please could you explain what makes you think it will not expand the device name.

Andrew

It is the register_netdev implementation:

Quoted 10 lines

int register_netdev(struct net_device *dev)

{
	int err;

	if (rtnl_lock_killable())
		return -EINTR;
	err = register_netdevice(dev);
	rtnl_unlock();
	return err;
}

There is no device name expansion, rtnl lock and register_netdevice call only. The register_netdevice expands device name using dev_get_valid_name().

#3 lore raw
Quoted 24 lines · Ivan Safonov
Quoted 7 lines · Andrew Lunn
Quoted 1 line · Ivan Safonov

register_netdev() does not expands the device name.

Please could you explain what makes you think it will not expand the device name.

Andrew

It is the register_netdev implementation:

Quoted 10 lines

int register_netdev(struct net_device *dev)

{
	int err;

	if (rtnl_lock_killable())
		return -EINTR;
	err = register_netdevice(dev);
	rtnl_unlock();
	return err;
}
Quoted 2 lines

There is no device name expansion, rtnl lock and register_netdevice call only. The register_netdevice expands device name using dev_get_valid_name().

* Take a completed network device structure and add it to the kernel
* interfaces. A %NETDEV_REGISTER message is sent to the netdev notifier
* chain. 0 is returned on success. A negative errno code is returned
* on a failure to set up the device, or if the name is a duplicate.
*
* This is a wrapper around register_netdevice that takes the rtnl semaphore
* and expands the device name if you passed a format string to
* alloc_netdev.

So you are taking this comment to mean the wrapper. Then yes, the wrapper does not expand the device nice. So please move the text about expanding the name earlier. It is an important part of registering a netdev, so should be mentioned.

Andrew

---
pw-bot: cr