mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Gundersen <teg@jklm.no>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
	David Herrmann <dh.herrmann@gmail.com>,
	Kay Sievers <kay@vrfy.org>, Tom Gundersen <teg@jklm.no>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH v7 18/33] net: arcdev - label alloc_arcdev names
Date: Thu, 10 Jul 2014 10:17:23 +0200	[thread overview]
Message-ID: <1404980258-30853-19-git-send-email-teg@jklm.no> (raw)
In-Reply-To: <1404980258-30853-1-git-send-email-teg@jklm.no>

Let the drivers pass in the name assign type. They all get the name as a module
parameter.

Signed-off-by: Tom Gundersen <teg@jklm.no>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/net/arcnet/arc-rimi.c     | 2 +-
 drivers/net/arcnet/arcnet.c       | 8 ++++++--
 drivers/net/arcnet/com20020-isa.c | 2 +-
 drivers/net/arcnet/com20020-pci.c | 2 +-
 drivers/net/arcnet/com20020_cs.c  | 2 +-
 drivers/net/arcnet/com90io.c      | 2 +-
 drivers/net/arcnet/com90xx.c      | 2 +-
 include/linux/arcdevice.h         | 3 ++-
 8 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index b8b4c7b..c6fc1ce 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -337,7 +337,7 @@ static int __init arc_rimi_init(void)
 {
 	struct net_device *dev;
 
-	dev = alloc_arcdev(device);
+	dev = alloc_arcdev(device, NET_NAME_USER);
 	if (!dev)
 		return -ENOMEM;
 
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 3b790de..710fe54 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -341,12 +341,16 @@ static void arcdev_setup(struct net_device *dev)
 
 }
 
