iwl3945: use iwl_mac_hw_scan callback
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Wed, 18 Feb 2009 23:54:27 +0000 (15:54 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Feb 2009 19:52:45 +0000 (14:52 -0500)
3945 can use iwl_mac_hw_scan callback instead of
iwl3945_mac_hw_scan callback.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Acked-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl3945-base.c

index ad310050e298ed0e6aad62cd4fe85191f24f9d7e..e6168672a5341676127f9dd52492d15670cac6d4 100644 (file)
@@ -2677,71 +2677,6 @@ static void iwl_bss_info_changed(struct ieee80211_hw *hw,
 
 }
 
-static int iwl_mac_hw_scan(struct ieee80211_hw *hw,
-                          struct cfg80211_scan_request *req)
-{
-       unsigned long flags;
-       struct iwl_priv *priv = hw->priv;
-       int ret;
-       u8 *ssid = NULL;
-       size_t ssid_len = 0;
-
-       if (req->n_ssids) {
-               ssid = req->ssids[0].ssid;
-               ssid_len = req->ssids[0].ssid_len;
-       }
-
-       IWL_DEBUG_MAC80211(priv, "enter\n");
-
-       mutex_lock(&priv->mutex);
-       spin_lock_irqsave(&priv->lock, flags);
-
-       if (!iwl_is_ready_rf(priv)) {
-               ret = -EIO;
-               IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
-               goto out_unlock;
-       }
-
-       /* We don't schedule scan within next_scan_jiffies period.
-        * Avoid scanning during possible EAPOL exchange, return
-        * success immediately.
-        */
-       if (priv->next_scan_jiffies &&
-           time_after(priv->next_scan_jiffies, jiffies)) {
-               IWL_DEBUG_SCAN(priv, "scan rejected: within next scan period\n");
-               queue_work(priv->workqueue, &priv->scan_completed);
-               ret = 0;
-               goto out_unlock;
-       }
-
-       /* if we just finished scan ask for delay */
-       if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
-           time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
-               IWL_DEBUG_SCAN(priv, "scan rejected: within previous scan period\n");
-               queue_work(priv->workqueue, &priv->scan_completed);
-               ret = 0;
-               goto out_unlock;
-       }
-
-       if (ssid_len) {
-               priv->one_direct_scan = 1;
-               priv->direct_ssid_len = ssid_len;
-               memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
-       } else {
-               priv->one_direct_scan = 0;
-       }
-
-       ret = iwl_scan_initiate(priv);
-
-       IWL_DEBUG_MAC80211(priv, "leave\n");
-
-out_unlock:
-       spin_unlock_irqrestore(&priv->lock, flags);
-       mutex_unlock(&priv->mutex);
-
-       return ret;
-}
-
 static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
                        struct ieee80211_key_conf *keyconf, const u8 *addr,
                        u32 iv32, u16 *phase1key)
index 10ee20c8b53dd9b3e55b415363b47fd8c6ea6d33..f3aa07c99c6e6ad24057d5e1e812f434d5d76615 100644 (file)
@@ -345,6 +345,7 @@ void iwl_init_scan_params(struct iwl_priv *priv);
 int iwl_scan_cancel(struct iwl_priv *priv);
 int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms);
 int iwl_scan_initiate(struct iwl_priv *priv);
+int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req);
 u16 iwl_fill_probe_req(struct iwl_priv *priv, enum ieee80211_band band,
                       struct ieee80211_mgmt *frame, int left);
 void iwl_setup_rx_scan_handlers(struct iwl_priv *priv);
index 1ec2b20eb37c27f245a850442e1433a524752f74..23644cf884f12d2ddf596ca0a8f690312b01303a 100644 (file)
@@ -440,6 +440,74 @@ int iwl_scan_initiate(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_scan_initiate);
 
+#define IWL_DELAY_NEXT_SCAN (HZ*2)
+
+int iwl_mac_hw_scan(struct ieee80211_hw *hw,
+                    struct cfg80211_scan_request *req)
+{
+       unsigned long flags;
+       struct iwl_priv *priv = hw->priv;
+       int ret;
+       u8 *ssid = NULL;
+       size_t ssid_len = 0;
+
+       if (req->n_ssids) {
+               ssid = req->ssids[0].ssid;
+               ssid_len = req->ssids[0].ssid_len;
+       }
+
+       IWL_DEBUG_MAC80211(priv, "enter\n");
+
+       mutex_lock(&priv->mutex);
+       spin_lock_irqsave(&priv->lock, flags);
+
+       if (!iwl_is_ready_rf(priv)) {
+               ret = -EIO;
+               IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
+               goto out_unlock;
+       }
+
+       /* We don't schedule scan within next_scan_jiffies period.
+        * Avoid scanning during possible EAPOL exchange, return
+        * success immediately.
+        */
+       if (priv->next_scan_jiffies &&
+           time_after(priv->next_scan_jiffies, jiffies)) {
+               IWL_DEBUG_SCAN(priv, "scan rejected: within next scan period\n");
+               queue_work(priv->workqueue, &priv->scan_completed);
+               ret = 0;
+               goto out_unlock;
+       }
+
+       /* if we just finished scan ask for delay */
+       if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
+           time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
+               IWL_DEBUG_SCAN(priv, "scan rejected: within previous scan period\n");
+               queue_work(priv->workqueue, &priv->scan_completed);
+               ret = 0;
+               goto out_unlock;
+       }
+
+       if (ssid_len) {
+               priv->one_direct_scan = 1;
+               priv->direct_ssid_len =  ssid_len;
+               memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
+       } else {
+               priv->one_direct_scan = 0;
+       }
+
+       ret = iwl_scan_initiate(priv);
+
+       IWL_DEBUG_MAC80211(priv, "leave\n");
+
+out_unlock:
+       spin_unlock_irqrestore(&priv->lock, flags);
+       mutex_unlock(&priv->mutex);
+
+       return ret;
+}
+EXPORT_SYMBOL(iwl_mac_hw_scan);
+
 #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
 
 void iwl_bg_scan_check(struct work_struct *data)
