mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Gundersen <teg@jklm.no>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, Tom Gundersen <teg@jklm.no>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	linux-zigbee-devel@lists.sourceforge.net
Subject: [PATCH net-next v9 3/9] net: nl802154 - make add_iface take name assign type
Date: Thu, 17 Jul 2014 10:06:04 +0200	[thread overview]
Message-ID: <1405584370-30054-4-git-send-email-teg@jklm.no> (raw)
In-Reply-To: <1405584370-30054-1-git-send-email-teg@jklm.no>

Signed-off-by: Tom Gundersen <teg@jklm.no>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-zigbee-devel@lists.sourceforge.net
---
 include/net/wpan-phy.h         | 4 +++-
 net/ieee802154/nl-phy.c        | 5 ++++-
 net/mac802154/ieee802154_dev.c | 7 ++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index 10ab0fc..bb07a1b 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -58,7 +58,9 @@ struct wpan_phy {
 	int idx;
 
 	struct net_device *(*add_iface)(struct wpan_phy *phy,
-					const char *name, int type);
+					const char *name,
+					unsigned char name_assign_type,
+					int type);
 	void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
 
 	int (*set_txpower)(struct wpan_phy *phy, int db);
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index 972baf8..5e1a28e 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -174,6 +174,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
 	struct wpan_phy *phy;
 	const char *name;
 	const char *devname;
+	unsigned char name_assign_type;
 	int rc = -ENOBUFS;
 	struct net_device *dev;
 	int type = __IEEE802154_DEV_INVALID;
@@ -192,8 +193,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
 		if (devname[nla_len(info->attrs[IEEE802154_ATTR_DEV_NAME]) - 1]
 				!= '\0')
 			return -EINVAL; /* phy name should be null-terminated */
+		name_assign_type = NET_NAME_USER;
 	} else  {
 		devname = "wpan%d";
+		name_assign_type = NET_NAME_ENUM;
 	}
 
 	if (strlen(devname) >= IFNAMSIZ)
@@ -227,7 +230,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
 		}
 	}
 
-	dev = phy->add_iface(phy, devname, type);
+	dev = phy->add_iface(phy, devname, name_assign_type, type);
 	if (IS_ERR(dev)) {
 		rc = PTR_ERR(dev);
 		goto nla_put_failure;
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c
index b36b2b9..cee12b2 100644
--- a/net/mac802154/ieee802154_dev.c
+++ b/net/mac802154/ieee802154_dev.c
@@ -159,7 +159,8 @@ mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
 }
 
 static struct net_device *
-mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
+mac802154_add_iface(struct wpan_phy *phy, const char *name,
+		    unsigned char name_assign_type, int type)
 {
 	struct net_device *dev;
 	int err = -ENOMEM;
@@ -167,12 +168,12 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
 	switch (type) {
 	case IEEE802154_DEV_MONITOR:
 		dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
-				   name, NET_NAME_UNKNOWN,
+				   name, name_assign_type,
 				   mac802154_monitor_setup);
 		break;
 	case IEEE802154_DEV_WPAN:
 		dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
-				   name, NET_NAME_UNKNOWN,
+				   name, name_assign_type,
 				   mac802154_wpan_setup);
 		break;
 	default:
-- 
1.9.3


  parent reply	other threads:[~2014-07-17  8:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:06 [PATCH net-next v9 0/9] net: set the correct name_assign_type for more devices Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 1/9] net: set name assign type for names assigned using a static string Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 2/9] net: nl80211 - make rdev_add_virtual_intf take name_assign_type Tom Gundersen
2014-07-17  9:04   ` Johannes Berg
2014-07-17  9:16     ` Tom Gundersen
2014-07-17  9:23       ` Johannes Berg
2014-07-17  8:06 ` Tom Gundersen [this message]
2014-07-17 23:19   ` [PATCH net-next v9 3/9] net: nl802154 - make add_iface take name assign type David Miller
2014-07-18  8:18     ` [Linux-zigbee-devel] " Alexander Aring
2014-07-18  8:29     ` David Laight
2014-07-18  8:41     ` Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 4/9] net: set name_assign_type when setting names via ioctls Tom Gundersen
2014-07-17 23:20   ` David Miller
2014-07-18  8:59     ` Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 5/9] net: bond - make bond_create take name_assign_type Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 6/9] net: isdn - set name assign type Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 7/9] net: vlan " Tom Gundersen
2014-07-17  8:06 ` [PATCH net-next v9 8/9] net: openvswitch " Tom Gundersen
2014-07-17 18:22   ` Pravin Shelar
2014-07-17  8:06 ` [PATCH net-next v9 9/9] net: ppp " Tom Gundersen

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=1405584370-30054-4-git-send-email-teg@jklm.no \
    --to=teg@jklm.no \
    --cc=davem@davemloft.net \
    --cc=dbaryshkov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-zigbee-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    /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®