lkml.org 
[lkml]   [2009]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: backwards busy wait using "time_before()"??
On Thu, 31 Dec 2009, Robert P. J. Day wrote:

>
> if this is an idiotic question, i'll blame it on the fact that
> there's only decaf left in the house.
>
> from drivers/spi/spi_stmp.c:
>
> #define busy_wait(cond) \
> ({ \
> unsigned long end_jiffies = jiffies + STMP_SPI_TIMEOUT; \
> bool succeeded = false; \
> do { \
> if (cond) { \
> succeeded = true; \
> break; \
> } \
> cpu_relax(); \
> } while (time_before(end_jiffies, jiffies)); \
> succeeded; \
> })
>
>
> is it just me, or do those arguments to time_before() look
> backwards?

with a quick grep, i found one other example that looks reversed.
from drivers/char/hvsi.c:

static void hvsi_drain_input(struct hvsi_struct *hp)
{
uint8_t buf[HVSI_MAX_READ] __ALIGNED__;
unsigned long end_jiffies = jiffies + HVSI_TIMEOUT;

while (time_before(end_jiffies, jiffies))
if (0 == hvsi_read(hp, buf, HVSI_MAX_READ))
break;
}


surely that's backwards as well, no?

rday
--


========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================


\
 
 \ /
  Last update: 2009-12-31 20:25    [W:0.043 / U:4.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site