aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee802154/fakehard.c10
-rw-r--r--drivers/net/bonding/bond_main.c21
-rw-r--r--drivers/net/dummy.c4
-rw-r--r--drivers/net/hamradio/bpqether.c4
-rw-r--r--drivers/net/ifb.c4
-rw-r--r--drivers/net/tun.c6
-rw-r--r--drivers/net/wan/dlci.c4
-rw-r--r--drivers/net/wan/hdlc_fr.c9
-rw-r--r--drivers/net/wan/lapbether.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c7
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c11
-rw-r--r--drivers/net/wireless/mwifiex/main.c4
-rw-r--r--drivers/s390/net/netiucv.c2
-rw-r--r--net/core/dev.c24
-rw-r--r--net/core/rtnetlink.c8
-rw-r--r--net/ipv4/ip_gre.c5
-rw-r--r--net/ipv4/ipip.c5
-rw-r--r--net/ipv6/ip6_tunnel.c5
-rw-r--r--net/ipv6/sit.c5
-rw-r--r--net/mac80211/iface.c4
20 files changed, 12 insertions, 134 deletions
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index d9d0e13efe47..a5a49a1baae7 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -393,16 +393,6 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
393 priv = netdev_priv(dev); 393 priv = netdev_priv(dev);
394 priv->phy = phy; 394 priv->phy = phy;
395 395
396 /*
397 * If the name is a format string the caller wants us to do a
398 * name allocation.
399 */
400 if (strchr(dev->name, '%')) {
401 err = dev_alloc_name(dev, dev->name);
402 if (err < 0)
403 goto out;
404 }
405
406 wpan_phy_set_dev(phy, &pdev->dev); 396 wpan_phy_set_dev(phy, &pdev->dev);
407 SET_NETDEV_DEV(dev, &phy->dev); 397 SET_NETDEV_DEV(dev, &phy->dev);
408 398
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 22bd03bd1d35..9a5feaf4bab9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4917,8 +4917,9 @@ int bond_create(struct net *net, const char *name)
4917 4917
4918 rtnl_lock(); 4918 rtnl_lock();
4919 4919
4920 bond_dev = alloc_netdev_mq(sizeof(struct bonding), name ? name : "", 4920 bond_dev = alloc_netdev_mq(sizeof(struct bonding),
4921 bond_setup, tx_queues); 4921 name ? name : "bond%d",
4922 bond_setup, tx_queues);
4922 if (!bond_dev) { 4923 if (!bond_dev) {
4923 pr_err("%s: eek! can't alloc netdev!\n", name); 4924 pr_err("%s: eek! can't alloc netdev!\n", name);
4924 rtnl_unlock(); 4925 rtnl_unlock();
@@ -4928,26 +4929,10 @@ int bond_create(struct net *net, const char *name)
4928 dev_net_set(bond_dev, net); 4929 dev_net_set(bond_dev, net);
4929 bond_dev->rtnl_link_ops = &bond_link_ops; 4930 bond_dev->rtnl_link_ops = &bond_link_ops;
4930 4931
4931 if (!name) {
4932 res = dev_alloc_name(bond_dev, "bond%d");
4933 if (res < 0)
4934 goto out;
4935 } else {
4936 /*
4937 * If we're given a name to register
4938 * we need to ensure that its not already
4939 * registered
4940 */
4941 res = -EEXIST;
4942 if (__dev_get_by_name(net, name) != NULL)
4943 goto out;
4944 }
4945
4946 res = register_netdevice(bond_dev); 4932 res = register_netdevice(bond_dev);
4947 4933
4948 netif_carrier_off(bond_dev); 4934 netif_carrier_off(bond_dev);
4949 4935
4950out:
4951 rtnl_unlock(); 4936 rtnl_unlock();
4952 if (res < 0) 4937 if (res < 0)
4953 bond_destructor(bond_dev); 4938 bond_destructor(bond_dev);
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index ff2d29b17858..39cf9b9bd673 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -168,10 +168,6 @@ static int __init dummy_init_one(void)
168 if (!dev_dummy) 168 if (!dev_dummy)
169 return -ENOMEM; 169 return -ENOMEM;
170 170
171 err = dev_alloc_name(dev_dummy, dev_dummy->name);
172 if (err < 0)
173 goto err;
174
175 dev_dummy->rtnl_link_ops = &dummy_link_ops; 171 dev_dummy->rtnl_link_ops = &dummy_link_ops;
176 err = register_netdevice(dev_dummy); 172 err = register_netdevice(dev_dummy);
177 if (err < 0) 173 if (err < 0)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 8931168d3e74..18d8affecd1b 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -516,10 +516,6 @@ static int bpq_new_device(struct net_device *edev)
516 memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr)); 516 memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
517 memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr)); 517 memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
518 518
519 err = dev_alloc_name(ndev, ndev->name);
520 if (err < 0)
521 goto error;
522
523 err = register_netdevice(ndev); 519 err = register_netdevice(ndev);
524 if (err) 520 if (err)
525 goto error; 521 goto error;
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index e07d487f015a..4fecaed67fc4 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -233,10 +233,6 @@ static int __init ifb_init_one(int index)
233 if (!dev_ifb) 233 if (!dev_ifb)
234 return -ENOMEM; 234 return -ENOMEM;
235 235
236 err = dev_alloc_name(dev_ifb, dev_ifb->name);
237 if (err < 0)
238 goto err;
239
240 dev_ifb->rtnl_link_ops = &ifb_link_ops; 236 dev_ifb->rtnl_link_ops = &ifb_link_ops;
241 err = register_netdevice(dev_ifb); 237 err = register_netdevice(dev_ifb);
242 if (err < 0) 238 if (err < 0)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 0636f7040325..74e94054ab1a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1099,12 +1099,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1099 1099
1100 tun_net_init(dev); 1100 tun_net_init(dev);
1101 1101
1102 if (strchr(dev->name, '%')) {
1103 err = dev_alloc_name(dev, dev->name);
1104 if (err < 0)
1105 goto err_free_sk;
1106 }
1107
1108 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | 1102 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
1109 TUN_USER_FEATURES; 1103 TUN_USER_FEATURES;
1110 dev->features = dev->hw_features; 1104 dev->features = dev->hw_features;
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 1481a446fefb..21b104db5a90 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -341,10 +341,6 @@ static int dlci_add(struct dlci_add *dlci)
341 } 341 }
342 } 342 }
343 343
344 err = dev_alloc_name(master, master->name);
345 if (err < 0)
346 goto err2;
347
348 *(short *)(master->dev_addr) = dlci->dlci; 344 *(short *)(master->dev_addr) = dlci->dlci;
349 345
350 dlp = netdev_priv(master); 346 dlp = netdev_priv(master);
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 0edb535bb2b5..fc433f28c047 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -1070,7 +1070,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1070 hdlc_device *hdlc = dev_to_hdlc(frad); 1070 hdlc_device *hdlc = dev_to_hdlc(frad);
1071 pvc_device *pvc; 1071 pvc_device *pvc;
1072 struct net_device *dev; 1072 struct net_device *dev;
1073 int result, used; 1073 int used;
1074 1074
1075 if ((pvc = add_pvc(frad, dlci)) == NULL) { 1075 if ((pvc = add_pvc(frad, dlci)) == NULL) {
1076 printk(KERN_WARNING "%s: Memory squeeze on fr_add_pvc()\n", 1076 printk(KERN_WARNING "%s: Memory squeeze on fr_add_pvc()\n",
@@ -1106,13 +1106,6 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1106 dev->tx_queue_len = 0; 1106 dev->tx_queue_len = 0;
1107 dev->ml_priv = pvc; 1107 dev->ml_priv = pvc;
1108 1108
1109 result = dev_alloc_name(dev, dev->name);
1110 if (result < 0) {
1111 free_netdev(dev);
1112 delete_unused_pvcs(hdlc);
1113 return result;
1114 }
1115
1116 if (register_netdevice(dev) != 0) { 1109 if (register_netdevice(dev) != 0) {
1117 free_netdev(dev); 1110 free_netdev(dev);
1118 delete_unused_pvcs(hdlc); 1111 delete_unused_pvcs(hdlc);
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 7f5bb913c8b9..eec463f99c09 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -338,10 +338,6 @@ static int lapbeth_new_device(struct net_device *dev)
338 dev_hold(dev); 338 dev_hold(dev);
339 lapbeth->ethdev = dev; 339 lapbeth->ethdev = dev;
340 340
341 rc = dev_alloc_name(ndev, ndev->name);
342 if (rc < 0)
343 goto fail;
344
345 rc = -EIO; 341 rc = -EIO;
346 if (register_netdevice(ndev)) 342 if (register_netdevice(ndev))
347 goto fail; 343 goto fail;
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 1d9aed645723..d5084829c9e5 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -79,13 +79,8 @@ struct net_device * hostap_add_interface(struct local_info *local,
79 if (!rtnl_locked) 79 if (!rtnl_locked)
80 rtnl_lock(); 80 rtnl_lock();
81 81
82 ret = 0;
83 if (strchr(dev->name, '%'))
84 ret = dev_alloc_name(dev, dev->name);
85
86 SET_NETDEV_DEV(dev, mdev->dev.parent); 82 SET_NETDEV_DEV(dev, mdev->dev.parent);
87 if (ret >= 0) 83 ret = register_netdevice(dev);
88 ret = register_netdevice(dev);
89 84
90 if (!rtnl_locked) 85 if (!rtnl_locked)
91 rtnl_unlock(); 86 rtnl_unlock();
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index f4f4257a9d67..9d4a40ee16c4 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1515,19 +1515,10 @@ static int __init init_mac80211_hwsim(void)
1515 if (hwsim_mon == NULL) 1515 if (hwsim_mon == NULL)
1516 goto failed; 1516 goto failed;
1517 1517
1518 rtnl_lock(); 1518 err = register_netdev(hwsim_mon);
1519
1520 err = dev_alloc_name(hwsim_mon, hwsim_mon->name);
1521 if (err < 0) 1519 if (err < 0)
1522 goto failed_mon; 1520 goto failed_mon;
1523 1521
1524
1525 err = register_netdevice(hwsim_mon);
1526 if (err < 0)
1527 goto failed_mon;
1528
1529 rtnl_unlock();
1530
1531 return 0; 1522 return 0;
1532 1523
1533failed_mon: 1524failed_mon:
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index c5971880e7b3..d16cea770fa3 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -706,10 +706,6 @@ static struct mwifiex_private *mwifiex_add_interface(
706 dev_err(adapter->dev, "no memory available for netdevice\n"); 706 dev_err(adapter->dev, "no memory available for netdevice\n");
707 goto error; 707 goto error;
708 } 708 }
709 if (dev_alloc_name(dev, dev->name)) {
710 dev_err(adapter->dev, "unable to alloc name for netdevice\n");
711 goto error;
712 }
713 709
714 if (mwifiex_register_cfg80211(dev, adapter->priv[bss_index]->curr_addr, 710 if (mwifiex_register_cfg80211(dev, adapter->priv[bss_index]->curr_addr,
715 adapter->priv[bss_index]) != 0) { 711 adapter->priv[bss_index]) != 0) {
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index b6a6356d09b3..3251333a23df 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1994,8 +1994,6 @@ static struct net_device *netiucv_init_netdevice(char *username)
1994 netiucv_setup_netdevice); 1994 netiucv_setup_netdevice);
1995 if (!dev) 1995 if (!dev)
1996 return NULL; 1996 return NULL;
1997 if (dev_alloc_name(dev, dev->name) < 0)
1998 goto out_netdev;
1999 1997
2000 privptr = netdev_priv(dev); 1998 privptr = netdev_priv(dev);
2001 privptr->fsm = init_fsm("netiucvdev", dev_state_names, 1999 privptr->fsm = init_fsm("netiucvdev", dev_state_names,
diff --git a/net/core/dev.c b/net/core/dev.c
index e95dc30110eb..3b79bad3d02d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -948,7 +948,7 @@ int dev_alloc_name(struct net_device *dev, const char *name)
948} 948}
949EXPORT_SYMBOL(dev_alloc_name); 949EXPORT_SYMBOL(dev_alloc_name);
950 950
951static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt) 951static int dev_get_valid_name(struct net_device *dev, const char *name)
952{ 952{
953 struct net *net; 953 struct net *net;
954 954
@@ -958,7 +958,7 @@ static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt
958 if (!dev_valid_name(name)) 958 if (!dev_valid_name(name))
959 return -EINVAL; 959 return -EINVAL;
960 960
961 if (fmt && strchr(name, '%')) 961 if (strchr(name, '%'))
962 return dev_alloc_name(dev, name); 962 return dev_alloc_name(dev, name);
963 else if (__dev_get_by_name(net, name)) 963 else if (__dev_get_by_name(net, name))
964 return -EEXIST; 964 return -EEXIST;
@@ -995,7 +995,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
995 995
996 memcpy(oldname, dev->name, IFNAMSIZ); 996 memcpy(oldname, dev->name, IFNAMSIZ);
997 997
998 err = dev_get_valid_name(dev, newname, 1); 998 err = dev_get_valid_name(dev, newname);
999 if (err < 0) 999 if (err < 0)
1000 return err; 1000 return err;
1001 1001
@@ -5420,8 +5420,8 @@ int register_netdevice(struct net_device *dev)
5420 } 5420 }
5421 } 5421 }
5422 5422
5423 ret = dev_get_valid_name(dev, dev->name, 0); 5423 ret = dev_get_valid_name(dev, dev->name);
5424 if (ret) 5424 if (ret < 0)
5425 goto err_uninit; 5425 goto err_uninit;
5426 5426
5427 dev->ifindex = dev_new_index(net); 5427 dev->ifindex = dev_new_index(net);
@@ -5562,19 +5562,7 @@ int register_netdev(struct net_device *dev)
5562 int err; 5562 int err;
5563 5563
5564 rtnl_lock(); 5564 rtnl_lock();
5565
5566 /*
5567 * If the name is a format string the caller wants us to do a
5568 * name allocation.
5569 */
5570 if (strchr(dev->name, '%')) {
5571 err = dev_alloc_name(dev, dev->name);
5572 if (err < 0)
5573 goto out;
5574 }
5575
5576 err = register_netdevice(dev); 5565 err = register_netdevice(dev);
5577out:
5578 rtnl_unlock(); 5566 rtnl_unlock();
5579 return err; 5567 return err;
5580} 5568}
@@ -6056,7 +6044,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
6056 /* We get here if we can't use the current device name */ 6044 /* We get here if we can't use the current device name */
6057 if (!pat) 6045 if (!pat)
6058 goto out; 6046 goto out;
6059 if (dev_get_valid_name(dev, pat, 1)) 6047 if (dev_get_valid_name(dev, pat) < 0)
6060 goto out; 6048 goto out;
6061 } 6049 }
6062 6050
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 296331257195..5a160f4a1ba0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1572,12 +1572,6 @@ struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
1572 dev->rtnl_link_state = RTNL_LINK_INITIALIZING; 1572 dev->rtnl_link_state = RTNL_LINK_INITIALIZING;
1573 dev->real_num_tx_queues = real_num_queues; 1573 dev->real_num_tx_queues = real_num_queues;
1574 1574
1575 if (strchr(dev->name, '%')) {
1576 err = dev_alloc_name(dev, dev->name);
1577 if (err < 0)
1578 goto err_free;
1579 }
1580
1581 if (tb[IFLA_MTU]) 1575 if (tb[IFLA_MTU])
1582 dev->mtu = nla_get_u32(tb[IFLA_MTU]); 1576 dev->mtu = nla_get_u32(tb[IFLA_MTU]);
1583 if (tb[IFLA_ADDRESS]) 1577 if (tb[IFLA_ADDRESS])
@@ -1597,8 +1591,6 @@ struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
1597 1591
1598 return dev; 1592 return dev;
1599 1593
1600err_free:
1601 free_netdev(dev);
1602err: 1594err:
1603 return ERR_PTR(err); 1595 return ERR_PTR(err);
1604} 1596}
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 10e9b5aea070..8871067560db 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -413,11 +413,6 @@ static struct ip_tunnel *ipgre_tunnel_locate(struct net *net,
413 413
414 dev_net_set(dev, net); 414 dev_net_set(dev, net);
415 415
416 if (strchr(name, '%')) {
417 if (dev_alloc_name(dev, name) < 0)
418 goto failed_free;
419 }
420
421 nt = netdev_priv(dev); 416 nt = netdev_priv(dev);
422 nt->parms = *parms; 417 nt->parms = *parms;
423 dev->rtnl_link_ops = &ipgre_link_ops; 418 dev->rtnl_link_ops = &ipgre_link_ops;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bfa0b9895040..378b20b7ca6e 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -276,11 +276,6 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
276 276
277 dev_net_set(dev, net); 277 dev_net_set(dev, net);
278 278
279 if (strchr(name, '%')) {
280 if (dev_alloc_name(dev, name) < 0)
281 goto failed_free;
282 }
283
284 nt = netdev_priv(dev); 279 nt = netdev_priv(dev);
285 nt->parms = *parms; 280 nt->parms = *parms;
286 281
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 3dff27cba95c..36c2842a86b2 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -280,11 +280,6 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
280 280
281 dev_net_set(dev, net); 281 dev_net_set(dev, net);
282 282
283 if (strchr(name, '%')) {
284 if (dev_alloc_name(dev, name) < 0)
285 goto failed_free;
286 }
287
288 t = netdev_priv(dev); 283 t = netdev_priv(dev);
289 t->parms = *p; 284 t->parms = *p;
290 err = ip6_tnl_dev_init(dev); 285 err = ip6_tnl_dev_init(dev);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index c53abcf50d29..a6a32b39b607 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -250,11 +250,6 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
250 250
251 dev_net_set(dev, net); 251 dev_net_set(dev, net);
252 252
253 if (strchr(name, '%')) {
254 if (dev_alloc_name(dev, name) < 0)
255 goto failed_free;
256 }
257
258 nt = netdev_priv(dev); 253 nt = netdev_priv(dev);
259 254
260 nt->parms = *parms; 255 nt->parms = *parms;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 4054399be907..80c29d626aa4 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1144,10 +1144,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1144 + IEEE80211_ENCRYPT_HEADROOM; 1144 + IEEE80211_ENCRYPT_HEADROOM;
1145 ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; 1145 ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
1146 1146
1147 ret = dev_alloc_name(ndev, ndev->name);
1148 if (ret < 0)
1149 goto fail;
1150
1151 ieee80211_assign_perm_addr(local, ndev, type); 1147 ieee80211_assign_perm_addr(local, ndev, type);
1152 memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); 1148 memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
1153 SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); 1149 SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));