rt2x00: Improve interface_modes initialization
authorIvo van Doorn <ivdoorn@gmail.com>
Wed, 29 Oct 2008 16:18:46 +0000 (17:18 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 10 Nov 2008 20:17:33 +0000 (15:17 -0500)
All operating modes which require beaconing should
depend on the availability of beacon entries from
the hardware.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00dev.c

index c42e4fdf0a1b48fef884659b570bec236e347cda..477a944167c47f1d9370d4843bf7c01f12ccc5ae 100644 (file)
@@ -1056,10 +1056,16 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
         */
        rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf);
 
-       rt2x00dev->hw->wiphy->interface_modes =
-           BIT(NL80211_IFTYPE_AP) |
-           BIT(NL80211_IFTYPE_STATION) |
-           BIT(NL80211_IFTYPE_ADHOC);
+       /*
+        * Determine which operating modes are supported, all modes
+        * which require beaconing, depend on the availability of
+        * beacon entries.
+        */
+       rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
+       if (rt2x00dev->ops->bcn->entry_num > 0)
+               rt2x00dev->hw->wiphy->interface_modes |=
+                   BIT(NL80211_IFTYPE_ADHOC) |
+                   BIT(NL80211_IFTYPE_AP);
 
        /*
         * Let the driver probe the device to detect the capabilities.