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/iwl3945-base.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/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4c78783a6035..68b8a1af3be7 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -509,10 +509,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
509 | hdr_len = ieee80211_hdrlen(fc); | 509 | hdr_len = ieee80211_hdrlen(fc); |
510 | 510 | ||
511 | /* Find index into station table for destination station */ | 511 | /* Find index into station table for destination station */ |
512 | if (!info->control.sta) | 512 | sta_id = iwl_sta_id_or_broadcast(priv, info->control.sta); |
513 | sta_id = priv->hw_params.bcast_sta_id; | ||
514 | else | ||
515 | sta_id = iwl_sta_id(info->control.sta); | ||
516 | if (sta_id == IWL_INVALID_STATION) { | 513 | if (sta_id == IWL_INVALID_STATION) { |
517 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 514 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
518 | hdr->addr1); | 515 | hdr->addr1); |
@@ -3336,17 +3333,9 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3336 | static_key = !iwl_is_associated(priv); | 3333 | static_key = !iwl_is_associated(priv); |
3337 | 3334 | ||
3338 | if (!static_key) { | 3335 | if (!static_key) { |
3339 | if (!sta) { | 3336 | sta_id = iwl_sta_id_or_broadcast(priv, sta); |
3340 | sta_id = priv->hw_params.bcast_sta_id; | 3337 | if (sta_id == IWL_INVALID_STATION) |
3341 | } else { | 3338 | return -EINVAL; |
3342 | sta_id = iwl_sta_id(sta); | ||
3343 | if (sta_id == IWL_INVALID_STATION) { | ||
3344 | IWL_DEBUG_MAC80211(priv, | ||
3345 | "leave - %pM not in station map.\n", | ||
3346 | sta->addr); | ||
3347 | return -EINVAL; | ||
3348 | } | ||
3349 | } | ||
3350 | } | 3339 | } |
3351 | 3340 | ||
3352 | mutex_lock(&priv->mutex); | 3341 | mutex_lock(&priv->mutex); |