public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@zonque.org>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: miquel.raynal@bootlin.com, linux-mtd@lists.infradead.org,
	chris.packham@alliedtelesis.co.nz, stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: marvell: check for RDY bits after enabling the IRQ
Date: Thu, 27 Sep 2018 09:14:46 +0200	[thread overview]
Message-ID: <be4d8ea3-a698-aaaa-05db-555580987830@zonque.org> (raw)
In-Reply-To: <20180927082033.0b5295de@bbrezillon>

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

      reply	other threads:[~2018-09-27  7:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 21:23 [PATCH] mtd: rawnand: marvell: check for RDY bits after enabling the IRQ Daniel Mack
2018-09-26 23:33 ` Chris Packham
2018-09-26 23:42   ` Chris Packham
2018-09-27  7:13     ` Daniel Mack
2018-09-27 20:36       ` Chris Packham
2018-09-27 21:50         ` Chris Packham
2018-09-27  6:20 ` Boris Brezillon
2018-09-27  7:14   ` Daniel Mack [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be4d8ea3-a698-aaaa-05db-555580987830@zonque.org \
    --to=daniel@zonque.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox