aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-05 14:51:14 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-05 15:53:03 -0500
commitb210b18747cb511bb71f6a49c97e8d38f639b435 (patch)
tree644fad3528a37d44a6e85e6bdbea3ced09c2ac8b
parent9f3295b9ea8e54a6c65231d267f069edf420b64f (diff)
mac802154: move interface del handling in iface
This patch moves and rename the mac802154_del_iface function into iface.c and rename the function to ieee802154_if_remove which is a similar naming convention like mac80211. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/mac802154/cfg.c4
-rw-r--r--net/mac802154/ieee802154_i.h2
-rw-r--r--net/mac802154/iface.c12
-rw-r--r--net/mac802154/main.c16
4 files changed, 16 insertions, 18 deletions
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
index 0c69b44ba312..3f9afad1f612 100644
--- a/net/mac802154/cfg.c
+++ b/net/mac802154/cfg.c
@@ -28,7 +28,9 @@ ieee802154_add_iface_deprecated(struct wpan_phy *wpan_phy,
28static void ieee802154_del_iface_deprecated(struct wpan_phy *wpan_phy, 28static void ieee802154_del_iface_deprecated(struct wpan_phy *wpan_phy,
29 struct net_device *dev) 29 struct net_device *dev)
30{ 30{
31 mac802154_del_iface(wpan_phy, dev); 31 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
32
33 ieee802154_if_remove(sdata);
32} 34}
33 35
34const struct cfg802154_ops mac802154_config_ops = { 36const struct cfg802154_ops mac802154_config_ops = {
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 27e17e6bcf18..61a6a0fd39ad 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -175,6 +175,6 @@ void mac802154_unlock_table(struct net_device *dev);
175 175
176struct net_device * 176struct net_device *
177mac802154_add_iface(struct wpan_phy *phy, const char *name, int type); 177mac802154_add_iface(struct wpan_phy *phy, const char *name, int type);
178void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev); 178void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
179 179
180#endif /* __IEEE802154_I_H */ 180#endif /* __IEEE802154_I_H */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 0c9d00c83654..9d6012e430de 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -443,3 +443,15 @@ void mac802154_monitor_setup(struct net_device *dev)
443 443
444 sdata->promisuous_mode = true; 444 sdata->promisuous_mode = true;
445} 445}
446
447void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
448{
449 ASSERT_RTNL();
450
451 mutex_lock(&sdata->local->iflist_mtx);
452 list_del_rcu(&sdata->list);
453 mutex_unlock(&sdata->local->iflist_mtx);
454
455 synchronize_rcu();
456 unregister_netdevice(sdata->dev);
457}
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index b34ddbf43c3d..333d33daec6e 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -59,22 +59,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
59 return 0; 59 return 0;
60} 60}
61 61
62void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
63{
64 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
65
66 ASSERT_RTNL();
67
68 BUG_ON(sdata->local->phy != phy);
69
70 mutex_lock(&sdata->local->iflist_mtx);
71 list_del_rcu(&sdata->list);
72 mutex_unlock(&sdata->local->iflist_mtx);
73
74 synchronize_rcu();
75 unregister_netdevice(sdata->dev);
76}
77
78struct net_device * 62struct net_device *
79mac802154_add_iface(struct wpan_phy *phy, const char *name, int type) 63mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
80{ 64{