diff options
-rw-r--r-- | include/linux/nl802154.h | 6 | ||||
-rw-r--r-- | include/net/wpan-phy.h | 2 | ||||
-rw-r--r-- | net/ieee802154/nl-phy.c | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h index 33d9f5175109..2015ad248101 100644 --- a/include/linux/nl802154.h +++ b/include/linux/nl802154.h | |||
@@ -68,6 +68,7 @@ enum { | |||
68 | IEEE802154_ATTR_CHANNEL_PAGE_LIST, | 68 | IEEE802154_ATTR_CHANNEL_PAGE_LIST, |
69 | 69 | ||
70 | IEEE802154_ATTR_PHY_NAME, | 70 | IEEE802154_ATTR_PHY_NAME, |
71 | IEEE802154_ATTR_DEV_TYPE, | ||
71 | 72 | ||
72 | __IEEE802154_ATTR_MAX, | 73 | __IEEE802154_ATTR_MAX, |
73 | }; | 74 | }; |
@@ -126,4 +127,9 @@ enum { | |||
126 | 127 | ||
127 | #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) | 128 | #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) |
128 | 129 | ||
130 | enum { | ||
131 | __IEEE802154_DEV_INVALID = -1, | ||
132 | __IEEE802154_DEV_MAX, | ||
133 | }; | ||
134 | |||
129 | #endif | 135 | #endif |
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index ff27f1b078d1..efd6749e392b 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h | |||
@@ -43,7 +43,7 @@ struct wpan_phy { | |||
43 | int idx; | 43 | int idx; |
44 | 44 | ||
45 | struct net_device *(*add_iface)(struct wpan_phy *phy, | 45 | struct net_device *(*add_iface)(struct wpan_phy *phy, |
46 | const char *name); | 46 | const char *name, int type); |
47 | void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); | 47 | void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); |
48 | 48 | ||
49 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 49 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index 3bdc4303c339..eed291626da6 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c | |||
@@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb, | |||
179 | const char *devname; | 179 | const char *devname; |
180 | int rc = -ENOBUFS; | 180 | int rc = -ENOBUFS; |
181 | struct net_device *dev; | 181 | struct net_device *dev; |
182 | int type = __IEEE802154_DEV_INVALID; | ||
182 | 183 | ||
183 | pr_debug("%s\n", __func__); | 184 | pr_debug("%s\n", __func__); |
184 | 185 | ||
@@ -221,7 +222,13 @@ static int ieee802154_add_iface(struct sk_buff *skb, | |||
221 | goto nla_put_failure; | 222 | goto nla_put_failure; |
222 | } | 223 | } |
223 | 224 | ||
224 | dev = phy->add_iface(phy, devname); | 225 | if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { |
226 | type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]); | ||
227 | if (type >= __IEEE802154_DEV_MAX) | ||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | dev = phy->add_iface(phy, devname, type); | ||
225 | if (IS_ERR(dev)) { | 232 | if (IS_ERR(dev)) { |
226 | rc = PTR_ERR(dev); | 233 | rc = PTR_ERR(dev); |
227 | goto nla_put_failure; | 234 | goto nla_put_failure; |