aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-10 04:13:06 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-11 08:12:12 -0400
commit10c8cd01e329b2973eddddafe67ae499eef83b19 (patch)
treed6d14e6ce720eb8125ce072f5a5dd7c049e40a32 /drivers
parent0744bdb60b51dce54553d5af9a6133f1fe419032 (diff)
wl12xx: make WL1271_FLAG_IF_INITIALIZED per-vif
Make the initialization flag per-vif, and add some checks for it. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/main.c32
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h2
2 files changed, 26 insertions, 8 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 9042445e0d03..fb5951cb69e1 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1817,14 +1817,20 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
1817 1817
1818 wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); 1818 wl1271_debug(DEBUG_MAC80211, "mac80211 stop");
1819 1819
1820 mutex_lock(&wl_list_mutex); 1820 mutex_lock(&wl->mutex);
1821 list_del(&wl->list); 1821 if (wl->state == WL1271_STATE_OFF) {
1822 1822 mutex_unlock(&wl->mutex);
1823 return;
1824 }
1823 /* 1825 /*
1824 * this must be before the cancel_work calls below, so that the work 1826 * this must be before the cancel_work calls below, so that the work
1825 * functions don't perform further work. 1827 * functions don't perform further work.
1826 */ 1828 */
1827 wl->state = WL1271_STATE_OFF; 1829 wl->state = WL1271_STATE_OFF;
1830 mutex_unlock(&wl->mutex);
1831
1832 mutex_lock(&wl_list_mutex);
1833 list_del(&wl->list);
1828 mutex_unlock(&wl_list_mutex); 1834 mutex_unlock(&wl_list_mutex);
1829 1835
1830 wl1271_disable_interrupts(wl); 1836 wl1271_disable_interrupts(wl);
@@ -1971,7 +1977,6 @@ static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif)
1971 1977
1972 setup_timer(&wlvif->rx_streaming_timer, wl1271_rx_streaming_timer, 1978 setup_timer(&wlvif->rx_streaming_timer, wl1271_rx_streaming_timer,
1973 (unsigned long) wlvif); 1979 (unsigned long) wlvif);
1974
1975 return 0; 1980 return 0;
1976} 1981}
1977 1982
@@ -2069,7 +2074,8 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
2069 * get here before __wl1271_op_remove_interface is complete, so 2074 * get here before __wl1271_op_remove_interface is complete, so
2070 * opt out if that is the case. 2075 * opt out if that is the case.
2071 */ 2076 */
2072 if (test_bit(WL1271_FLAG_IF_INITIALIZED, &wl->flags)) { 2077 if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) ||
2078 test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) {
2073 ret = -EBUSY; 2079 ret = -EBUSY;
2074 goto out; 2080 goto out;
2075 } 2081 }
@@ -2129,7 +2135,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
2129 2135
2130 wl->vif = vif; 2136 wl->vif = vif;
2131 list_add(&wlvif->list, &wl->wlvif_list); 2137 list_add(&wlvif->list, &wl->wlvif_list);
2132 set_bit(WL1271_FLAG_IF_INITIALIZED, &wl->flags); 2138 set_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags);
2133 2139
2134 if (wlvif->bss_type == BSS_TYPE_AP_BSS) 2140 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
2135 wl->ap_count++; 2141 wl->ap_count++;
@@ -2155,6 +2161,9 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
2155 2161
2156 wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); 2162 wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface");
2157 2163
2164 if (!test_and_clear_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))
2165 return;
2166
2158 /* because of hardware recovery, we may get here twice */ 2167 /* because of hardware recovery, we may get here twice */
2159 if (wl->state != WL1271_STATE_ON) 2168 if (wl->state != WL1271_STATE_ON)
2160 return; 2169 return;
@@ -2224,8 +2233,14 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
2224 struct ieee80211_vif *vif) 2233 struct ieee80211_vif *vif)
2225{ 2234{
2226 struct wl1271 *wl = hw->priv; 2235 struct wl1271 *wl = hw->priv;
2236 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
2227 2237
2228 mutex_lock(&wl->mutex); 2238 mutex_lock(&wl->mutex);
2239
2240 if (wl->state == WL1271_STATE_OFF ||
2241 !test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))
2242 goto out;
2243
2229 /* 2244 /*
2230 * wl->vif can be null here if someone shuts down the interface 2245 * wl->vif can be null here if someone shuts down the interface
2231 * just when hardware recovery has been started. 2246 * just when hardware recovery has been started.
@@ -2234,7 +2249,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
2234 WARN_ON(wl->vif != vif); 2249 WARN_ON(wl->vif != vif);
2235 __wl1271_op_remove_interface(wl, vif, true); 2250 __wl1271_op_remove_interface(wl, vif, true);
2236 } 2251 }
2237 2252out:
2238 mutex_unlock(&wl->mutex); 2253 mutex_unlock(&wl->mutex);
2239 cancel_work_sync(&wl->recovery_work); 2254 cancel_work_sync(&wl->recovery_work);
2240} 2255}
@@ -3843,6 +3858,9 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
3843 if (unlikely(wl->state == WL1271_STATE_OFF)) 3858 if (unlikely(wl->state == WL1271_STATE_OFF))
3844 goto out; 3859 goto out;
3845 3860
3861 if (unlikely(!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)))
3862 goto out;
3863
3846 ret = wl1271_ps_elp_wakeup(wl); 3864 ret = wl1271_ps_elp_wakeup(wl);
3847 if (ret < 0) 3865 if (ret < 0)
3848 goto out; 3866 goto out;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 5b5c93093347..740a9b19cea1 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -322,7 +322,6 @@ enum wl12xx_flags {
322 WL1271_FLAG_IDLE, 322 WL1271_FLAG_IDLE,
323 WL1271_FLAG_PSPOLL_FAILURE, 323 WL1271_FLAG_PSPOLL_FAILURE,
324 WL1271_FLAG_FW_TX_BUSY, 324 WL1271_FLAG_FW_TX_BUSY,
325 WL1271_FLAG_IF_INITIALIZED,
326 WL1271_FLAG_DUMMY_PACKET_PENDING, 325 WL1271_FLAG_DUMMY_PACKET_PENDING,
327 WL1271_FLAG_SUSPENDED, 326 WL1271_FLAG_SUSPENDED,
328 WL1271_FLAG_PENDING_WORK, 327 WL1271_FLAG_PENDING_WORK,
@@ -332,6 +331,7 @@ enum wl12xx_flags {
332}; 331};
333 332
334enum wl12xx_vif_flags { 333enum wl12xx_vif_flags {
334 WLVIF_FLAG_INITIALIZED,
335 WLVIF_FLAG_STA_ASSOCIATED, 335 WLVIF_FLAG_STA_ASSOCIATED,
336 WLVIF_FLAG_IBSS_JOINED, 336 WLVIF_FLAG_IBSS_JOINED,
337 WLVIF_FLAG_AP_STARTED, 337 WLVIF_FLAG_AP_STARTED,