[PATCH v6] introduce macro spin_event_timeout()

Sean MacLennan smaclennan at pikatech.com
Sat May 2 07:33:54 EST 2009


On Mon, 27 Apr 2009 14:05:44 -0500
"Timur Tabi" <timur at freescale.com> wrote:

> +#define spin_event_timeout(condition, timeout, delay,
> rc)                   \
> +{                                                                           \
> +	unsigned long __loops = tb_ticks_per_usec *
> timeout;                \
> +	unsigned long __start =
> get_tbl();                                  \
> +	while (!(rc = (condition)) && (tb_ticks_since(__start) <=
> __loops)) \
> +		udelay(delay);
> 	    \ +}
> +

Would cpu_relax be a good thing to put here?

Something like:

while (!(rc = (condition)) && (tb_ticks_since(__start) <= __loops)) \
	if (delay) \
		udelay(delay); \
	else \
		cpu_relax(); \

Cheers,
   Sean



More information about the Linuxppc-dev mailing list