[Meego-kernel] [PATCH 2/3] intel_mid_i2s, alsa_ssp and cmt_speech drivers
Arjan van de Ven
arjan
Mon Sep 27 09:58:49 PDT 2010
On 9/27/2010 9:52 AM, Bensaid, Selma wrote:
> Hi,
>
> Thanks for reviewing.
> Please see my comments below.
> Thanks,
>
> Selma.
>
>> + spin_lock_bh(&s_stream_status.lock);
>> + if (!--s_stream_status.ref_count) {
>> + s_stream_status.stream_open = false;
>> + spin_unlock_bh(&s_stream_status.lock);
>> +
>> + intel_mid_i2s_close(s_stream_status.ssp_handle);
>> + s_stream_status.ssp_handle = NULL;
>> + /* Unblock an on going OPEN (if any) */
>> + s_stream_status.stream_close = true;
>> + wake_up(&s_stream_status.wait_queue);
>>
>> I think you have a race here.
>>
> [Selma] the Open function has been designed to handle the use case you have mentioned. In that case, Open function is blocked until the end of ongoing Close as shown below.
... and then 2 opens continue in parallel.... because you don't check
against that.
this looks a lot like hand crafted locking to me, and it's pretty
unobvious and dubious in various aspects.
More information about the Meego-kernel
mailing list