diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-04-30 17:08:00 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-05-13 13:42:32 -0400 |
commit | 0af8bcae6f44aa440e51b1925635fb835cd68058 (patch) | |
tree | 99256de08f84d6b2e6db87ec32b3471ed5bb3b89 /drivers/net/wireless/iwlwifi/iwl-sta.c | |
parent | fd76f148ebc67d662f71f00128c8ddb0538168c0 (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-sta.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 85ed235ac901..2eafba60053b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -972,24 +972,16 @@ void iwl_update_tkip_key(struct iwl_priv *priv, | |||
972 | unsigned long flags; | 972 | unsigned long flags; |
973 | int i; | 973 | int i; |
974 | 974 | ||
975 | if (sta) { | ||
976 | sta_id = iwl_sta_id(sta); | ||
977 | |||
978 | if (sta_id == IWL_INVALID_STATION) { | ||
979 | IWL_DEBUG_MAC80211(priv, "leave - %pM not initialised.\n", | ||
980 | sta->addr); | ||
981 | return; | ||
982 | } | ||
983 | } else | ||
984 | sta_id = priv->hw_params.bcast_sta_id; | ||
985 | |||
986 | |||
987 | if (iwl_scan_cancel(priv)) { | 975 | if (iwl_scan_cancel(priv)) { |
988 | /* cancel scan failed, just live w/ bad key and rely | 976 | /* cancel scan failed, just live w/ bad key and rely |
989 | briefly on SW decryption */ | 977 | briefly on SW decryption */ |
990 | return; | 978 | return; |
991 | } | 979 | } |
992 | 980 | ||
981 | sta_id = iwl_sta_id_or_broadcast(priv, sta); | ||
982 | if (sta_id == IWL_INVALID_STATION) | ||
983 | return; | ||
984 | |||
993 | spin_lock_irqsave(&priv->sta_lock, flags); | 985 | spin_lock_irqsave(&priv->sta_lock, flags); |
994 | 986 | ||
995 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | 987 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; |