mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
ASoC: ti: omap-hdmi: Use guard() for mutex locks
Clean up the code using guard() for mutex locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Link: https://patch.msgid.link/20260508103837.138142-4-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bc59728f93
commit
59115f79ac
|
|
@ -49,7 +49,7 @@ static void hdmi_dai_abort(struct device *dev)
|
|||
{
|
||||
struct hdmi_audio_data *ad = dev_get_drvdata(dev);
|
||||
|
||||
mutex_lock(&ad->current_stream_lock);
|
||||
guard(mutex)(&ad->current_stream_lock);
|
||||
if (ad->current_stream && ad->current_stream->runtime &&
|
||||
snd_pcm_running(ad->current_stream)) {
|
||||
dev_err(dev, "HDMI display disabled, aborting playback\n");
|
||||
|
|
@ -57,7 +57,6 @@ static void hdmi_dai_abort(struct device *dev)
|
|||
snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
|
||||
snd_pcm_stream_unlock_irq(ad->current_stream);
|
||||
}
|
||||
mutex_unlock(&ad->current_stream_lock);
|
||||
}
|
||||
|
||||
static int hdmi_dai_startup(struct snd_pcm_substream *substream,
|
||||
|
|
@ -86,16 +85,14 @@ static int hdmi_dai_startup(struct snd_pcm_substream *substream,
|
|||
|
||||
snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data);
|
||||
|
||||
mutex_lock(&ad->current_stream_lock);
|
||||
ad->current_stream = substream;
|
||||
mutex_unlock(&ad->current_stream_lock);
|
||||
scoped_guard(mutex, &ad->current_stream_lock)
|
||||
ad->current_stream = substream;
|
||||
|
||||
ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort);
|
||||
|
||||
if (ret) {
|
||||
mutex_lock(&ad->current_stream_lock);
|
||||
ad->current_stream = NULL;
|
||||
mutex_unlock(&ad->current_stream_lock);
|
||||
scoped_guard(mutex, &ad->current_stream_lock)
|
||||
ad->current_stream = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -261,9 +258,8 @@ static void hdmi_dai_shutdown(struct snd_pcm_substream *substream,
|
|||
|
||||
ad->ops->audio_shutdown(ad->dssdev);
|
||||
|
||||
mutex_lock(&ad->current_stream_lock);
|
||||
ad->current_stream = NULL;
|
||||
mutex_unlock(&ad->current_stream_lock);
|
||||
scoped_guard(mutex, &ad->current_stream_lock)
|
||||
ad->current_stream = NULL;
|
||||
}
|
||||
|
||||
static const struct snd_soc_dai_ops hdmi_dai_ops = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user