Merge 5.10-rc4 into char-misc-next
[linux-2.6-microblaze.git] / net / wireless / core.c
index 9f23923..240282c 100644 (file)
@@ -1250,8 +1250,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 EXPORT_SYMBOL(cfg80211_stop_iface);
 
-void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev)
+void cfg80211_init_wdev(struct wireless_dev *wdev)
 {
        mutex_init(&wdev->mtx);
        INIT_LIST_HEAD(&wdev->event_list);
@@ -1262,6 +1261,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
        spin_lock_init(&wdev->pmsr_lock);
        INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
 
+#ifdef CONFIG_CFG80211_WEXT
+       wdev->wext.default_key = -1;
+       wdev->wext.default_mgmt_key = -1;
+       wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+#endif
+
+       if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
+               wdev->ps = true;
+       else
+               wdev->ps = false;
+       /* allow mac80211 to determine the timeout */
+       wdev->ps_timeout = -1;
+
+       if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+            wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
+            wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
+               wdev->netdev->priv_flags |= IFF_DONT_BRIDGE;
+
+       INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
+}
+
+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
+                           struct wireless_dev *wdev)
+{
        /*
         * We get here also when the interface changes network namespaces,
         * as it's registered into the new one, but we don't want it to
@@ -1295,6 +1318,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
        switch (state) {
        case NETDEV_POST_INIT:
                SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+               wdev->netdev = dev;
+               /* can only change netns with wiphy */
+               dev->features |= NETIF_F_NETNS_LOCAL;
+
+               cfg80211_init_wdev(wdev);
                break;
        case NETDEV_REGISTER:
                /*
@@ -1302,35 +1330,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                 * called within code protected by it when interfaces
                 * are added with nl80211.
                 */
-               /* can only change netns with wiphy */
-               dev->features |= NETIF_F_NETNS_LOCAL;
-
                if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
                                      "phy80211")) {
                        pr_err("failed to add phy80211 symlink to netdev!\n");
                }
-               wdev->netdev = dev;
-#ifdef CONFIG_CFG80211_WEXT
-               wdev->wext.default_key = -1;
-               wdev->wext.default_mgmt_key = -1;
-               wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
-#endif
-
-               if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
-                       wdev->ps = true;
-               else
-                       wdev->ps = false;
-               /* allow mac80211 to determine the timeout */
-               wdev->ps_timeout = -1;
-
-               if ((wdev->iftype == NL80211_IFTYPE_STATION ||
-                    wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
-                    wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
-                       dev->priv_flags |= IFF_DONT_BRIDGE;
-
-               INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
 
-               cfg80211_init_wdev(rdev, wdev);
+               cfg80211_register_wdev(rdev, wdev);
                break;
        case NETDEV_GOING_DOWN:
                cfg80211_leave(rdev, wdev);