]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/iwlwifi/iwl3945-base.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireles...
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwl3945-base.c
index 2a5245b63e32ea547994ee840c7decfd9e5c8ab2..13925b627e3b5569f5ebaf1399f121dea3d489d2 100644 (file)
@@ -70,7 +70,7 @@ static int iwl3945_param_disable;  /* def: 0 = enable radio */
 static int iwl3945_param_antenna;  /* def: 0 = both antennas (use diversity) */
 int iwl3945_param_hwcrypto;        /* def: 0 = use software encryption */
 static int iwl3945_param_qos_enable = 1; /* def: 1 = use quality of service */
-int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 8 Tx queues */
+int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */
 
 /*
  * module name, copyright, version, etc.
@@ -733,17 +733,17 @@ static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_
 {
        int cmd_idx;
        int ret;
-       static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
 
        BUG_ON(cmd->meta.flags & CMD_ASYNC);
 
         /* A synchronous command can not have a callback set. */
        BUG_ON(cmd->meta.u.callback != NULL);
 
-       if (atomic_xchg(&entry, 1)) {
+       if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) {
                IWL_ERROR("Error sending %s: Already sending a host command\n",
                          get_cmd_string(cmd->id));
-               return -EBUSY;
+               ret = -EBUSY;
+               goto out;
        }
 
        set_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -813,7 +813,7 @@ fail:
                cmd->meta.u.skb = NULL;
        }
 out:
-       atomic_set(&entry, 0);
+       clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status);
        return ret;
 }
 
@@ -4965,15 +4965,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
        passive_dwell = iwl3945_get_passive_dwell_time(priv, band);
 
        for (i = 0, added = 0; i < sband->n_channels; i++) {
-               if (channels[i].hw_value ==
-                   le16_to_cpu(priv->active_rxon.channel)) {
-                       if (iwl3945_is_associated(priv)) {
-                               IWL_DEBUG_SCAN
-                                   ("Skipping current channel %d\n",
-                                    le16_to_cpu(priv->active_rxon.channel));
-                               continue;
-                       }
-               } else if (priv->only_active_channel)
+               if (channels[i].flags & IEEE80211_CHAN_DISABLED)
                        continue;
 
                scan_ch->channel = channels[i].hw_value;
@@ -5874,15 +5866,16 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
 
        iwl3945_reg_txpower_periodic(priv);
 
+       iwl3945_led_register(priv);
+
        IWL_DEBUG_INFO("ALIVE processing complete.\n");
        set_bit(STATUS_READY, &priv->status);
        wake_up_interruptible(&priv->wait_command_queue);
 
-       iwl3945_led_register(priv);
-
        if (priv->error_recovering)
                iwl3945_error_recovery(priv);
 
+       ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
        return;
 
  restart:
@@ -6299,12 +6292,17 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
                       priv->direct_ssid, priv->direct_ssid_len);
                direct_mask = 1;
        } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
+               IWL_DEBUG_SCAN
+                 ("Kicking off one direct scan for '%s' when not associated\n",
+                  iwl3945_escape_essid(priv->essid, priv->essid_len));
                scan->direct_scan[0].id = WLAN_EID_SSID;
                scan->direct_scan[0].len = priv->essid_len;
                memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
                direct_mask = 1;
-       } else
+       } else {
+               IWL_DEBUG_SCAN("Kicking off one indirect scan.\n");
                direct_mask = 0;
+       }
 
        /* We don't build a direct scan probe request; the uCode will do
         * that based on the direct_mask added to each channel entry */
@@ -6342,23 +6340,18 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
        if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR)
                scan->filter_flags = RXON_FILTER_PROMISC_MSK;
 
-       if (direct_mask) {
-               IWL_DEBUG_SCAN
-                   ("Initiating direct scan for %s.\n",
-                    iwl3945_escape_essid(priv->essid, priv->essid_len));
+       if (direct_mask)
                scan->channel_count =
                        iwl3945_get_channels_for_scan(
                                priv, band, 1, /* active */
                                direct_mask,
                                (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
-       } else {
-               IWL_DEBUG_SCAN("Initiating indirect scan.\n");
+       else
                scan->channel_count =
                        iwl3945_get_channels_for_scan(
                                priv, band, 0, /* passive */
                                direct_mask,
                                (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
-       }
 
        cmd.len += le16_to_cpu(scan->tx_cmd.len) +
            scan->channel_count * sizeof(struct iwl3945_scan_channel);
@@ -6903,7 +6896,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
 
        if (priv->vif != vif) {
                IWL_DEBUG_MAC80211("leave - priv->vif != vif\n");
-               mutex_unlock(&priv->mutex);
                return 0;
        }
 
@@ -7311,8 +7303,6 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
                return;
        }
 
-       priv->only_active_channel = 0;
-
        iwl3945_set_rate(priv);
 
        mutex_unlock(&priv->mutex);
@@ -7970,10 +7960,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                iwl3945_hw_ops.hw_scan = NULL;
        }
 
-       if ((iwl3945_param_queues_num > IWL_MAX_NUM_QUEUES) ||
+       if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) ||
            (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) {
                IWL_ERROR("invalid queues_num, should be between %d and %d\n",
-                         IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES);
+                         IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES);
                err = -EINVAL;
                goto out;
        }
@@ -8156,7 +8146,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                goto out_free_channel_map;
        }
 
-       iwl3945_rate_control_register(priv->hw);
        err = ieee80211_register_hw(priv->hw);
        if (err) {
                IWL_ERROR("Failed to register network device (error %d)\n", err);
@@ -8241,7 +8230,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
 
        if (priv->mac80211_registered) {
                ieee80211_unregister_hw(priv->hw);
-               iwl3945_rate_control_unregister(priv->hw);
        }
 
        /*netif_stop_queue(dev); */
@@ -8322,21 +8310,35 @@ static int __init iwl3945_init(void)
        int ret;
        printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
        printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
+
+       ret = iwl3945_rate_control_register();
+       if (ret) {
+               IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
+               return ret;
+       }
+
        ret = pci_register_driver(&iwl3945_driver);
        if (ret) {
                IWL_ERROR("Unable to initialize PCI module\n");
-               return ret;
+               goto error_register;
        }
 #ifdef CONFIG_IWL3945_DEBUG
        ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
        if (ret) {
                IWL_ERROR("Unable to create driver sysfs file\n");
-               pci_unregister_driver(&iwl3945_driver);
-               return ret;
+               goto error_debug;
        }
 #endif
 
        return ret;
+
+#ifdef CONFIG_IWL3945_DEBUG
+error_debug:
+       pci_unregister_driver(&iwl3945_driver);
+#endif
+error_register:
+       iwl3945_rate_control_unregister();
+       return ret;
 }
 
 static void __exit iwl3945_exit(void)
@@ -8345,6 +8347,7 @@ static void __exit iwl3945_exit(void)
        driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
 #endif
        pci_unregister_driver(&iwl3945_driver);
+       iwl3945_rate_control_unregister();
 }
 
 module_param_named(antenna, iwl3945_param_antenna, int, 0444);