aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-07-29 10:07:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-24 16:32:01 -0400
commit948f5a2f08cb782adf3c5bb92abc6dbec2b4275f (patch)
treeb39102616526af0856996ae38dad9976dfd4fc53 /drivers/net
parent3edb5fd6ac898182a186d403695986f6ff51ac65 (diff)
iwlwifi: refactor iwl_setup_rxon_timing
All callers of iwl_setup_rxon_timing() also send the command right away, so rename the function to iwl_send_rxon_timing() and move the sending into it. Also, some callers clear the data, this can be done always and thus moved in as well. Finally, there's no reason for the function to acquire the spinlock, but it should be called with the mutex held, so assert that. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c11
4 files changed, 14 insertions, 21 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 61ecd180982e..f832535c3a47 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3109,9 +3109,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3109 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3109 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3110 iwlcore_commit_rxon(priv); 3110 iwlcore_commit_rxon(priv);
3111 3111
3112 iwl_setup_rxon_timing(priv, vif); 3112 ret = iwl_send_rxon_timing(priv, vif);
3113 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3114 sizeof(priv->rxon_timing), &priv->rxon_timing);
3115 if (ret) 3113 if (ret)
3116 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3114 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3117 "Attempting to continue.\n"); 3115 "Attempting to continue.\n");
@@ -3347,9 +3345,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3347 iwlcore_commit_rxon(priv); 3345 iwlcore_commit_rxon(priv);
3348 3346
3349 /* RXON Timing */ 3347 /* RXON Timing */
3350 iwl_setup_rxon_timing(priv, vif); 3348 ret = iwl_send_rxon_timing(priv, vif);
3351 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3352 sizeof(priv->rxon_timing), &priv->rxon_timing);
3353 if (ret) 3349 if (ret)
3354 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3350 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3355 "Attempting to continue.\n"); 3351 "Attempting to continue.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 602636c88fef..7754be4463d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -491,17 +491,19 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
491 return new_val; 491 return new_val;
492} 492}
493 493
494void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) 494int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
495{ 495{
496 u64 tsf; 496 u64 tsf;
497 s32 interval_tm, rem; 497 s32 interval_tm, rem;
498 unsigned long flags;
499 struct ieee80211_conf *conf = NULL; 498 struct ieee80211_conf *conf = NULL;
500 u16 beacon_int; 499 u16 beacon_int;
501 500
502 conf = ieee80211_get_hw_conf(priv->hw); 501 conf = ieee80211_get_hw_conf(priv->hw);
503 502
504 spin_lock_irqsave(&priv->lock, flags); 503 lockdep_assert_held(&priv->mutex);
504
505 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
506
505 priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); 507 priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp);
506 priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); 508 priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval);
507 509
@@ -524,14 +526,16 @@ void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
524 rem = do_div(tsf, interval_tm); 526 rem = do_div(tsf, interval_tm);
525 priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem); 527 priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
526 528
527 spin_unlock_irqrestore(&priv->lock, flags);
528 IWL_DEBUG_ASSOC(priv, 529 IWL_DEBUG_ASSOC(priv,
529 "beacon interval %d beacon timer %d beacon tim %d\n", 530 "beacon interval %d beacon timer %d beacon tim %d\n",
530 le16_to_cpu(priv->rxon_timing.beacon_interval), 531 le16_to_cpu(priv->rxon_timing.beacon_interval),
531 le32_to_cpu(priv->rxon_timing.beacon_init_val), 532 le32_to_cpu(priv->rxon_timing.beacon_init_val),
532 le16_to_cpu(priv->rxon_timing.atim_window)); 533 le16_to_cpu(priv->rxon_timing.atim_window));
534
535 return iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
536 sizeof(priv->rxon_timing), &priv->rxon_timing);
533} 537}
534EXPORT_SYMBOL(iwl_setup_rxon_timing); 538EXPORT_SYMBOL(iwl_send_rxon_timing);
535 539
536void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 540void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
537{ 541{
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index f5586b5e0496..edadca510099 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -714,7 +714,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv,
714void iwl_apm_stop(struct iwl_priv *priv); 714void iwl_apm_stop(struct iwl_priv *priv);
715int iwl_apm_init(struct iwl_priv *priv); 715int iwl_apm_init(struct iwl_priv *priv);
716 716
717void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); 717int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif);
718static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) 718static inline int iwl_send_rxon_assoc(struct iwl_priv *priv)
719{ 719{
720 return priv->cfg->ops->hcmd->rxon_assoc(priv); 720 return priv->cfg->ops->hcmd->rxon_assoc(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index faa2e0037e10..84494b1f833e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3094,10 +3094,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3094 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3094 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3095 iwlcore_commit_rxon(priv); 3095 iwlcore_commit_rxon(priv);
3096 3096
3097 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3097 rc = iwl_send_rxon_timing(priv, vif);
3098 iwl_setup_rxon_timing(priv, vif);
3099 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3100 sizeof(priv->rxon_timing), &priv->rxon_timing);
3101 if (rc) 3098 if (rc)
3102 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3099 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3103 "Attempting to continue.\n"); 3100 "Attempting to continue.\n");
@@ -3271,11 +3268,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3271 iwlcore_commit_rxon(priv); 3268 iwlcore_commit_rxon(priv);
3272 3269
3273 /* RXON Timing */ 3270 /* RXON Timing */
3274 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3271 rc = iwl_send_rxon_timing(priv, vif);
3275 iwl_setup_rxon_timing(priv, vif);
3276 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3277 sizeof(priv->rxon_timing),
3278 &priv->rxon_timing);
3279 if (rc) 3272 if (rc)
3280 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3273 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3281 "Attempting to continue.\n"); 3274 "Attempting to continue.\n");