const: constify remaining dev_pm_ops
[safe/jmp/linux-2.6] / net / mac80211 / iface.c
index 1f02b06..80c16f6 100644 (file)
@@ -752,7 +752,8 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
                ieee80211_mandatory_rates(sdata->local,
                        sdata->local->hw.conf.channel->band);
        sdata->drop_unencrypted = 0;
-       sdata->use_4addr = 0;
+       if (type == NL80211_IFTYPE_STATION)
+               sdata->u.mgd.use_4addr = false;
 
        return 0;
 }
@@ -810,6 +811,12 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
        /* setup type-dependent data */
        ieee80211_setup_sdata(sdata, type);
 
+       if (params) {
+               ndev->ieee80211_ptr->use_4addr = params->use_4addr;
+               if (type == NL80211_IFTYPE_STATION)
+                       sdata->u.mgd.use_4addr = params->use_4addr;
+       }
+
        ret = register_netdevice(ndev);
        if (ret)
                goto fail;
@@ -820,9 +827,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
                                            params->mesh_id_len,
                                            params->mesh_id);
 
-       if (params && params->use_4addr >= 0)
-               sdata->use_4addr = !!params->use_4addr;
-
        mutex_lock(&local->iflist_mtx);
        list_add_tail_rcu(&sdata->list, &local->interfaces);
        mutex_unlock(&local->iflist_mtx);
@@ -856,22 +860,18 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
 void ieee80211_remove_interfaces(struct ieee80211_local *local)
 {
        struct ieee80211_sub_if_data *sdata, *tmp;
+       LIST_HEAD(unreg_list);
 
        ASSERT_RTNL();
 
+       mutex_lock(&local->iflist_mtx);
        list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
-               /*
-                * we cannot hold the iflist_mtx across unregister_netdevice,
-                * but we only need to hold it for list modifications to lock
-                * out readers since we're under the RTNL here as all other
-                * writers.
-                */
-               mutex_lock(&local->iflist_mtx);
                list_del(&sdata->list);
-               mutex_unlock(&local->iflist_mtx);
 
-               unregister_netdevice(sdata->dev);
+               unregister_netdevice_queue(sdata->dev, &unreg_list);
        }
+       mutex_unlock(&local->iflist_mtx);
+       unregister_netdevice_many(&unreg_list);
 }
 
 static u32 ieee80211_idle_off(struct ieee80211_local *local,