Hi Przemyslaw, On Oct 1, 2013, at 7:59 PM, Przemyslaw Marczak wrote:
> Hello Pantelis, > Thank you for reply > > > On 10/01/2013 05:50 PM, Pantelis Antoniou wrote: >> while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) { >> - if (timeout == 0) { >> + if (time == cmd_timeout) { >> time >= cmd_timeout here. >> >> You rely on the timeout hitting exactly the same value which is not >> guaranteed. > I think this condition is guaranteed here, because of "time" value that is > incremented only inside the loop. > Also if meets (time == cmd_timeout) condition and next if timeout will be > increased twice, then eg. if current timeout > is 100ms -> next will be 200 ms, so it needs 100 loops and no more. > > Am I wrong? > OK, let's take things one at a time: First of all you use the global variable cmd_timeout, and you alter it's value. Where it is reset back in case the operation starts all over again? Secondly the check time == cmd_timeout is very very fragile. You depend on the loop only incrementing the time by one. This is not always guaranteed to be the case in the future. Using a greater than comparison you are safe even if in sometime in the future the step changes and there is absolutely no performance penalty. > Regards > > -- > Przemyslaw Marczak > Samsung R&D Institute Poland > Samsung Electronics > p.marc...@samsung.com > Regards -- Pantelis _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot