rt2x00: Disable link tuning while scanning
[pandora-kernel.git] / drivers / net / wireless / rt2x00 / rt2x00link.c
index 801925b..14f1d51 100644 (file)
@@ -278,6 +278,15 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
        if (!rt2x00dev->intf_sta_count)
                return;
 
+       /**
+        * While scanning, link tuning is disabled. By default
+        * the most sensitive settings will be used to make sure
+        * that all beacons and probe responses will be recieved
+        * during the scan.
+        */
+       if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
+               return;
+
        rt2x00link_reset_tuner(rt2x00dev, false);
 
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
@@ -338,7 +347,8 @@ static void rt2x00link_tuner(struct work_struct *work)
         * When the radio is shutting down we should
         * immediately cease all link tuning.
         */
-       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
+       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
+           test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
                return;
 
        /*