Re: [PATCH V4 1/5] The macro spin_event_timeout() takes a condition and timeout value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 26, 2009 at 2:29 AM, Geert Uytterhoeven
<Geert.Uytterhoeven@xxxxxxxxxxx> wrote:

> static inline function, returning rc, instead of a macro?

It won't work as an inline function ...

>> +     unsigned long __loops = tb_ticks_per_usec * timeout;                \
>> +     unsigned long __start = get_tbl();                                  \
>> +     while ((rc = (condition)) && (tb_ticks_since(__start) <= __loops)) \

There's no way to pass a expression to an inline function.  It has to
be a macro.  Here, the loop evaluates "condition" at every pass.  If
this were an inline function, "condition" would be evaluated once when
the function were called, and never again.

-- 
Timur Tabi
Linux kernel developer at Freescale
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux