aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-09-02 23:26:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-08 14:23:13 -0400
commitcb43dc251ab14fc047eb91944e8376d1611b95b2 (patch)
tree5320ba601a057613c955a20e1231fa2bd1ec5f45 /drivers/net/wireless/iwlwifi/iwl-agn.c
parentcd56d3313dedaf68ec393974339edaacab74f82f (diff)
iwlwifi: clean up hw scan handler
This patch cleans up iwl_mac_hw_scan handler. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 676fc0acedee..575c1d978288 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3179,9 +3179,9 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
3179 3179
3180} 3180}
3181 3181
3182static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 3182static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
3183{ 3183{
3184 int rc = 0; 3184 int ret;
3185 unsigned long flags; 3185 unsigned long flags;
3186 struct iwl_priv *priv = hw->priv; 3186 struct iwl_priv *priv = hw->priv;
3187 3187
@@ -3191,41 +3191,38 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
3191 spin_lock_irqsave(&priv->lock, flags); 3191 spin_lock_irqsave(&priv->lock, flags);
3192 3192
3193 if (!iwl_is_ready_rf(priv)) { 3193 if (!iwl_is_ready_rf(priv)) {
3194 rc = -EIO; 3194 ret = -EIO;
3195 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); 3195 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
3196 goto out_unlock; 3196 goto out_unlock;
3197 } 3197 }
3198 3198
3199 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */ 3199 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */
3200 rc = -EIO; 3200 ret = -EIO;
3201 IWL_ERROR("ERROR: APs don't scan\n"); 3201 IWL_ERROR("ERROR: APs don't scan\n");
3202 goto out_unlock; 3202 goto out_unlock;
3203 } 3203 }
3204 3204
3205 /* we don't schedule scan within next_scan_jiffies period */ 3205 /* we don't schedule scan within next_scan_jiffies period */
3206 if (priv->next_scan_jiffies && 3206 if (priv->next_scan_jiffies &&
3207 time_after(priv->next_scan_jiffies, jiffies)) { 3207 time_after(priv->next_scan_jiffies, jiffies)) {
3208 rc = -EAGAIN; 3208 ret = -EAGAIN;
3209 goto out_unlock; 3209 goto out_unlock;
3210 } 3210 }
3211 /* if we just finished scan ask for delay */ 3211 /* if we just finished scan ask for delay */
3212 if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies + 3212 if (priv->last_scan_jiffies &&
3213 IWL_DELAY_NEXT_SCAN, jiffies)) { 3213 time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
3214 rc = -EAGAIN; 3214 ret = -EAGAIN;
3215 goto out_unlock; 3215 goto out_unlock;
3216 } 3216 }
3217 if (len) { 3217 if (ssid_len) {
3218 IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
3219 iwl_escape_essid(ssid, len), (int)len);
3220
3221 priv->one_direct_scan = 1; 3218 priv->one_direct_scan = 1;
3222 priv->direct_ssid_len = (u8) 3219 priv->direct_ssid_len = min_t(u8, ssid_len, IW_ESSID_MAX_SIZE);
3223 min((u8) len, (u8) IW_ESSID_MAX_SIZE);
3224 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); 3220 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
3225 } else 3221 } else {
3226 priv->one_direct_scan = 0; 3222 priv->one_direct_scan = 0;
3223 }
3227 3224
3228 rc = iwl_scan_initiate(priv); 3225 ret = iwl_scan_initiate(priv);
3229 3226
3230 IWL_DEBUG_MAC80211("leave\n"); 3227 IWL_DEBUG_MAC80211("leave\n");
3231 3228
@@ -3233,7 +3230,7 @@ out_unlock:
3233 spin_unlock_irqrestore(&priv->lock, flags); 3230 spin_unlock_irqrestore(&priv->lock, flags);
3234 mutex_unlock(&priv->mutex); 3231 mutex_unlock(&priv->mutex);
3235 3232
3236 return rc; 3233 return ret;
3237} 3234}
3238 3235
3239static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, 3236static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
@@ -4140,7 +4137,7 @@ static struct ieee80211_ops iwl4965_hw_ops = {
4140 .reset_tsf = iwl4965_mac_reset_tsf, 4137 .reset_tsf = iwl4965_mac_reset_tsf,
4141 .bss_info_changed = iwl4965_bss_info_changed, 4138 .bss_info_changed = iwl4965_bss_info_changed,
4142 .ampdu_action = iwl4965_mac_ampdu_action, 4139 .ampdu_action = iwl4965_mac_ampdu_action,
4143 .hw_scan = iwl4965_mac_hw_scan 4140 .hw_scan = iwl_mac_hw_scan
4144}; 4141};
4145 4142
4146static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 4143static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)