index 2ad4d760ad2d3b029c7789ee321d2974579963a5..6d816ebd7cea47570f24f335fd72a86145e21c3b 100644 (file)
@@ -726,38 +726,6 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
                le16_to_cpu(priv->rxon_timing.atim_window));
 }
 
-static int iwl3945_scan_initiate(struct iwl_priv *priv)
-{
-       if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
-               return -EIO;
-       }
-
-       if (test_bit(STATUS_SCANNING, &priv->status)) {
-               IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
-               return -EAGAIN;
-       }
-
-       if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_SCAN(priv, "Scan request while abort pending.  "
-                              "Queuing.\n");
-               return -EAGAIN;
-       }
-
-       IWL_DEBUG_INFO(priv, "Starting scan...\n");
-       if (priv->cfg->sku & IWL_SKU_G)
-               priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
-       if (priv->cfg->sku & IWL_SKU_A)
-               priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
-       set_bit(STATUS_SCANNING, &priv->status);
-       priv->scan_start = jiffies;
-       priv->scan_pass_start = priv->scan_start;
-
-       queue_work(priv->workqueue, &priv->request_scan);
-
-       return 0;
-}
-
 static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
 {
        if (mode == NL80211_IFTYPE_ADHOC) {
@@ -4316,66 +4284,6 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
 
 }
 
-static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw,
-                              struct cfg80211_scan_request *req)
-{
-       int rc = 0;
-       unsigned long flags;
-       struct iwl_priv *priv = hw->priv;
-       size_t len = 0;
-       u8 *ssid = NULL;
-       DECLARE_SSID_BUF(ssid_buf);
-
-       IWL_DEBUG_MAC80211(priv, "enter\n");
-
-       if (req->n_ssids) {
-               ssid = req->ssids[0].ssid;
-               len = req->ssids[0].ssid_len;
-       }
-
-       mutex_lock(&priv->mutex);
-       spin_lock_irqsave(&priv->lock, flags);
-
-       if (!iwl_is_ready_rf(priv)) {
-               rc = -EIO;
-               IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
-               goto out_unlock;
-       }
-
-       /* we don't schedule scan within next_scan_jiffies period */
-       if (priv->next_scan_jiffies &&
-                       time_after(priv->next_scan_jiffies, jiffies)) {
-               rc = -EAGAIN;
-               goto out_unlock;
-       }
-       /* if we just finished scan ask for delay for a broadcast scan */
-       if ((len == 0) && priv->last_scan_jiffies &&
-           time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN,
-                      jiffies)) {
-               rc = -EAGAIN;
-               goto out_unlock;
-       }
-       if (len) {
-               IWL_DEBUG_SCAN(priv, "direct scan for %s [%zd]\n ",
-                              print_ssid(ssid_buf, ssid, len), len);
-
-               priv->one_direct_scan = 1;
-               priv->direct_ssid_len = len;
-               memcpy(priv->direct_ssid, ssid, len);
-       } else
-               priv->one_direct_scan = 0;
-
-       rc = iwl3945_scan_initiate(priv);
-
-       IWL_DEBUG_MAC80211(priv, "leave\n");
-
-out_unlock:
-       spin_unlock_irqrestore(&priv->lock, flags);
-       mutex_unlock(&priv->mutex);
-
-       return rc;
-}
-
 static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                               struct ieee80211_vif *vif,
                               struct ieee80211_sta *sta,
@@ -5149,7 +5057,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
        .conf_tx = iwl3945_mac_conf_tx,
        .reset_tsf = iwl3945_mac_reset_tsf,
        .bss_info_changed = iwl3945_bss_info_changed,
-       .hw_scan = iwl3945_mac_hw_scan
+       .hw_scan = iwl_mac_hw_scan
 };
 
 static int iwl3945_init_drv(struct iwl_priv *priv)