aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/main.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-07-09 14:40:35 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-07-14 14:30:07 -0400
commit75636525fbfa78fa33fd754c89785cfde750acd3 (patch)
tree2c614681382a53bec50248c621ba4c8bb07ce670 /net/mac80211/main.c
parent3e122be089e6fb8d3f322416da4cdbb80ce12927 (diff)
mac80211: revamp virtual interface handling
This patch revamps the virtual interface handling and makes the code much easier to follow. Fewer functions, better names, less spaghetti code. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r--net/mac80211/main.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 863923964d2..0759ab2ca3f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -971,7 +971,6 @@ static const struct header_ops ieee80211_header_ops = {
.cache_update = eth_header_cache_update,
};
-/* Must not be called for mdev */
void ieee80211_if_setup(struct net_device *dev)
{
ether_setup(dev);
@@ -981,7 +980,7 @@ void ieee80211_if_setup(struct net_device *dev)
dev->change_mtu = ieee80211_change_mtu;
dev->open = ieee80211_open;
dev->stop = ieee80211_stop;
- dev->destructor = ieee80211_if_free;
+ dev->destructor = free_netdev;
}
/* everything else */
@@ -1776,7 +1775,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
wiphy_name(local->hw.wiphy));
- local->reg_state = IEEE80211_DEV_REGISTERED;
rtnl_unlock();
ieee80211_led_init(local);
@@ -1806,30 +1804,20 @@ EXPORT_SYMBOL(ieee80211_register_hw);
void ieee80211_unregister_hw(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
- struct ieee80211_sub_if_data *sdata, *tmp;
tasklet_kill(&local->tx_pending_tasklet);
tasklet_kill(&local->tasklet);
rtnl_lock();
- BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED);
-
- local->reg_state = IEEE80211_DEV_UNREGISTERED;
-
/*
* At this point, interface list manipulations are fine
* because the driver cannot be handing us frames any
* more and the tasklet is killed.
*/
- /*
- * First, we remove all virtual interfaces.
- */
- list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
- list_del(&sdata->list);
- __ieee80211_if_del(local, sdata);
- }
+ /* First, we remove all virtual interfaces. */
+ ieee80211_remove_interfaces(local);
/* then, finally, remove the master interface */
unregister_netdevice(local->mdev);