All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: eric.y.miao@gmail.com, mreimer@vpop.net,
	linux-mtd@lists.infradead.org, dwmw2@infradead.org
Subject: Re: [PATCH] pxa3xx_nand: fix time calculation
Date: Sun, 11 Oct 2009 15:51:15 +0300	[thread overview]
Message-ID: <1255265475.16942.48.camel@localhost> (raw)
In-Reply-To: <1254907903-11797-1-git-send-email-enrico.scholz@sigma-chemnitz.de>

On Wed, 2009-10-07 at 11:31 +0200, Enrico Scholz wrote:
> Use DIV_ROUND_UP to calculate number of clocks.  Else, calculated clocks
> are nearly always to low and for times < 10ns, they will be negative on
> PXA320  (which has a nand clock of 104 MHz).
> 
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---
>  drivers/mtd/nand/pxa3xx_nand.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 6ea520a..32cb4d1 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -316,7 +316,7 @@ static struct pxa3xx_nand_flash *builtin_flash_types[] = {
>  #define tAR_NDTR1(r)	(((r) >> 0) & 0xf)
>  
>  /* convert nano-seconds to nand flash controller clock cycles */
> -#define ns2cycle(ns, clk)	(int)(((ns) * (clk / 1000000) / 1000) - 1)
> +#define ns2cycle(ns, clk)	(int)(DIV_ROUND_UP((ns) * (clk / 1000000), 1000) - 1)

Why there is -1 at the end?

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

  reply	other threads:[~2009-10-11 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07  9:31 [PATCH] pxa3xx_nand: fix time calculation Enrico Scholz
2009-10-11 12:51 ` Artem Bityutskiy [this message]
2009-10-12  3:22   ` Eric Miao
2009-10-12 10:03     ` Enrico Scholz

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=1255265475.16942.48.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=enrico.scholz@sigma-chemnitz.de \
    --cc=eric.y.miao@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mreimer@vpop.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.