]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/wireless/util.c
cfg80211: remove radar requirements check from cfg80211_can_use_iftype_chan()
[karo-tx-linux.git] / net / wireless / util.c
index d39c37104ae2f125c5def9c943dc65ab8a669f5a..57b3ce7a6b9255df15b5064ac5fd177414a662cc 100644 (file)
@@ -820,7 +820,8 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev)
                                                ev->dc.reason, true);
                        break;
                case EVENT_IBSS_JOINED:
-                       __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid);
+                       __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid,
+                                              ev->ij.channel);
                        break;
                }
                wdev_unlock(wdev);
@@ -1268,7 +1269,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
        enum cfg80211_chan_mode chmode;
        int num_different_channels = 0;
        int total = 1;
-       bool radar_required = false;
        int i, j;
 
        ASSERT_RTNL();
@@ -1276,35 +1276,7 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
        if (WARN_ON(hweight32(radar_detect) > 1))
                return -EINVAL;
 
-       switch (iftype) {
-       case NL80211_IFTYPE_ADHOC:
-       case NL80211_IFTYPE_AP:
-       case NL80211_IFTYPE_AP_VLAN:
-       case NL80211_IFTYPE_MESH_POINT:
-       case NL80211_IFTYPE_P2P_GO:
-       case NL80211_IFTYPE_WDS:
-               /* if the interface could potentially choose a DFS channel,
-                * then mark DFS as required.
-                */
-               if (!chan) {
-                       if (chanmode != CHAN_MODE_UNDEFINED && radar_detect)
-                               radar_required = true;
-                       break;
-               }
-               radar_required = !!(chan->flags & IEEE80211_CHAN_RADAR);
-               break;
-       case NL80211_IFTYPE_P2P_CLIENT:
-       case NL80211_IFTYPE_STATION:
-       case NL80211_IFTYPE_P2P_DEVICE:
-       case NL80211_IFTYPE_MONITOR:
-               break;
-       case NUM_NL80211_IFTYPES:
-       case NL80211_IFTYPE_UNSPECIFIED:
-       default:
-               return -EINVAL;
-       }
-
-       if (radar_required && !radar_detect)
+       if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
                return -EINVAL;
 
        /* Always allow software iftypes */
@@ -1356,7 +1328,7 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
                 */
                mutex_lock_nested(&wdev_iter->mtx, 1);
                __acquire(wdev_iter->mtx);
-               cfg80211_get_chan_state(wdev_iter, &ch, &chmode);
+               cfg80211_get_chan_state(wdev_iter, &ch, &chmode, &radar_detect);
                wdev_unlock(wdev_iter);
 
                switch (chmode) {