Skip to content

Commit

Permalink
mac820154: move interface unregistration into iface
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
alexaring authored and holtmann committed Nov 12, 2014
1 parent 4e79022 commit 592dfbf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions net/mac802154/ieee802154_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
13 changes: 13 additions & 0 deletions net/mac802154/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
9 changes: 1 addition & 8 deletions net/mac802154/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,14 @@ 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);
destroy_workqueue(local->workqueue);

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();

Expand Down

0 comments on commit 592dfbf

Please sign in to comment.