[alsa-devel] [PATCH RFC v2 3/7] ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders

Jyri Sarha jsarha at ti.com
Mon Aug 17 10:39:31 CEST 2015


On 08/14/15 22:25, Mark Brown wrote:
> On Tue, May 26, 2015 at 09:59:07PM +0300, Jyri Sarha wrote:
>
>> +
>> +	mutex_lock(&hcp->current_stream_lock);
>> +	if (hcp->current_stream && hcp->current_stream->runtime &&
>> +	    snd_pcm_running(hcp->current_stream)) {
>> +		dev_info(dev, "HDMI audio playback aborted\n");
>
> Does this really need to be dev_info()?
>

No, I'll change that to debug level.

>> +	if (hcp->hcd.ops->get_eld) {
>> +		hcp->eld = hcp->hcd.ops->get_eld(hcp->hcd.dev);
>> +
>> +		/* Call snd_pcm_hw_constraint_eld here */
>> +	}
>
> ...
>
>> +	dev_dbg(dai->dev, "%s()\n", __func__);
>> +
>> +	mutex_lock(&hcp->current_stream_lock);
>> +	BUG_ON(hcp->current_stream != substream);
>> +	hcp->current_stream = NULL;
>> +	mutex_unlock(&hcp->current_stream_lock);
>> +
>> +	hcp->hcd.ops->audio_shutdown(hcp->hcd.dev);
>
> Shouldn't the callback be in or before the lock?  Otherwise we could
> potentially race with starting a new stream.
>

Yes, it should be before it. I'll fix that.

If it is inside, there is a "possible deadlock" warning (atleast in the 
similar place in omap-hdmi-audio there was) if those warnings are turned 
on and there is another lock that is taken in the video side callbacks.

Thanks,
Jyri


More information about the Alsa-devel mailing list