public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Renato Andreola <renato.andreola@imagos.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] PATCH mtd CFI flash: timeout calculation underflow if imprecise 1kHz timer: fix
Date: Fri, 07 Aug 2009 14:14:06 +0200	[thread overview]
Message-ID: <4A7C1A8E.2080208@imagos.it> (raw)
In-Reply-To: <20090807091647.3F231832E416@gemini.denx.de>

Ok, for the change.
What is the preferred way to proceed? have I got to resubmit a patch for 
the change with the DIV_ROUND_UP macro?

Best regards,
Renato Andreola

Wolfgang Denk wrote:
> Dear Renato Andreola,
>
> In message <4A7BE28A.8080701@imagos.it> you wrote:
>   
>> I'd like to clarify what is the problem with the timeout and the Intel 
>> flash (even if the following comments can be obvious or already well 
>> known) and to ask you an opinion on a small code change.
>>     
>
> Thanks.
>
> ...
>   
>> I think that an expression like this
>>
>> #if CONFIG_SYS_HZ != 1000
>> if ((ulong)CONFIG_SYS_HZ > 10000)
>>     tout *= ((ulong)CONFIG_SYS_HZ)/1000;  /* for a big HZ, avoid 
>> overflow */
>> else
>>     tout = (tout * (ulong)CONFIG_SYS_HZ + 500) / 1000;
>> #endif
>>
>> could be better because
>> - it forces the data type of the system dependent CONFIG_SYS_HZ value to 
>> ulong (no float!)
>> - it rounds tout to 0.5 timer tick and leaves tout unchanged if 
>> CONFIG_SYS_HZ == 1000
>>
>> What do you think about?
>>     
>
> I'd prefer "tout = DIV_ROUND_UP(tout*CONFIG_SYS_HZ, 1000);"
>
>
> Best regards,
>
> Wolfgang Denk
>
>   

  parent reply	other threads:[~2009-08-07 12:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 13:09 [U-Boot] PATCH mtd CFI flash: timeout calculation underflow if imprecise 1kHz timer: fix Renato Andreola
2009-08-06 13:22 ` Wolfgang Denk
2009-08-06 13:31   ` Alessandro Rubini
2009-08-06 14:19     ` Wolfgang Denk
2009-08-06 20:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-06 20:53   ` Wolfgang Denk
2009-08-06 21:01     ` Wolfgang Denk
2009-08-06 21:15     ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-06 21:35       ` Wolfgang Denk
2009-08-07  8:15     ` Renato Andreola
2009-08-07  9:16       ` Wolfgang Denk
2009-08-07 10:29         ` [U-Boot] Kirkwood gpio (was: timeout calculation underflow if imprecise 1kHz timer: fix) Alessandro Rubini
2009-08-07 11:13           ` Prafulla Wadaskar
2009-08-07 12:10             ` [U-Boot] Kirkwood gpio Heiko Schocher
2009-08-07 11:46           ` Heiko Schocher
2009-08-07 11:48           ` [U-Boot] Kirkwood gpio (was: timeout calculation underflow if imprecise 1kHz timer: fix) Dieter Kiermaier
2009-08-07 12:14         ` Renato Andreola [this message]
2009-08-09 21:13           ` [U-Boot] PATCH mtd CFI flash: timeout calculation underflow if imprecise 1kHz timer: fix Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2009-08-24  8:32 Renato Andreola
2009-08-25 13:25 ` Shinya Kuribayashi
2009-08-25 15:01   ` Renato Andreola
2009-08-25 15:39 ` Stefan Roese
2009-08-25 15:44   ` Stefan Roese
2009-11-22 21:09 ` Wolfgang Denk
2009-11-23  8:51   ` Renato Andreola
2009-11-23 19:36     ` Wolfgang Denk
2009-08-06 16:08 Renato Andreola
2009-08-06  9:49 Renato Andreola
2009-08-06 10:07 ` Wolfgang Denk
2009-08-06 10:12 ` Alessandro Rubini
     [not found]   ` <4A7AB614.2020509@imagos.it>
2009-08-06 11:40     ` Wolfgang Denk
2009-04-10 12:28 Renato Andreola
2009-04-13 22:09 ` Jean-Christophe PLAGNIOL-VILLARD

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=4A7C1A8E.2080208@imagos.it \
    --to=renato.andreola@imagos.it \
    --cc=u-boot@lists.denx.de \
    /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