public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code
Date: Tue, 23 Feb 2010 23:44:02 +0100	[thread overview]
Message-ID: <20100223224402.GO20201@darwin> (raw)
In-Reply-To: <20100223222342.7BCDDE8CCE0@gemini.denx.de>

Hi Wolfgang,

El Tue, Feb 23, 2010 at 11:23:42PM +0100 Wolfgang Denk ha dit:

> In message <20100223220421.GK20201@darwin> you wrote:
> > ep93xx: Refactoring of the timer code, including the following changes
> ...
> > +#define TIMER_FREQ			508469
> > +#define CLK_TICKS_PER_SYS_TICK		(TIMER_FREQ / CONFIG_SYS_HZ)
> ...
> > +		ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
> ...
> > +		ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;
> 
> Why don't you use
> 
> 	ticks *= TIMER_FREQ;
> resp.
> 	ticks = usecs * TIMER_FREQ;
> 
> The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad
> NO-OP (with rounding errors).

you certainly have a point, i'm going to change this as you proposed

> Hm... re-reading the optimized code makes me wonder if the variable
> really should be called "ticks" - looks more as a frequency to me?

here i disagree, the function returns the number of ticks that pass in
a certain number of microseconds, so i think 'ticks' is an appropiate
name

thanks for your review!

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

        I cannot say whether things will get better if we change,
      what I can say is they must change if they are to get better
                   (Georg Christoph Lichtenberg)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

  reply	other threads:[~2010-02-23 22:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7ee75976e78e2f82b4163fe1ff4233a850d4393c.1266962256.git.matthias@kaehlcke.net>
2010-02-23 22:04 ` [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code Matthias Kaehlcke
2010-02-23 22:23   ` Wolfgang Denk
2010-02-23 22:44     ` Matthias Kaehlcke [this message]
2010-02-24  2:04       ` Tom

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=20100223224402.GO20201@darwin \
    --to=matthias@kaehlcke.net \
    --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