7 Sep
2011
7 Sep
'11
5:07 a.m.
On Tue, 6 Sep 2011 15:59:54 -0700 Andrew Morton akpm@linux-foundation.org wrote:
--- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1761,6 +1761,10 @@ static int wait_for_avail(struct snd_pcm_substream *substream, snd_pcm_uframes_t avail = 0; long wait_time, tout;
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&runtime->tsleep, &wait);
- set_current_state(TASK_INTERRUPTIBLE);
Well, this isn't very good either. if a wakeup gets delivered to runtime->tsleep before the set_current_state(), this process will go ahead and incorrectly set itself into TASK_INTERRUPTIBLE state.
... and then check the condition for exit, and then set it to TASK_RUNABLE a the end...
That looks like it will be dont-care/cant-happen in this case, but it's setting a bad example.
agreed that your ordering is more clean/better.....
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org