aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-11 21:36:48 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-11 23:10:35 -0500
commit592dfbfc72f5352437c883aa11ab579d10cdb595 (patch)
tree628e6a9521161d134f98140c15748f7a782035a0 /net
parent4e7902267708e5a389398d9014455b2ed4892912 (diff)
mac820154: move interface unregistration into iface
This patch move the iface unregistration into iface.c file to have a behaviour which is similar like mac80211. Also iface handling should be inside iface.c file only. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac802154/ieee802154_i.h1
-rw-r--r--net/mac802154/iface.c13
-rw-r--r--net/mac802154/main.c9
3 files changed, 15 insertions, 8 deletions
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index e22f509af72b..abb19701d494 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -172,5 +172,6 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
172struct net_device * 172struct net_device *
173ieee802154_if_add(struct ieee802154_local *local, const char *name, 173ieee802154_if_add(struct ieee802154_local *local, const char *name,
174 struct wpan_dev **new_wpan_dev, int type); 174 struct wpan_dev **new_wpan_dev, int type);
175void ieee802154_remove_interfaces(struct ieee802154_local *local);
175 176
176#endif /* __IEEE802154_I_H */ 177#endif /* __IEEE802154_I_H */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 83715b5ffe43..8d90fbafda14 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -535,3 +535,16 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
535 synchronize_rcu(); 535 synchronize_rcu();
536 unregister_netdevice(sdata->dev); 536 unregister_netdevice(sdata->dev);
537} 537}
538
539void ieee802154_remove_interfaces(struct ieee802154_local *local)
540{
541 struct ieee802154_sub_if_data *sdata, *next;
542
543 list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
544 mutex_lock(&sdata->local->iflist_mtx);
545 list_del(&sdata->list);
546 mutex_unlock(&sdata->local->iflist_mtx);
547
548 unregister_netdevice(sdata->dev);
549 }
550}
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 234084d26906..709dcc5f7f17 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -165,7 +165,6 @@ EXPORT_SYMBOL(ieee802154_register_hw);
165void ieee802154_unregister_hw(struct ieee802154_hw *hw) 165void ieee802154_unregister_hw(struct ieee802154_hw *hw)
166{ 166{
167 struct ieee802154_local *local = hw_to_local(hw); 167 struct ieee802154_local *local = hw_to_local(hw);
168 struct ieee802154_sub_if_data *sdata, *next;
169 168
170 tasklet_kill(&local->tasklet); 169 tasklet_kill(&local->tasklet);
171 flush_workqueue(local->workqueue); 170 flush_workqueue(local->workqueue);
@@ -173,13 +172,7 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
173 172
174 rtnl_lock(); 173 rtnl_lock();
175 174
176 list_for_each_entry_safe(sdata, next, &local->interfaces, list) { 175 ieee802154_remove_interfaces(local);
177 mutex_lock(&sdata->local->iflist_mtx);
178 list_del(&sdata->list);
179 mutex_unlock(&sdata->local->iflist_mtx);
180
181 unregister_netdevice(sdata->dev);
182 }
183 176
184 rtnl_unlock(); 177 rtnl_unlock();
185 178