mac820154: move interface unregistration into iface
authorAlexander Aring <alex.aring@gmail.com>
Wed, 12 Nov 2014 02:36:48 +0000 (03:36 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Nov 2014 04:10:35 +0000 (05:10 +0100)
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>
net/mac802154/ieee802154_i.h
net/mac802154/iface.c
net/mac802154/main.c

index e22f509af72b74a292b6cb59480eab0e72349e0d..abb19701d494637901134f8d281b970551e88d49 100644 (file)
@@ -172,5 +172,6 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
 struct net_device *
 ieee802154_if_add(struct ieee802154_local *local, const char *name,
                  struct wpan_dev **new_wpan_dev, int type);
+void ieee802154_remove_interfaces(struct ieee802154_local *local);
 
 #endif /* __IEEE802154_I_H */
index 83715b5ffe43fe1eae36c438e949b56fe5907a25..8d90fbafda140dd43a39abae104b73f3f43d65ec 100644 (file)
@@ -535,3 +535,16 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
        synchronize_rcu();
        unregister_netdevice(sdata->dev);
 }
+
+void ieee802154_remove_interfaces(struct ieee802154_local *local)
+{
+       struct ieee802154_sub_if_data *sdata, *next;
+
+       list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
+               mutex_lock(&sdata->local->iflist_mtx);
+               list_del(&sdata->list);
+               mutex_unlock(&sdata->local->iflist_mtx);
+
+               unregister_netdevice(sdata->dev);
+       }
+}
index 234084d269061dd98ae4b3a4d424e20b1cec82cf..709dcc5f7f178250799c16af007b0bc691fa6623 100644 (file)
@@ -165,7 +165,6 @@ EXPORT_SYMBOL(ieee802154_register_hw);
 void ieee802154_unregister_hw(struct ieee802154_hw *hw)
 {
        struct ieee802154_local *local = hw_to_local(hw);
-       struct ieee802154_sub_if_data *sdata, *next;
 
        tasklet_kill(&local->tasklet);
        flush_workqueue(local->workqueue);
@@ -173,13 +172,7 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
 
        rtnl_lock();
 
-       list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
-               mutex_lock(&sdata->local->iflist_mtx);
-               list_del(&sdata->list);
-               mutex_unlock(&sdata->local->iflist_mtx);
-
-               unregister_netdevice(sdata->dev);
-       }
+       ieee802154_remove_interfaces(local);
 
        rtnl_unlock();