linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Kyungmin Park <kmpark@infradead.org>
Cc: Artem.Bityutskiy@nokia.com, linux-mtd@lists.infradead.org,
	dwmw2@infradead.org
Subject: Re: [PATCH 2/3] MTD: OneNAND: Fix loop hang when DMA error at Samsung	SoCs
Date: Mon, 30 Aug 2010 15:49:57 +0300	[thread overview]
Message-ID: <1283172597.12995.68.camel@brekeke> (raw)
In-Reply-To: <20100827025537.GA10698@july>

On Fri, 2010-08-27 at 11:55 +0900, Kyungmin Park wrote:
> From: Kyungmin Park <kyungmin.park@samsung.com>
> 
> When DMA error occurs. it's loop hang since it can't exit the loop.
> and it's the right DMA handling code as Spec.
> 
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mtd/onenand/samsung.c |   11 +++++------
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
> index 05329ba..69e48d0 100644
> --- a/drivers/mtd/onenand/samsung.c
> +++ b/drivers/mtd/onenand/samsung.c
> @@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
>  
>  	do {
>  		status = readl(base + S5PC110_DMA_TRANS_STATUS);
> +		if (status & S5PC110_DMA_TRANS_STATUS_TE) {
> +			writel(S5PC110_DMA_TRANS_CMD_TEC,
> +					base + S5PC110_DMA_TRANS_CMD);
> +			return -EIO;
> +		}
>  	} while (!(status & S5PC110_DMA_TRANS_STATUS_TD));
>  
> -	if (status & S5PC110_DMA_TRANS_STATUS_TE) {
> -		writel(S5PC110_DMA_TRANS_CMD_TEC, base + S5PC110_DMA_TRANS_CMD);
> -		writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
> -		return -EIO;
> -	}
> -
>  	writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);

You shoule also add timeout to the loop. Forever loops are bad. Please,
while you are on it, fix the forever loop by doing something like this:
http://patchwork.ozlabs.org/patch/59180/
I mean, add timeout please.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

  reply	other threads:[~2010-08-30 12:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27  2:55 [PATCH 2/3] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs Kyungmin Park
2010-08-30 12:49 ` Artem Bityutskiy [this message]
2010-08-30 13:41   ` Kyungmin Park

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=1283172597.12995.68.camel@brekeke \
    --to=dedekind1@gmail.com \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=dwmw2@infradead.org \
    --cc=kmpark@infradead.org \
    --cc=linux-mtd@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).