You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
net: set name_assign_type in alloc_netdev()
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
all users to pass NET_NAME_UNKNOWN.
Coccinelle patch:
@@
expression sizeof_priv, name, setup, txqs, rxqs, count;
@@
(
-alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
+alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
|
-alloc_netdev_mq(sizeof_priv, name, setup, count)
+alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
|
-alloc_netdev(sizeof_priv, name, setup)
+alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
)
v9: move comments here from the wrong commit
Signed-off-by: Tom Gundersen <teg@jklm.no>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
238fa3623a
commit
c835a67733
+1
-1
@@ -126,6 +126,6 @@ static void fc_setup(struct net_device *dev)
|
||||
*/
|
||||
struct net_device *alloc_fcdev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "fc%d", fc_setup);
|
||||
return alloc_netdev(sizeof_priv, "fc%d", NET_NAME_UNKNOWN, fc_setup);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_fcdev);
|
||||
|
||||
+2
-1
@@ -207,7 +207,8 @@ static void fddi_setup(struct net_device *dev)
|
||||
*/
|
||||
struct net_device *alloc_fddidev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup);
|
||||
return alloc_netdev(sizeof_priv, "fddi%d", NET_NAME_UNKNOWN,
|
||||
fddi_setup);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_fddidev);
|
||||
|
||||
|
||||
+2
-1
@@ -228,7 +228,8 @@ static void hippi_setup(struct net_device *dev)
|
||||
|
||||
struct net_device *alloc_hippi_dev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "hip%d", hippi_setup);
|
||||
return alloc_netdev(sizeof_priv, "hip%d", NET_NAME_UNKNOWN,
|
||||
hippi_setup);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(alloc_hippi_dev);
|
||||
|
||||
+2
-1
@@ -250,7 +250,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
|
||||
snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id);
|
||||
}
|
||||
|
||||
new_dev = alloc_netdev(sizeof(struct vlan_dev_priv), name, vlan_setup);
|
||||
new_dev = alloc_netdev(sizeof(struct vlan_dev_priv), name,
|
||||
NET_NAME_UNKNOWN, vlan_setup);
|
||||
|
||||
if (new_dev == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
+2
-1
@@ -39,6 +39,7 @@ static void ltalk_setup(struct net_device *dev)
|
||||
|
||||
struct net_device *alloc_ltalkdev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "lt%d", ltalk_setup);
|
||||
return alloc_netdev(sizeof_priv, "lt%d", NET_NAME_UNKNOWN,
|
||||
ltalk_setup);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_ltalkdev);
|
||||
|
||||
+2
-2
@@ -682,8 +682,8 @@ static int br2684_create(void __user *arg)
|
||||
|
||||
netdev = alloc_netdev(sizeof(struct br2684_dev),
|
||||
ni.ifname[0] ? ni.ifname : "nas%d",
|
||||
(payload == p_routed) ?
|
||||
br2684_setup_routed : br2684_setup);
|
||||
NET_NAME_UNKNOWN,
|
||||
(payload == p_routed) ? br2684_setup_routed : br2684_setup);
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+2
-1
@@ -520,7 +520,8 @@ static int clip_create(int number)
|
||||
if (PRIV(dev)->number >= number)
|
||||
number = PRIV(dev)->number + 1;
|
||||
}
|
||||
dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup);
|
||||
dev = alloc_netdev(sizeof(struct clip_priv), "", NET_NAME_UNKNOWN,
|
||||
clip_setup);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
clip_priv = PRIV(dev);
|
||||
|
||||
@@ -895,7 +895,7 @@ struct net_device *batadv_softif_create(const char *name)
|
||||
int ret;
|
||||
|
||||
soft_iface = alloc_netdev(sizeof(struct batadv_priv), name,
|
||||
batadv_softif_init_early);
|
||||
NET_NAME_UNKNOWN, batadv_softif_init_early);
|
||||
if (!soft_iface)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -712,7 +712,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
|
||||
unsigned long flags;
|
||||
|
||||
netdev = alloc_netdev(sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
|
||||
netdev_setup);
|
||||
NET_NAME_UNKNOWN, netdev_setup);
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -538,8 +538,9 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
|
||||
|
||||
/* session struct allocated as private part of net_device */
|
||||
dev = alloc_netdev(sizeof(struct bnep_session),
|
||||
(*req->device) ? req->device : "bnep%d",
|
||||
bnep_net_setup);
|
||||
(*req->device) ? req->device : "bnep%d",
|
||||
NET_NAME_UNKNOWN,
|
||||
bnep_net_setup);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+1
-1
@@ -344,7 +344,7 @@ int br_add_bridge(struct net *net, const char *name)
|
||||
struct net_device *dev;
|
||||
int res;
|
||||
|
||||
dev = alloc_netdev(sizeof(struct net_bridge), name,
|
||||
dev = alloc_netdev(sizeof(struct net_bridge), name, NET_NAME_UNKNOWN,
|
||||
br_dev_setup);
|
||||
|
||||
if (!dev)
|
||||
|
||||
+8
-5
@@ -6441,17 +6441,19 @@ void netdev_freemem(struct net_device *dev)
|
||||
|
||||
/**
|
||||
* alloc_netdev_mqs - allocate network device
|
||||
* @sizeof_priv: size of private data to allocate space for
|
||||
* @name: device name format string
|
||||
* @setup: callback to initialize device
|
||||
* @txqs: the number of TX subqueues to allocate
|
||||
* @rxqs: the number of RX subqueues to allocate
|
||||
* @sizeof_priv: size of private data to allocate space for
|
||||
* @name: device name format string
|
||||
* @name_assign_type: origin of device name
|
||||
* @setup: callback to initialize device
|
||||
* @txqs: the number of TX subqueues to allocate
|
||||
* @rxqs: the number of RX subqueues to allocate
|
||||
*
|
||||
* Allocates a struct net_device with private data area for driver use
|
||||
* and performs basic initialization. Also allocates subqueue structs
|
||||
* for each queue on the device.
|
||||
*/
|
||||
struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
|
||||
unsigned char name_assign_type,
|
||||
void (*setup)(struct net_device *),
|
||||
unsigned int txqs, unsigned int rxqs)
|
||||
{
|
||||
@@ -6530,6 +6532,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
|
||||
#endif
|
||||
|
||||
strcpy(dev->name, name);
|
||||
dev->name_assign_type = name_assign_type;
|
||||
dev->group = INIT_NETDEV_GROUP;
|
||||
if (!dev->ethtool_ops)
|
||||
dev->ethtool_ops = &default_ethtool_ops;
|
||||
|
||||
@@ -1828,8 +1828,8 @@ struct net_device *rtnl_create_link(struct net *net,
|
||||
num_rx_queues = ops->get_num_rx_queues();
|
||||
|
||||
err = -ENOMEM;
|
||||
dev = alloc_netdev_mqs(ops->priv_size, ifname, ops->setup,
|
||||
num_tx_queues, num_rx_queues);
|
||||
dev = alloc_netdev_mqs(ops->priv_size, ifname, NET_NAME_UNKNOWN,
|
||||
ops->setup, num_tx_queues, num_rx_queues);
|
||||
if (!dev)
|
||||
goto err;
|
||||
|
||||
|
||||
+2
-2
@@ -340,8 +340,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
|
||||
struct dsa_slave_priv *p;
|
||||
int ret;
|
||||
|
||||
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv),
|
||||
name, ether_setup);
|
||||
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
|
||||
NET_NAME_UNKNOWN, ether_setup);
|
||||
if (slave_dev == NULL)
|
||||
return slave_dev;
|
||||
|
||||
|
||||
+2
-1
@@ -390,7 +390,8 @@ EXPORT_SYMBOL(ether_setup);
|
||||
struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
|
||||
unsigned int rxqs)
|
||||
{
|
||||
return alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs);
|
||||
return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,
|
||||
ether_setup, txqs, rxqs);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_etherdev_mqs);
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ static struct net_device *__ip_tunnel_create(struct net *net,
|
||||
}
|
||||
|
||||
ASSERT_RTNL();
|
||||
dev = alloc_netdev(ops->priv_size, name, ops->setup);
|
||||
dev = alloc_netdev(ops->priv_size, name, NET_NAME_UNKNOWN, ops->setup);
|
||||
if (!dev) {
|
||||
err = -ENOMEM;
|
||||
goto failed;
|
||||
|
||||
+1
-1
@@ -500,7 +500,7 @@ static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
|
||||
else
|
||||
sprintf(name, "pimreg%u", mrt->id);
|
||||
|
||||
dev = alloc_netdev(0, name, reg_vif_setup);
|
||||
dev = alloc_netdev(0, name, NET_NAME_UNKNOWN, reg_vif_setup);
|
||||
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
|
||||
+4
-2
@@ -322,7 +322,8 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
|
||||
else
|
||||
strcpy(name, "ip6gre%d");
|
||||
|
||||
dev = alloc_netdev(sizeof(*t), name, ip6gre_tunnel_setup);
|
||||
dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
|
||||
ip6gre_tunnel_setup);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
@@ -1326,7 +1327,8 @@ static int __net_init ip6gre_init_net(struct net *net)
|
||||
int err;
|
||||
|
||||
ign->fb_tunnel_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",
|
||||
ip6gre_tunnel_setup);
|
||||
NET_NAME_UNKNOWN,
|
||||
ip6gre_tunnel_setup);
|
||||
if (!ign->fb_tunnel_dev) {
|
||||
err = -ENOMEM;
|
||||
goto err_alloc_dev;
|
||||
|
||||
@@ -315,7 +315,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
|
||||
else
|
||||
sprintf(name, "ip6tnl%%d");
|
||||
|
||||
dev = alloc_netdev(sizeof (*t), name, ip6_tnl_dev_setup);
|
||||
dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
|
||||
ip6_tnl_dev_setup);
|
||||
if (dev == NULL)
|
||||
goto failed;
|
||||
|
||||
@@ -1773,7 +1774,7 @@ static int __net_init ip6_tnl_init_net(struct net *net)
|
||||
|
||||
err = -ENOMEM;
|
||||
ip6n->fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6tnl0",
|
||||
ip6_tnl_dev_setup);
|
||||
NET_NAME_UNKNOWN, ip6_tnl_dev_setup);
|
||||
|
||||
if (!ip6n->fb_tnl_dev)
|
||||
goto err_alloc_dev;
|
||||
|
||||
+2
-2
@@ -204,7 +204,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p
|
||||
else
|
||||
sprintf(name, "ip6_vti%%d");
|
||||
|
||||
dev = alloc_netdev(sizeof(*t), name, vti6_dev_setup);
|
||||
dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup);
|
||||
if (dev == NULL)
|
||||
goto failed;
|
||||
|
||||
@@ -1020,7 +1020,7 @@ static int __net_init vti6_init_net(struct net *net)
|
||||
|
||||
err = -ENOMEM;
|
||||
ip6n->fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6_vti0",
|
||||
vti6_dev_setup);
|
||||
NET_NAME_UNKNOWN, vti6_dev_setup);
|
||||
|
||||
if (!ip6n->fb_tnl_dev)
|
||||
goto err_alloc_dev;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user