Commit 948f5a2f authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

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: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 3edb5fd6
...@@ -3109,9 +3109,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3109,9 +3109,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv); iwlcore_commit_rxon(priv);
iwl_setup_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, vif);
ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
sizeof(priv->rxon_timing), &priv->rxon_timing);
if (ret) if (ret)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
...@@ -3347,9 +3345,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3347,9 +3345,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
iwlcore_commit_rxon(priv); iwlcore_commit_rxon(priv);
/* RXON Timing */ /* RXON Timing */
iwl_setup_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, vif);
ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
sizeof(priv->rxon_timing), &priv->rxon_timing);
if (ret) if (ret)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
......
...@@ -491,17 +491,19 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) ...@@ -491,17 +491,19 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
return new_val; return new_val;
} }
void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
{ {
u64 tsf; u64 tsf;
s32 interval_tm, rem; s32 interval_tm, rem;
unsigned long flags;
struct ieee80211_conf *conf = NULL; struct ieee80211_conf *conf = NULL;
u16 beacon_int; u16 beacon_int;
conf = ieee80211_get_hw_conf(priv->hw); conf = ieee80211_get_hw_conf(priv->hw);
spin_lock_irqsave(&priv->lock, flags); lockdep_assert_held(&priv->mutex);
memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp);
priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval);
...@@ -524,14 +526,16 @@ void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -524,14 +526,16 @@ void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
rem = do_div(tsf, interval_tm); rem = do_div(tsf, interval_tm);
priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem); priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
spin_unlock_irqrestore(&priv->lock, flags);
IWL_DEBUG_ASSOC(priv, IWL_DEBUG_ASSOC(priv,
"beacon interval %d beacon timer %d beacon tim %d\n", "beacon interval %d beacon timer %d beacon tim %d\n",
le16_to_cpu(priv->rxon_timing.beacon_interval), le16_to_cpu(priv->rxon_timing.beacon_interval),
le32_to_cpu(priv->rxon_timing.beacon_init_val), le32_to_cpu(priv->rxon_timing.beacon_init_val),
le16_to_cpu(priv->rxon_timing.atim_window)); le16_to_cpu(priv->rxon_timing.atim_window));
return iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
sizeof(priv->rxon_timing), &priv->rxon_timing);
} }
EXPORT_SYMBOL(iwl_setup_rxon_timing); EXPORT_SYMBOL(iwl_send_rxon_timing);
void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
{ {
......
...@@ -714,7 +714,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, ...@@ -714,7 +714,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv,
void iwl_apm_stop(struct iwl_priv *priv); void iwl_apm_stop(struct iwl_priv *priv);
int iwl_apm_init(struct iwl_priv *priv); int iwl_apm_init(struct iwl_priv *priv);
void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif);
static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) static inline int iwl_send_rxon_assoc(struct iwl_priv *priv)
{ {
return priv->cfg->ops->hcmd->rxon_assoc(priv); return priv->cfg->ops->hcmd->rxon_assoc(priv);
......
...@@ -3094,10 +3094,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3094,10 +3094,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv); iwlcore_commit_rxon(priv);
memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); rc = iwl_send_rxon_timing(priv, vif);
iwl_setup_rxon_timing(priv, vif);
rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
sizeof(priv->rxon_timing), &priv->rxon_timing);
if (rc) if (rc)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
...@@ -3271,11 +3268,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3271,11 +3268,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
iwlcore_commit_rxon(priv); iwlcore_commit_rxon(priv);
/* RXON Timing */ /* RXON Timing */
memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); rc = iwl_send_rxon_timing(priv, vif);
iwl_setup_rxon_timing(priv, vif);
rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
sizeof(priv->rxon_timing),
&priv->rxon_timing);
if (rc) if (rc)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment