Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290562
b: refs/heads/master
c: 46b0cc9
h: refs/heads/master
v: v3
  • Loading branch information
Ido Yariv authored and Luciano Coelho committed Feb 15, 2012
1 parent 4da3f68 commit 6720448
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a454969ede024a209e6a755d5f7a928ab81ed00c
refs/heads/master: 46b0cc9ffce356fbcb2135219a3ed8500714a9e4
30 changes: 28 additions & 2 deletions trunk/drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1397,9 +1397,23 @@ int wl1271_plt_stop(struct wl1271 *wl)

wl1271_notice("power down");

/*
* Interrupts must be disabled before setting the state to OFF.
* Otherwise, the interrupt handler might be called and exit without
* reading the interrupt status.
*/
wl1271_disable_interrupts(wl);
mutex_lock(&wl->mutex);
if (wl->state != WL1271_STATE_PLT) {
mutex_unlock(&wl->mutex);

/*
* This will not necessarily enable interrupts as interrupts
* may have been disabled when op_stop was called. It will,
* however, balance the above call to disable_interrupts().
*/
wl1271_enable_interrupts(wl);

wl1271_error("cannot power down because not in PLT "
"state: %d", wl->state);
ret = -EBUSY;
Expand All @@ -1411,7 +1425,6 @@ int wl1271_plt_stop(struct wl1271 *wl)

mutex_unlock(&wl->mutex);

wl1271_disable_interrupts(wl);
wl1271_flush_deferred_work(wl);
cancel_work_sync(&wl->netstack_work);
cancel_work_sync(&wl->recovery_work);
Expand Down Expand Up @@ -1773,11 +1786,25 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)

wl1271_debug(DEBUG_MAC80211, "mac80211 stop");

/*
* Interrupts must be disabled before setting the state to OFF.
* Otherwise, the interrupt handler might be called and exit without
* reading the interrupt status.
*/
wl1271_disable_interrupts(wl);
mutex_lock(&wl->mutex);
if (wl->state == WL1271_STATE_OFF) {
mutex_unlock(&wl->mutex);

/*
* This will not necessarily enable interrupts as interrupts
* may have been disabled when op_stop was called. It will,
* however, balance the above call to disable_interrupts().
*/
wl1271_enable_interrupts(wl);
return;
}

/*
* this must be before the cancel_work calls below, so that the work
* functions don't perform further work.
Expand All @@ -1789,7 +1816,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
list_del(&wl->list);
mutex_unlock(&wl_list_mutex);

wl1271_disable_interrupts(wl);
wl1271_flush_deferred_work(wl);
cancel_delayed_work_sync(&wl->scan_complete_work);
cancel_work_sync(&wl->netstack_work);
Expand Down

0 comments on commit 6720448

Please sign in to comment.