Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Jon Smirl
On Tue, May 26, 2009 at 2:17 PM, Timur Tabi wrote: > Geoff Thorpe wrote: > >> rc = spin_event_timeout((ret = in_be32(x) & 0x14), ...); > > It's an interesting idea, but I have two problems with it: > > 1) This approach is that it depends on the internals of the macro.  That is, > you're sneaking

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Timur Tabi
Geoff Thorpe wrote: > rc = spin_event_timeout((ret = in_be32(x) & 0x14), ...); It's an interesting idea, but I have two problems with it: 1) This approach is that it depends on the internals of the macro. That is, you're sneaking in an assignment in the hopes that the code will behave properl

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Geoff Thorpe
Timur Tabi wrote: > Geoff Thorpe wrote: > >> So from this user's perspective (FWIW), it would come as a surprise if >> the return value reflected the evaluated expression rather than what >> happened w.r.t. the spin/timeout. > > It shouldn't come as a surprise because I've thoroughly documented t

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Timur Tabi
Jon Smirl wrote: > Then if I don't care about the result (which I think is the common case)... > > rc = spin_event_timeout(in_be32(x) & 0x14, ...); > if (rc) >timeout_happened; That's another way of doing it, but I'm already at version 9 of my patch, and I'm not inclined to make any changes

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Jon Smirl
On Tue, May 26, 2009 at 1:03 PM, Timur Tabi wrote: > Geoff Thorpe wrote: > >> So from this user's perspective (FWIW), it would come as a surprise if >> the return value reflected the evaluated expression rather than what >> happened w.r.t. the spin/timeout. > > It shouldn't come as a surprise beca

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Timur Tabi
Geoff Thorpe wrote: > So from this user's perspective (FWIW), it would come as a surprise if > the return value reflected the evaluated expression rather than what > happened w.r.t. the spin/timeout. It shouldn't come as a surprise because I've thoroughly documented the behavior. I also think r

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Jon Smirl
On Tue, May 26, 2009 at 12:20 PM, Geoff Thorpe wrote: > Timur Tabi wrote: >> On Mon, May 25, 2009 at 12:46 PM, Jon Smirl wrote: >> >>> I just tried using this. The !rc has the effect of making the error >>> return be zero instead the normal not zero. >> >> You're confused.  It's not a "return cod

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-26 Thread Geoff Thorpe
Timur Tabi wrote: > On Mon, May 25, 2009 at 12:46 PM, Jon Smirl wrote: > >> I just tried using this. The !rc has the effect of making the error >> return be zero instead the normal not zero. > > You're confused. It's not a "return code", it's a return value. I > guess I should have called the

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-25 Thread Timur Tabi
On Mon, May 25, 2009 at 12:46 PM, Jon Smirl wrote: > I just tried using this. The !rc has the effect of making the error > return be zero instead the normal not zero. You're confused. It's not a "return code", it's a return value. I guess I should have called the parameter "ret" instead of "rc

Re: [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-25 Thread Jon Smirl
On Tue, May 19, 2009 at 3:26 PM, Timur Tabi wrote: > The macro spin_event_timeout() takes a condition and timeout value > (in microseconds) as parameters.  It spins until either the condition is true > or the timeout expires.  It returns the result of the condition when the loop > was terminated.

[PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout()

2009-05-19 Thread Timur Tabi
The macro spin_event_timeout() takes a condition and timeout value (in microseconds) as parameters. It spins until either the condition is true or the timeout expires. It returns the result of the condition when the loop was terminated. This primary purpose of this macro is to poll on a hardware