[PATCH 2/3] net: use dev_alloc_name_ns instead of dev_get_valid_name
From: Rasmus Villemoes
Date: Mon Nov 20 2017 - 19:35:55 EST
The latter is simply a wrapper for the former; no need to keep both, so
call dev_alloc_name_ns directly.
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
drivers/net/tun.c | 2 +-
net/core/dev.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6bb1e604aadd..849a95505f80 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2253,7 +2253,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
if (!dev)
return -ENOMEM;
- err = dev_get_valid_name(net, dev, name);
+ err = dev_alloc_name_ns(net, dev, name);
if (err < 0)
goto err_free_dev;
diff --git a/net/core/dev.c b/net/core/dev.c
index 9575e7329823..0de42f39d280 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1183,7 +1183,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
memcpy(oldname, dev->name, IFNAMSIZ);
- err = dev_get_valid_name(net, dev, newname);
+ err = dev_alloc_name_ns(net, dev, newname);
if (err < 0) {
write_seqcount_end(&devnet_rename_seq);
return err;
@@ -7615,7 +7615,7 @@ int register_netdevice(struct net_device *dev)
spin_lock_init(&dev->addr_list_lock);
netdev_set_addr_lockdep_class(dev);
- ret = dev_get_valid_name(net, dev, dev->name);
+ ret = dev_alloc_name_ns(net, dev, dev->name);
if (ret < 0)
goto out;
@@ -8354,7 +8354,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
/* We get here if we can't use the current device name */
if (!pat)
goto out;
- if (dev_get_valid_name(net, dev, pat) < 0)
+ if (dev_alloc_name_ns(net, dev, pat) < 0)
goto out;
}
--
2.11.0