From: baruch@tkos.co.il (Baruch Siach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
Date: Tue, 3 Mar 2015 12:18:46 +0200 [thread overview]
Message-ID: <20150303101846.GO15668@tarshish> (raw)
In-Reply-To: <1425376529-1860-1-git-send-email-maxime.ripard@free-electrons.com>
Hi Maxime,
On Tue, Mar 03, 2015 at 10:55:29AM +0100, Maxime Ripard wrote:
> Now that the driver handles the FIFO draining in a threaded interrupt, we can
> base our timeout on jiffies and sleeping, instead of using mdelay.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> drivers/mtd/nand/pxa3xx_nand.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 3f09f2e9aeb4..1eb957c347cd 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -496,16 +496,15 @@ static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
> while (len > 8) {
> __raw_readsl(info->mmio_base + NDDB, data, 8);
>
> - for (timeout = 0;
> - !(nand_readl(info, NDSR) & NDSR_RDDREQ);
> - timeout++) {
> - if (timeout >= 5) {
> + timeout = jiffies + msecs_to_jiffies(5);
> + while (!(nand_readl(info, NDSR) & NDSR_RDDREQ)) {
> + if (!time_before(jiffies, timeout)) {
> dev_err(&info->pdev->dev,
> "Timeout on RDDREQ while draining the FIFO\n");
> return;
> }
>
> - mdelay(1);
> + msleep(1);
> }
You may want to consider using readl_relaxed_poll_timeout() from
linux/iopoll.h, which was introduced in v4.0-rc1.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
next prev parent reply other threads:[~2015-03-03 10:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 9:55 [PATCH] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout Maxime Ripard
2015-03-03 10:18 ` Baruch Siach [this message]
2015-03-04 16:18 ` maxime.ripard at free-electrons.com
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=20150303101846.GO15668@tarshish \
--to=baruch@tkos.co.il \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).