From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] ARM: bcm283x: Switch to generic timer
Date: Wed, 6 May 2015 00:17:23 +0200 [thread overview]
Message-ID: <201505060017.23375.marex@denx.de> (raw)
In-Reply-To: <55493A50.8070000@wwwdotorg.org>
On Tuesday, May 05, 2015 at 11:46:56 PM, Stephen Warren wrote:
> On 05/04/2015 02:54 PM, Marek Vasut wrote:
> > Switch to generic timer implementation from lib/time.c .
> > This also fixes a signed overflow which was in __udelay()
> > implementation.
>
> Can you explain that a bit more?
>
> > -void __udelay(unsigned long usec)
> > -{
> > - ulong endtime;
> > - signed long diff;
> > -
> > - endtime = get_timer_us(0) + usec;
> > -
> > - do {
> > - ulong now = get_timer_us(0);
> > - diff = endtime - now;
> > - } while (diff >= 0);
> > -}
>
> I believe since endtime and now hold micro seconds, there shouldn't be
> any overflow so long as the microsecond difference fits into 31 bits,
> i.e. so long as usec is less than ~36 minutes. I doubt anything is
> calling __udelay() with that large of a value. Perhaps the issue this
> patch fixes is in get_timer_us(0) instead, or something else changed as
> a side-effect?
The generic implementation caters for full 32-bit range, that's all.
Since the argument of this function is unsigned, it can overflow if
you use argument which is bigger than 31 bits. OK like that ?
Best regards,
Marek Vasut
next prev parent reply other threads:[~2015-05-05 22:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 20:54 [U-Boot] [PATCH 1/4] ARM: bcm283x: Repair wdog.h Marek Vasut
2015-05-04 20:54 ` [U-Boot] [PATCH 2/4] ARM: bcm283x: Reorder timer.h Marek Vasut
2015-05-28 13:25 ` [U-Boot] [U-Boot,2/4] " Tom Rini
2015-05-04 20:54 ` [U-Boot] [PATCH 3/4] ARM: mmc: bcm283x: Remove get_timer_us() from mmc driver Marek Vasut
2015-05-05 9:40 ` Pantelis Antoniou
2015-06-16 3:44 ` Stephen Warren
2015-06-17 10:44 ` Marek Vasut
2015-06-17 16:13 ` Jakub Kiciński
2015-06-18 12:35 ` Marek Vasut
2015-06-18 12:51 ` Jakub Kiciński
2015-06-19 21:39 ` Marek Vasut
2015-06-18 1:55 ` Stephen Warren
2015-05-04 20:54 ` [U-Boot] [PATCH 4/4] ARM: bcm283x: Switch to generic timer Marek Vasut
2015-05-05 21:46 ` Stephen Warren
2015-05-05 22:17 ` Marek Vasut [this message]
2015-05-05 22:37 ` Stephen Warren
2015-05-05 22:42 ` Marek Vasut
2015-05-05 22:57 ` Stephen Warren
2015-05-05 23:37 ` Marek Vasut
2015-05-06 15:52 ` Stephen Warren
2015-05-06 18:13 ` Marek Vasut
2015-05-06 19:51 ` Tyler Baker
2015-05-08 16:06 ` Stephen Warren
2015-05-08 16:23 ` Marek Vasut
2015-05-08 16:03 ` Stephen Warren
2015-05-08 16:31 ` Marek Vasut
2015-05-08 16:40 ` Stephen Warren
2015-05-08 18:20 ` Marek Vasut
2015-05-28 13:25 ` [U-Boot] [U-Boot,4/4] " Tom Rini
2015-05-28 13:25 ` [U-Boot] [U-Boot,1/4] ARM: bcm283x: Repair wdog.h Tom Rini
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=201505060017.23375.marex@denx.de \
--to=marex@denx.de \
--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 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.