[U-Boot] [PATCH v1 (WIP) 16/16] [Timer]Replace get_timer() usage in arch/

Mike Frysinger vapier at gentoo.org
Wed Jun 29 07:15:53 CEST 2011


On Wednesday, June 29, 2011 00:51:50 Graeme Russ wrote:
> On Wed, Jun 29, 2011 at 2:45 PM, Simon Glass wrote:
> > On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ wrote:
> >> --- a/arch/blackfin/cpu/jtag-console.c
> >> +++ b/arch/blackfin/cpu/jtag-console.c
> >>
> >> -       ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT;
> >> +       ulong start = time_now_ms();
> >>        while (bfin_read_DBGSTAT() & 0x1) {
> >>                if (overflowed)
> >>                        return overflowed;
> >> -               if (timeout < get_timer(0))
> >> +               if (time_since_ms(start) >= CONFIG_JTAG_CONSOLE_TIMEOUT)
> >>                        overflowed = true;
> >>        }
> > 
> > Here I think I have found a use of future time. It is true what they
> > say (or should say) that there is every kind of timeout in U-Boot.
> 
> I personally think that this particular use-case of the timer API is ugly,
> but I was not out to change any symantics, just do a blind translation
> from the old API to the new API
> 
> Hopefully, this will highlight a few dodgy use cases (which I am willing
> to apply fixes for as and when others suggest them)

i wrote this long before i really understood the timer api.  after all, even 
now, there is 0 documentation on the API in the u-boot tree.

should be easy to change the two lines to use the API as designed.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110629/46bce80b/attachment.pgp 


More information about the U-Boot mailing list