Commit b210b187 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 9f3295b9
...@@ -28,7 +28,9 @@ ieee802154_add_iface_deprecated(struct wpan_phy *wpan_phy, ...@@ -28,7 +28,9 @@ ieee802154_add_iface_deprecated(struct wpan_phy *wpan_phy,
static void ieee802154_del_iface_deprecated(struct wpan_phy *wpan_phy, static void ieee802154_del_iface_deprecated(struct wpan_phy *wpan_phy,
struct net_device *dev) struct net_device *dev)
{ {
mac802154_del_iface(wpan_phy, dev); struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
ieee802154_if_remove(sdata);
} }
const struct cfg802154_ops mac802154_config_ops = { const struct cfg802154_ops mac802154_config_ops = {
......
...@@ -175,6 +175,6 @@ void mac802154_unlock_table(struct net_device *dev); ...@@ -175,6 +175,6 @@ void mac802154_unlock_table(struct net_device *dev);
struct net_device * struct net_device *
mac802154_add_iface(struct wpan_phy *phy, const char *name, int type); mac802154_add_iface(struct wpan_phy *phy, const char *name, int type);
void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev); void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
#endif /* __IEEE802154_I_H */ #endif /* __IEEE802154_I_H */
...@@ -443,3 +443,15 @@ void mac802154_monitor_setup(struct net_device *dev) ...@@ -443,3 +443,15 @@ void mac802154_monitor_setup(struct net_device *dev)
sdata->promisuous_mode = true; sdata->promisuous_mode = true;
} }
void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)
{
ASSERT_RTNL();
mutex_lock(&sdata->local->iflist_mtx);
list_del_rcu(&sdata->list);
mutex_unlock(&sdata->local->iflist_mtx);
synchronize_rcu();
unregister_netdevice(sdata->dev);
}
...@@ -59,22 +59,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) ...@@ -59,22 +59,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
return 0; return 0;
} }
void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
ASSERT_RTNL();
BUG_ON(sdata->local->phy != phy);
mutex_lock(&sdata->local->iflist_mtx);
list_del_rcu(&sdata->list);
mutex_unlock(&sdata->local->iflist_mtx);
synchronize_rcu();
unregister_netdevice(sdata->dev);
}
struct net_device * struct net_device *
mac802154_add_iface(struct wpan_phy *phy, const char *name, int type) mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment