diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2009-12-11 08:41:07 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-28 16:31:35 -0500 |
commit | 71449f8d7059b69e6e45063997d225d8202221a2 (patch) | |
tree | 480496ab5644801421965c18fd329084c4df123d /drivers/net/wireless/wl12xx/wl1271_main.c | |
parent | 830fb67b8e37fb03cf703b4e1217fe30ce32d579 (diff) |
wl1271: Change booleans in struct wl1271 into a flags bitmask
For cleaner implementation, change the bunch of booleans in the struct wl1271
structure into a flags bitmask.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 775b1e82ca81..90a60c1147a8 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -378,13 +378,13 @@ static void wl1271_disable_interrupts(struct wl1271 *wl) | |||
378 | static void wl1271_power_off(struct wl1271 *wl) | 378 | static void wl1271_power_off(struct wl1271 *wl) |
379 | { | 379 | { |
380 | wl->set_power(false); | 380 | wl->set_power(false); |
381 | wl->gpio_power = false; | 381 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
382 | } | 382 | } |
383 | 383 | ||
384 | static void wl1271_power_on(struct wl1271 *wl) | 384 | static void wl1271_power_on(struct wl1271 *wl) |
385 | { | 385 | { |
386 | wl->set_power(true); | 386 | wl->set_power(true); |
387 | wl->gpio_power = true; | 387 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void wl1271_fw_status(struct wl1271 *wl, | 390 | static void wl1271_fw_status(struct wl1271 *wl, |
@@ -812,7 +812,7 @@ static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
812 | * protected. Maybe fix this by removing the stupid | 812 | * protected. Maybe fix this by removing the stupid |
813 | * variable altogether and checking the real queue state? | 813 | * variable altogether and checking the real queue state? |
814 | */ | 814 | */ |
815 | wl->tx_queue_stopped = true; | 815 | set_bit(WL1271_FLAG_TX_QUEUE_STOPPED, &wl->flags); |
816 | } | 816 | } |
817 | 817 | ||
818 | return NETDEV_TX_OK; | 818 | return NETDEV_TX_OK; |
@@ -985,11 +985,10 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
985 | 985 | ||
986 | WARN_ON(wl->state != WL1271_STATE_ON); | 986 | WARN_ON(wl->state != WL1271_STATE_ON); |
987 | 987 | ||
988 | if (wl->scanning) { | 988 | if (test_and_clear_bit(WL1271_FLAG_SCANNING, &wl->flags)) { |
989 | mutex_unlock(&wl->mutex); | 989 | mutex_unlock(&wl->mutex); |
990 | ieee80211_scan_completed(wl->hw, true); | 990 | ieee80211_scan_completed(wl->hw, true); |
991 | mutex_lock(&wl->mutex); | 991 | mutex_lock(&wl->mutex); |
992 | wl->scanning = false; | ||
993 | } | 992 | } |
994 | 993 | ||
995 | wl->state = WL1271_STATE_OFF; | 994 | wl->state = WL1271_STATE_OFF; |
@@ -1014,10 +1013,7 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1014 | wl->band = IEEE80211_BAND_2GHZ; | 1013 | wl->band = IEEE80211_BAND_2GHZ; |
1015 | 1014 | ||
1016 | wl->rx_counter = 0; | 1015 | wl->rx_counter = 0; |
1017 | wl->elp = false; | ||
1018 | wl->psm = 0; | ||
1019 | wl->psm_entry_retry = 0; | 1016 | wl->psm_entry_retry = 0; |
1020 | wl->tx_queue_stopped = false; | ||
1021 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | 1017 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; |
1022 | wl->tx_blocks_available = 0; | 1018 | wl->tx_blocks_available = 0; |
1023 | wl->tx_results_count = 0; | 1019 | wl->tx_results_count = 0; |
@@ -1027,7 +1023,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1027 | wl->tx_security_seq_32 = 0; | 1023 | wl->tx_security_seq_32 = 0; |
1028 | wl->time_offset = 0; | 1024 | wl->time_offset = 0; |
1029 | wl->session_counter = 0; | 1025 | wl->session_counter = 0; |
1030 | wl->joined = false; | ||
1031 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | 1026 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; |
1032 | wl->sta_rate_set = 0; | 1027 | wl->sta_rate_set = 0; |
1033 | wl->flags = 0; | 1028 | wl->flags = 0; |
@@ -1174,7 +1169,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel) | |||
1174 | if (ret < 0) | 1169 | if (ret < 0) |
1175 | goto out; | 1170 | goto out; |
1176 | 1171 | ||
1177 | wl->joined = true; | 1172 | set_bit(WL1271_FLAG_JOINED, &wl->flags); |
1178 | 1173 | ||
1179 | out: | 1174 | out: |
1180 | return ret; | 1175 | return ret; |
@@ -1189,7 +1184,7 @@ static int wl1271_unjoin_channel(struct wl1271 *wl) | |||
1189 | if (ret < 0) | 1184 | if (ret < 0) |
1190 | goto out; | 1185 | goto out; |
1191 | 1186 | ||
1192 | wl->joined = false; | 1187 | clear_bit(WL1271_FLAG_JOINED, &wl->flags); |
1193 | wl->channel = 0; | 1188 | wl->channel = 0; |
1194 | memset(wl->bssid, 0, ETH_ALEN); | 1189 | memset(wl->bssid, 0, ETH_ALEN); |
1195 | wl->rx_config = WL1271_DEFAULT_RX_CONFIG; | 1190 | wl->rx_config = WL1271_DEFAULT_RX_CONFIG; |
@@ -1221,7 +1216,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1221 | goto out; | 1216 | goto out; |
1222 | 1217 | ||
1223 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | 1218 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { |
1224 | if (conf->flags & IEEE80211_CONF_IDLE && wl->joined) | 1219 | if (conf->flags & IEEE80211_CONF_IDLE && |
1220 | test_bit(WL1271_FLAG_JOINED, &wl->flags)) | ||
1225 | wl1271_unjoin_channel(wl); | 1221 | wl1271_unjoin_channel(wl); |
1226 | else | 1222 | else |
1227 | wl1271_join_channel(wl, channel); | 1223 | wl1271_join_channel(wl, channel); |
@@ -1234,11 +1230,12 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1234 | } | 1230 | } |
1235 | 1231 | ||
1236 | /* if the channel changes while joined, join again */ | 1232 | /* if the channel changes while joined, join again */ |
1237 | if (channel != wl->channel && wl->joined) | 1233 | if (channel != wl->channel && test_bit(WL1271_FLAG_JOINED, &wl->flags)) |
1238 | wl1271_join_channel(wl, channel); | 1234 | wl1271_join_channel(wl, channel); |
1239 | 1235 | ||
1240 | if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { | 1236 | if (conf->flags & IEEE80211_CONF_PS && |
1241 | wl->psm_requested = true; | 1237 | !test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { |
1238 | set_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags); | ||
1242 | 1239 | ||
1243 | /* | 1240 | /* |
1244 | * We enter PSM only if we're already associated. | 1241 | * We enter PSM only if we're already associated. |
@@ -1250,12 +1247,12 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1250 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); | 1247 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); |
1251 | } | 1248 | } |
1252 | } else if (!(conf->flags & IEEE80211_CONF_PS) && | 1249 | } else if (!(conf->flags & IEEE80211_CONF_PS) && |
1253 | wl->psm_requested) { | 1250 | test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { |
1254 | wl1271_info("psm disabled"); | 1251 | wl1271_info("psm disabled"); |
1255 | 1252 | ||
1256 | wl->psm_requested = false; | 1253 | clear_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags); |
1257 | 1254 | ||
1258 | if (wl->psm) | 1255 | if (test_bit(WL1271_FLAG_PSM, &wl->flags)) |
1259 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE); | 1256 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE); |
1260 | } | 1257 | } |
1261 | 1258 | ||
@@ -1574,7 +1571,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1574 | wl1271_warning("cmd join failed %d", ret); | 1571 | wl1271_warning("cmd join failed %d", ret); |
1575 | goto out_sleep; | 1572 | goto out_sleep; |
1576 | } | 1573 | } |
1577 | wl->joined = true; | 1574 | set_bit(WL1271_FLAG_JOINED, &wl->flags); |
1578 | } | 1575 | } |
1579 | 1576 | ||
1580 | if (wl->bss_type == BSS_TYPE_IBSS) { | 1577 | if (wl->bss_type == BSS_TYPE_IBSS) { |
@@ -1633,7 +1630,8 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1633 | goto out_sleep; | 1630 | goto out_sleep; |
1634 | 1631 | ||
1635 | /* If we want to go in PSM but we're not there yet */ | 1632 | /* If we want to go in PSM but we're not there yet */ |
1636 | if (wl->psm_requested && !wl->psm) { | 1633 | if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) && |
1634 | !test_bit(WL1271_FLAG_PSM, &wl->flags)) { | ||
1637 | mode = STATION_POWER_SAVE_MODE; | 1635 | mode = STATION_POWER_SAVE_MODE; |
1638 | ret = wl1271_ps_set_mode(wl, mode); | 1636 | ret = wl1271_ps_set_mode(wl, mode); |
1639 | if (ret < 0) | 1637 | if (ret < 0) |
@@ -1949,24 +1947,17 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
1949 | 1947 | ||
1950 | INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work); | 1948 | INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work); |
1951 | wl->channel = WL1271_DEFAULT_CHANNEL; | 1949 | wl->channel = WL1271_DEFAULT_CHANNEL; |
1952 | wl->scanning = false; | ||
1953 | wl->default_key = 0; | 1950 | wl->default_key = 0; |
1954 | wl->rx_counter = 0; | 1951 | wl->rx_counter = 0; |
1955 | wl->rx_config = WL1271_DEFAULT_RX_CONFIG; | 1952 | wl->rx_config = WL1271_DEFAULT_RX_CONFIG; |
1956 | wl->rx_filter = WL1271_DEFAULT_RX_FILTER; | 1953 | wl->rx_filter = WL1271_DEFAULT_RX_FILTER; |
1957 | wl->elp = false; | ||
1958 | wl->psm = 0; | ||
1959 | wl->psm_requested = false; | ||
1960 | wl->psm_entry_retry = 0; | 1954 | wl->psm_entry_retry = 0; |
1961 | wl->tx_queue_stopped = false; | ||
1962 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | 1955 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; |
1963 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | 1956 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; |
1964 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | 1957 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; |
1965 | wl->sta_rate_set = 0; | 1958 | wl->sta_rate_set = 0; |
1966 | wl->band = IEEE80211_BAND_2GHZ; | 1959 | wl->band = IEEE80211_BAND_2GHZ; |
1967 | wl->vif = NULL; | 1960 | wl->vif = NULL; |
1968 | wl->joined = false; | ||
1969 | wl->gpio_power = false; | ||
1970 | wl->flags = 0; | 1961 | wl->flags = 0; |
1971 | 1962 | ||
1972 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 1963 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |