d_fnstart(5, dev, "(i2400m %p ack %p size %zu)\n",
i2400m, ack, ack_size);
- spin_lock(&i2400m->rx_lock);
- i2400ms->bm_ack_size = -EINPROGRESS;
- spin_unlock(&i2400m->rx_lock);
-
result = wait_event_timeout(i2400ms->bm_wfa_wq,
i2400ms->bm_ack_size != -EINPROGRESS,
2 * HZ);
size = min(ack_size, i2400ms->bm_ack_size);
memcpy(ack, i2400m->bm_ack_buf, size);
}
+ /*
+ * Remember always to clear the bm_ack_size to -EINPROGRESS
+ * after the RX data is processed
+ */
i2400ms->bm_ack_size = -EINPROGRESS;
spin_unlock(&i2400m->rx_lock);
init_waitqueue_head(&i2400ms->bm_wfa_wq);
spin_lock(&i2400m->rx_lock);
i2400ms->bm_wait_result = -EINPROGRESS;
+ /*
+ * Before we are about to enable the RX interrupt, make sure
+ * bm_ack_size is cleared to -EINPROGRESS which indicates
+ * no RX interrupt happened yet or the previous interrupt
+ * has been handled, we are ready to take the new interrupt
+ */
+ i2400ms->bm_ack_size = -EINPROGRESS;
spin_unlock(&i2400m->rx_lock);
sdio_claim_host(func);