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

Graeme Russ graeme.russ at gmail.com
Wed Jun 29 06:51:50 CEST 2011


Hi Simon,

On Wed, Jun 29, 2011 at 2:45 PM, Simon Glass <sjg at chromium.org> wrote:
> Hi Graeme,
>
> On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ <graeme.russ at gmail.com> wrote:
>>
>> Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
>> ---
>>  arch/blackfin/cpu/jtag-console.c           |    4 ++--
>>  arch/microblaze/lib/time.c                 |    4 ++--
>>  arch/nios2/cpu/epcs.c                      |   12 ++++++------
>>  arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |    8 ++++----
>>  arch/powerpc/cpu/mpc8260/ether_fcc.c       |   12 ++++++------
>>  5 files changed, 20 insertions(+), 20 deletions(-)
>>
>> diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
>> index e0f2975..97ff1de 100644
>> --- a/arch/blackfin/cpu/jtag-console.c
>> +++ b/arch/blackfin/cpu/jtag-console.c
>> @@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)
>>  static bool jtag_write_emudat(uint32_t emudat)
>>  {
>>        static bool overflowed = false;
>> -       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;
>>        }
>>        overflowed = false;
>
> 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)

Regards,

Graeme


More information about the U-Boot mailing list