backwards busy wait using "time_before()"??
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?
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday
========================================================================
Quoted 21 lines · Robert P. J. Day
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; \ })
Quoted 2 lines
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
========================================================================
Quoted 8 lines · Robert P. J. Day
cpu_relax(); \ } while (time_before(end_jiffies, jiffies)); \ succeeded; \ })is it just me, or do those arguments to
time_before()look
backwards?
Yes it looks backwards. The timeout path probably has been never tested.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.