-struct net_device *alloc_arcdev(const char *name)
+struct net_device *alloc_arcdev(const char *name, unsigned char name_assign_type)
 {
 	struct net_device *dev;
 
+	if (name && !*name)
+		name = NULL;
+
 	dev = alloc_netdev(sizeof(struct arcnet_local),
-			   name && *name ? name : "arc%d", NET_NAME_UNKNOWN,
+			   name ? name : "arc%d",
+			   name ? name_assign_type : NET_NAME_ENUM,
 			   arcdev_setup);
 	if(dev) {
 		struct arcnet_local *lp = netdev_priv(dev);
diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c
index 45c61a2..4b48598 100644
--- a/drivers/net/arcnet/com20020-isa.c
+++ b/drivers/net/arcnet/com20020-isa.c
@@ -144,7 +144,7 @@ static int __init com20020_init(void)
 	struct net_device *dev;
 	struct arcnet_local *lp;
 
-	dev = alloc_arcdev(device);
+	dev = alloc_arcdev(device, NET_NAME_USER);
 	if (!dev)
 		return -ENOMEM;
 
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index cbc44f5..b1d0dc7 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -69,7 +69,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 
 	if (pci_enable_device(pdev))
 		return -EIO;
-	dev = alloc_arcdev(device);
+	dev = alloc_arcdev(device, NET_NAME_USER);
 	if (!dev)
 		return -ENOMEM;
 
diff --git a/drivers/net/arcnet/com20020_cs.c b/drivers/net/arcnet/com20020_cs.c
index 326a612..de09df0 100644
--- a/drivers/net/arcnet/com20020_cs.c
+++ b/drivers/net/arcnet/com20020_cs.c
@@ -129,7 +129,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
     if (!info)
 	goto fail_alloc_info;
 
-    dev = alloc_arcdev("");
+    dev = alloc_arcdev("", NET_NAME_UNKNOWN);
     if (!dev)
 	goto fail_alloc_dev;
 
diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c
index 487d780..f3b2938 100644
--- a/drivers/net/arcnet/com90io.c
+++ b/drivers/net/arcnet/com90io.c
@@ -394,7 +394,7 @@ static int __init com90io_init(void)
 	struct net_device *dev;
 	int err;
 
-	dev = alloc_arcdev(device);
+	dev = alloc_arcdev(device, NET_NAME_USER);
 	if (!dev)
 		return -ENOMEM;
 
diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c
index b80fbe4..875efbd 100644
--- a/drivers/net/arcnet/com90xx.c
+++ b/drivers/net/arcnet/com90xx.c
@@ -463,7 +463,7 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem
 	int mirror_size;
 
 	/* allocate struct net_device */
-	dev = alloc_arcdev(device);
+	dev = alloc_arcdev(device, NET_NAME_USER);
 	if (!dev) {
 		BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n");
 		iounmap(p);
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7216b0d..1e9a473 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -334,7 +334,8 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
 
 void arcnet_unregister_proto(struct ArcProto *proto);
 irqreturn_t arcnet_interrupt(int irq, void *dev_id);
-struct net_device *alloc_arcdev(const char *name);
+struct net_device *alloc_arcdev(const char *name,
+				unsigned char name_assgin_type);
 
 int arcnet_open(struct net_device *dev);
 int arcnet_close(struct net_device *dev);
-- 
1.9.3


  parent reply	other threads:[~2014-07-10  8:24 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  8:17 [PATCH v7 00/33] Provide netdev naming-policy via sysfs Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 01/33] net: add name_assign_type netdev attribute Tom Gundersen
2014-07-10 15:53   ` Nicolas Dichtel
2014-07-10 20:00     ` Tom Gundersen
2014-07-10 19:58   ` Arend van Spriel
2014-07-10 20:01     ` Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 02/33] net: set name assign type for renamed devices Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 03/33] net: set name_assign_type in alloc_netdev() Tom Gundersen
2014-07-10  9:16   ` Bjørn Mork
2014-07-10 10:21     ` Tom Gundersen
2014-07-10 11:29       ` Bjørn Mork
2014-07-10 13:02         ` Tom Gundersen
2014-07-10 13:27           ` Bjørn Mork
2014-07-10  8:17 ` [PATCH v7 04/33] net: set name assign type for names assigned using a static template Tom Gundersen
2014-07-10  8:52   ` Marc Kleine-Budde
2014-07-10  8:17 ` [PATCH v7 05/33] net: set name assign type for names assigned using a static string Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 06/33] net: set name assign type for names passed directly from userspace Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 07/33] net: rtnetlink - make create_link take name_assign_type Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 08/33] net: nl80211 - make rdev_add_virtual_intf " Tom Gundersen
2014-07-21  9:40   ` Johannes Berg
2014-07-21 17:03     ` Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 09/33] net: nl802154 - make add_iface take name assign type Tom Gundersen
2014-07-10 10:52   ` Alexander Aring
2014-07-10  8:17 ` [PATCH v7 10/33] net: dummy - set " Tom Gundersen
2014-07-10  9:31   ` Bjørn Mork
2014-07-10 10:12     ` Tom Gundersen
2014-07-10 10:26       ` David Herrmann
2014-07-10 10:33         ` Tom Gundersen
2014-07-10 11:44       ` Bjørn Mork
2014-07-10 12:18         ` Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 11/33] net: af_netrom " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 12/33] net: af_rose " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 13/33] net: mrt " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 14/33] net: caif_serial " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 15/33] net: xen-netback " Tom Gundersen
2014-07-10  8:25   ` Varka Bhadram
2014-07-10  9:01   ` Ian Campbell
2014-07-10 10:46     ` Tom Gundersen
2014-07-10 12:13       ` Ian Campbell
2014-07-10  8:17 ` [PATCH v7 16/33] net: gdm_lte " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 17/33] net: airo " Tom Gundersen
2014-07-10  8:17 ` Tom Gundersen [this message]
2014-07-10  8:17 ` [PATCH v7 19/33] net: isdn " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 20/33] net: irlan " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 21/33] net: batman-adv " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 22/33] net: hamradio " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 23/33] net: openvswitch " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 24/33] net: vlan " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 25/33] net: infiniband - steal ifname label Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 26/33] net: ipoib - set name assign type Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 27/33] net: tile " Tom Gundersen
2014-07-16 17:49   ` Chris Metcalf
2014-07-10  8:17 ` [PATCH v7 28/33] net: dsa " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 29/33] net: brcmfmac " Tom Gundersen
2014-07-10 20:08   ` Arend van Spriel
2014-07-10 20:24     ` Tom Gundersen
2014-07-11  7:45       ` Arend van Spriel
2014-07-15 19:39   ` John W. Linville
2014-07-15 19:57     ` Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 30/33] net: ppp " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 31/33] net: slcan " Tom Gundersen
2014-07-10  8:51   ` Marc Kleine-Budde
2014-07-10  8:17 ` [PATCH v7 32/33] net: x25_asy " Tom Gundersen
2014-07-10  8:17 ` [PATCH v7 33/33] net: slip " Tom Gundersen
2014-07-10  8:43 ` [PATCH v7 00/33] Provide netdev naming-policy via sysfs David Miller
2014-07-10  9:19   ` Tom Gundersen
2014-07-10 19:11     ` Tom Gundersen
2014-07-10 19:19     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404980258-30853-19-git-send-email-teg@jklm.no \
    --to=teg@jklm.no \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dh.herrmann@gmail.com \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®