summaryrefslogtreecommitdiff
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-01-12 09:31:10 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-01-30 15:41:25 -0500
commit83d5cc012441531ab0bf6f99881958e964e9cf11 (patch)
treeb36a127cd4d735f5b4a0b7fbfbdd3714bceca44f /net/mac80211/cfg.c
parentc037b8367c7e2b775a99d74037f5df014d2fbf06 (diff)
mac80211: station state transition error handling
In the future, when we start notifying drivers, state transitions could potentially fail. To make it easier to distinguish between programming bugs and driver failures: * rename sta_info_move_state() to sta_info_pre_move_state() which can only be called before the station is inserted (and check this with a new station flag). * rename sta_info_move_state_checked() to just plain sta_info_move_state(), as it will be the regular function that can fail for more than just one reason (bad transition or an error from the driver) This makes the programming model easier -- one of the functions can only be called before insertion and can't fail, the other can fail. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 98460783c2d..dc742044157 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -776,12 +776,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED) &&
!test_sta_flag(sta, WLAN_STA_AUTH)) {
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_AUTH);
+ ret = sta_info_move_state(sta, IEEE80211_STA_AUTH);
if (ret)
return ret;
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_ASSOC);
+ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
if (ret)
return ret;
}
@@ -789,11 +787,9 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
if (set & BIT(NL80211_STA_FLAG_AUTHORIZED))
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_AUTHORIZED);
+ ret = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_ASSOC);
+ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
if (ret)
return ret;
}
@@ -805,12 +801,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (!(set & BIT(NL80211_STA_FLAG_AUTHENTICATED)) &&
test_sta_flag(sta, WLAN_STA_AUTH)) {
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_AUTH);
+ ret = sta_info_move_state(sta, IEEE80211_STA_AUTH);
if (ret)
return ret;
- ret = sta_info_move_state_checked(sta,
- IEEE80211_STA_NONE);
+ ret = sta_info_move_state(sta, IEEE80211_STA_NONE);
if (ret)
return ret;
}
@@ -944,8 +938,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
if (!sta)
return -ENOMEM;
- sta_info_move_state(sta, IEEE80211_STA_AUTH);
- sta_info_move_state(sta, IEEE80211_STA_ASSOC);
+ sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
+ sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
err = sta_apply_parameters(local, sta, params);
if (err) {