]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: ti: omap-mcpdm: Use guard() for mutex locks
authorbui duc phuc <phucduc.bui@gmail.com>
Fri, 8 May 2026 10:38:34 +0000 (17:38 +0700)
committerMark Brown <broonie@kernel.org>
Mon, 11 May 2026 00:58:47 +0000 (09:58 +0900)
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-5-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/ti/omap-mcpdm.c

index 1a5d19937c64245578c7afbc50b3c202b76b3ad8..c7d7b502f120fe59ff3522b96ad36ffc7dad1f4e 100644 (file)
@@ -251,13 +251,11 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream,
 {
        struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
 
-       mutex_lock(&mcpdm->mutex);
+       guard(mutex)(&mcpdm->mutex);
 
        if (!snd_soc_dai_active(dai))
                omap_mcpdm_open_streams(mcpdm);
 
-       mutex_unlock(&mcpdm->mutex);
-
        return 0;
 }
 
@@ -269,7 +267,7 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
        int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
        int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
 
-       mutex_lock(&mcpdm->mutex);
+       guard(mutex)(&mcpdm->mutex);
 
        if (!snd_soc_dai_active(dai)) {
                if (omap_mcpdm_active(mcpdm)) {
@@ -287,8 +285,6 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
                cpu_latency_qos_remove_request(&mcpdm->pm_qos_req);
 
        mcpdm->latency[stream1] = 0;
-
-       mutex_unlock(&mcpdm->mutex);
 }
 
 static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,