
6 Aug
2009
6 Aug
'09
12:12 p.m.
With old configuration it could happen tout=0 if CONFIG_SYS_HZ<1000 solved using an unsigned long long
I had the same problem with an ancient version of a vendor-ported u-boot. There my CFG_HZ was 100, so the timeout was 0.
I used this, which avoids the preprocessor conditional. Since the HZ value is a compile-time constant, the compiler chooses the if or else branch and doesn't spit a run-time conditional.2
if (CFG_HZ > 100000) tout *= CFG_HZ/1000; /* for a big HZ, avoid overflow */ else tout = tout * CFG_HZ / 1000 + 1;
/alessandro