aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-04-30 17:08:00 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-05-13 13:42:32 -0400
commit0af8bcae6f44aa440e51b1925635fb835cd68058 (patch)
tree99256de08f84d6b2e6db87ec32b3471ed5bb3b89 /drivers/net/wireless/iwlwifi/iwl-agn.c
parentfd76f148ebc67d662f71f00128c8ddb0538168c0 (diff)
iwlwifi: introduce iwl_sta_id_or_broadcast
There are now five places where we need to look up the station ID, but the sta pointer may be NULL due to mac80211 passing that to indicate a certain special state. Replace all these by a new inline function, called iwl_sta_id_or_broadcast(), and add documentation about when to use it. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 47563cf9cbaa..d7a9aea6cdaa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3081,17 +3081,9 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3081 return -EOPNOTSUPP; 3081 return -EOPNOTSUPP;
3082 } 3082 }
3083 3083
3084 if (sta) { 3084 sta_id = iwl_sta_id_or_broadcast(priv, sta);
3085 sta_id = iwl_sta_id(sta); 3085 if (sta_id == IWL_INVALID_STATION)
3086 3086 return -EINVAL;
3087 if (sta_id == IWL_INVALID_STATION) {
3088 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
3089 sta->addr);
3090 return -EINVAL;
3091 }
3092 } else {
3093 sta_id = priv->hw_params.bcast_sta_id;
3094 }
3095 3087
3096 mutex_lock(&priv->mutex); 3088 mutex_lock(&priv->mutex);
3097 iwl_scan_cancel_timeout(priv, 100); 3089 iwl_scan_cancel_timeout(priv, 100);