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:
Tom Gundersen
2014-07-14 16:37:24 +02:00
committed by David S. Miller
parent 238fa3623a
commit c835a67733
97 changed files with 185 additions and 133 deletions

View File

@@ -327,8 +327,8 @@ static int dlci_add(struct dlci_add *dlci)
goto err1;
/* create device name */
master = alloc_netdev( sizeof(struct dlci_local), "dlci%d",
dlci_setup);
master = alloc_netdev(sizeof(struct dlci_local), "dlci%d",
NET_NAME_UNKNOWN, dlci_setup);
if (!master) {
err = -ENOMEM;
goto err1;

View File

@@ -256,7 +256,8 @@ static void hdlc_setup(struct net_device *dev)
struct net_device *alloc_hdlcdev(void *priv)
{
struct net_device *dev;
dev = alloc_netdev(sizeof(struct hdlc_device), "hdlc%d", hdlc_setup);
dev = alloc_netdev(sizeof(struct hdlc_device), "hdlc%d",
NET_NAME_UNKNOWN, hdlc_setup);
if (dev)
dev_to_hdlc(dev)->priv = priv;
return dev;

View File

@@ -1075,10 +1075,11 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
used = pvc_is_used(pvc);
if (type == ARPHRD_ETHER) {
dev = alloc_netdev(0, "pvceth%d", ether_setup);
dev = alloc_netdev(0, "pvceth%d", NET_NAME_UNKNOWN,
ether_setup);
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
} else
dev = alloc_netdev(0, "pvc%d", pvc_setup);
dev = alloc_netdev(0, "pvc%d", NET_NAME_UNKNOWN, pvc_setup);
if (!dev) {
netdev_warn(frad, "Memory squeeze on fr_pvc()\n");

View File

@@ -325,8 +325,8 @@ static int lapbeth_new_device(struct net_device *dev)
ASSERT_RTNL();
ndev = alloc_netdev(sizeof(*lapbeth), "lapb%d",
lapbeth_setup);
ndev = alloc_netdev(sizeof(*lapbeth), "lapb%d", NET_NAME_UNKNOWN,
lapbeth_setup);
if (!ndev)
goto out;

View File

@@ -227,7 +227,8 @@ int __init sbni_probe(int unit)
struct net_device *dev;
int err;
dev = alloc_netdev(sizeof(struct net_local), "sbni", sbni_devsetup);
dev = alloc_netdev(sizeof(struct net_local), "sbni",
NET_NAME_UNKNOWN, sbni_devsetup);
if (!dev)
return -ENOMEM;
@@ -1477,8 +1478,8 @@ int __init init_module( void )
int err;
while( num < SBNI_MAX_NUM_CARDS ) {
dev = alloc_netdev(sizeof(struct net_local),
"sbni%d", sbni_devsetup);
dev = alloc_netdev(sizeof(struct net_local), "sbni%d",
NET_NAME_UNKNOWN, sbni_devsetup);
if( !dev)
break;

View File

@@ -1631,7 +1631,8 @@ static int __init init_sdla(void)
printk("%s.\n", version);
sdla = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla);
sdla = alloc_netdev(sizeof(struct frad_local), "sdla0",
NET_NAME_UNKNOWN, setup_sdla);
if (!sdla)
return -ENOMEM;

View File

@@ -81,8 +81,8 @@ static struct x25_asy *x25_asy_alloc(void)
char name[IFNAMSIZ];
sprintf(name, "x25asy%d", i);
dev = alloc_netdev(sizeof(struct x25_asy),
name, x25_asy_setup);
dev = alloc_netdev(sizeof(struct x25_asy), name,
NET_NAME_UNKNOWN, x25_asy_setup);
if (!dev)
return NULL;