Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314907
b: refs/heads/master
c: 6c15c1a
h: refs/heads/master
i:
  314905: 188d17f
  314903: 39565c9
v: v3
  • Loading branch information
Eyal Shapira authored and Luciano Coelho committed Jun 26, 2012
1 parent d58b036 commit c6d9449
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 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: 7a50bdfb81a6bff96100cd2a2c95f8b3cf05bc0c
refs/heads/master: 6c15c1aae206dc275a948a5e50f965c2382c6866
29 changes: 19 additions & 10 deletions trunk/drivers/net/wireless/ti/wlcore/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,27 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
* Poll the mailbox event field until any of the bits in the mask is set or a
* timeout occurs (WL1271_EVENT_TIMEOUT in msecs)
*/
static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask)
static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
u32 mask, bool *timeout)
{
u32 *events_vector;
u32 event;
unsigned long timeout;
unsigned long timeout_time;
int ret = 0;

*timeout = false;

events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA);
if (!events_vector)
return -ENOMEM;

timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);

do {
if (time_after(jiffies, timeout)) {
if (time_after(jiffies, timeout_time)) {
wl1271_debug(DEBUG_CMD, "timeout waiting for event %d",
(int)mask);
ret = -ETIMEDOUT;
*timeout = true;
goto out;
}

Expand Down Expand Up @@ -180,9 +183,10 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask)
static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask)
{
int ret;
bool timeout = false;

ret = wl1271_cmd_wait_for_event_or_timeout(wl, mask);
if (ret != 0) {
ret = wl1271_cmd_wait_for_event_or_timeout(wl, mask, &timeout);
if (ret != 0 || timeout) {
wl12xx_queue_recovery_work(wl);
return ret;
}
Expand Down Expand Up @@ -1435,6 +1439,7 @@ int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid)
{
struct wl12xx_cmd_remove_peer *cmd;
int ret;
bool timeout = false;

wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid);

Expand All @@ -1455,12 +1460,16 @@ int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid)
goto out_free;
}

ret = wl1271_cmd_wait_for_event_or_timeout(wl,
PEER_REMOVE_COMPLETE_EVENT_ID,
&timeout);
/*
* We are ok with a timeout here. The event is sometimes not sent
* due to a firmware bug.
* due to a firmware bug. In case of another error (like SDIO timeout)
* queue a recovery.
*/
wl1271_cmd_wait_for_event_or_timeout(wl,
PEER_REMOVE_COMPLETE_EVENT_ID);
if (ret)
wl12xx_queue_recovery_work(wl);

out_free:
kfree(cmd);
Expand Down

0 comments on commit c6d9449

Please sign in to comment.