]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/rt2x00/rt2x00dev.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[karo-tx-linux.git] / drivers / net / wireless / rt2x00 / rt2x00dev.c
index 4fd0c25aebf3b9f6147df3381ec2f05ce455a4ec..61510c519351d76ba3af88f475d2732aac0a3540 100644 (file)
@@ -108,11 +108,14 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Enable radio.
         */
-       status = rt2x00dev->ops->lib->set_device_state(rt2x00dev,
-                                                      STATE_RADIO_ON);
+       status =
+           rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_ON);
        if (status)
                return status;
 
+       rt2x00leds_led_radio(rt2x00dev, true);
+       rt2x00led_led_activity(rt2x00dev, true);
+
        __set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags);
 
        /*
@@ -155,6 +158,8 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
         * Disable radio.
         */
        rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF);
+       rt2x00led_led_activity(rt2x00dev, false);
+       rt2x00leds_led_radio(rt2x00dev, false);
 }
 
 void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state)
@@ -401,18 +406,8 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
 {
        struct rt2x00_dev *rt2x00dev =
            container_of(work, struct rt2x00_dev, filter_work);
-       unsigned int filter = rt2x00dev->packet_filter;
-
-       /*
-        * Since we had stored the filter inside rt2x00dev->packet_filter,
-        * we should now clear that field. Otherwise the driver will
-        * assume nothing has changed (*total_flags will be compared
-        * to rt2x00dev->packet_filter to determine if any action is required).
-        */
-       rt2x00dev->packet_filter = 0;
 
-       rt2x00dev->ops->hw->configure_filter(rt2x00dev->hw,
-                                            filter, &filter, 0, NULL);
+       rt2x00dev->ops->lib->config_filter(rt2x00dev, rt2x00dev->packet_filter);
 }
 
 static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
@@ -440,15 +435,16 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
 
        if (delayed_flags & DELAYED_UPDATE_BEACON) {
                skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control);
-               if (skb) {
-                       rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, skb,
-                                                         &control);
+               if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw,
+                                                            skb, &control))
                        dev_kfree_skb(skb);
-               }
        }
 
        if (delayed_flags & DELAYED_CONFIG_ERP)
                rt2x00lib_config_erp(rt2x00dev, intf, &intf->conf);
+
+       if (delayed_flags & DELAYED_LED_ASSOC)
+               rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated);
 }
 
 static void rt2x00lib_intf_scheduled(struct work_struct *work)
@@ -529,9 +525,6 @@ void rt2x00lib_txdone(struct queue_entry *entry,
                        rt2x00dev->low_level_stats.dot11ACKFailureCount++;
        }
 
-       tx_status.queue_length = entry->queue->limit;
-       tx_status.queue_number = tx_status.control.queue;
-
        if (tx_status.control.flags & IEEE80211_TXCTL_USE_RTS_CTS) {
                if (success)
                        rt2x00dev->low_level_stats.dot11RTSSuccessCount++;
@@ -589,6 +582,13 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
                }
        }
 
+       if (idx < 0) {
+               WARNING(rt2x00dev, "Frame received with unrecognized signal,"
+                       "signal=0x%.2x, plcp=%d.\n", rxdesc->signal,
+                       !!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP));
+               idx = 0;
+       }
+
        /*
         * Only update link status if this is a beacon frame carrying our bssid.
         */
@@ -684,8 +684,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
         * Beacons and probe responses require the tsf timestamp
         * to be inserted into the frame.
         */
-       if (control->queue == RT2X00_BCN_QUEUE_BEACON ||
-           is_probe_resp(frame_control))
+       if (txdesc.queue == QID_BEACON || is_probe_resp(frame_control))
                __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc.flags);
 
        /*
@@ -1029,8 +1028,10 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
         * Initialize the device.
         */
        status = rt2x00dev->ops->lib->initialize(rt2x00dev);
-       if (status)
-               goto exit;
+       if (status) {
+               rt2x00queue_uninitialize(rt2x00dev);
+               return status;
+       }
 
        __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
 
@@ -1040,11 +1041,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
        rt2x00rfkill_register(rt2x00dev);
 
        return 0;
-
-exit:
-       rt2x00lib_uninitialize(rt2x00dev);
-
-       return status;
 }
 
 int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
@@ -1187,10 +1183,6 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
         */
        rt2x00debug_deregister(rt2x00dev);
        rt2x00rfkill_free(rt2x00dev);
-
-       /*
-        * Free LED.
-        */
        rt2x00leds_unregister(rt2x00dev);
 
        /*
@@ -1243,11 +1235,20 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
 
 exit:
        /*
-        * Set device mode to sleep for power management.
+        * Set device mode to sleep for power management,
+        * on some hardware this call seems to consistently fail.
+        * From the specifications it is hard to tell why it fails,
+        * and if this is a "bad thing".
+        * Overall it is safe to just ignore the failure and
+        * continue suspending. The only downside is that the
+        * device will not be in optimal power save mode, but with
+        * the radio and the other components already disabled the
+        * device is as good as disabled.
         */
        retval = rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP);
        if (retval)
-               return retval;
+               WARNING(rt2x00dev, "Device failed to enter sleep state, "
+                       "continue suspending.\n");
 
        return 0;
 }