Hi Boris,
On 27/9/2018 8:20 AM, Boris Brezillon wrote:
On Wed, 26 Sep 2018 23:23:53 +0200 Daniel Mack daniel@zonque.org wrote:
marvell_nfc_enable_int(nfc, NDCR_RDYM);
- ret = wait_for_completion_timeout(&nfc->complete,
msecs_to_jiffies(timeout_ms));
- /*
* Check if the NDSR_RDY bits have already been set before the
* interrupt was enabled.
*/
- st = readl_relaxed(nfc->regs + NDSR);
- if (!(st & (NDSR_RDY(0) | NDSR_RDY(1))))
ret = wait_for_completion_timeout(&nfc->complete,
msecs_to_jiffies(timeout_ms));
Or you can just do:
st = readl_relaxed(nfc->regs + NDSR); if (st & (NDSR_RDY(0) | NDSR_RDY(1))) complete(&nfc->complete);
ret = wait_for_completion_timeout(&nfc->complete, msecs_to_jiffies(timeout_ms)); ...
Ah, yes. Thanks.
Of course, it's less efficient than your version, but I find it clearer than the -EALREADY approach.
Well, this issue usually takes minutes to trigger, so efficiency is not a good argument :)
I'll resend a v2.
Thanks, Daniel