Linux Sound subsystem development
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Srinivas Kandagatla <srini@kernel.org>, Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH 7/9] ASoC: qdsp6: q6routing: Use guard() for mutex locks
Date: Wed,  3 Jun 2026 18:49:47 +0700	[thread overview]
Message-ID: <20260603114949.149595-8-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260603114949.149595-1-phucduc.bui@gmail.com>

From: bui duc phuc <phucduc.bui@gmail.com>

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>
---

NOTE: This patch is compile-tested only.

 sound/soc/qcom/qdsp6/q6routing.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index 7386226046fa..fff103b9dca1 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -381,7 +381,7 @@ int q6routing_stream_open(int fedai_id, int perf_mode,
 
 	pdata = &routing_data->port_data[session->port_id];
 
-	mutex_lock(&routing_data->lock);
+	guard(mutex)(&routing_data->lock);
 	session->fedai_id = fedai_id;
 
 	session->path_type = pdata->path_type;
@@ -396,10 +396,8 @@ int q6routing_stream_open(int fedai_id, int perf_mode,
 			      session->channels, topology, perf_mode,
 			      session->bits_per_sample, 0, 0);
 
-	if (IS_ERR_OR_NULL(copp)) {
-		mutex_unlock(&routing_data->lock);
+	if (IS_ERR_OR_NULL(copp))
 		return -EINVAL;
-	}
 
 	copp_idx = q6adm_get_copp_id(copp);
 	set_bit(copp_idx, &session->copp_map);
@@ -417,7 +415,6 @@ int q6routing_stream_open(int fedai_id, int perf_mode,
 		q6adm_matrix_map(routing_data->dev, session->path_type,
 				 payload, perf_mode);
 	}
-	mutex_unlock(&routing_data->lock);
 
 	return 0;
 }
@@ -1070,7 +1067,7 @@ static int routing_hw_params(struct snd_soc_component *component,
 
 	session = &data->port_data[be_id];
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	session->path_type = path_type;
 	session->sample_rate = params_rate(params);
@@ -1087,7 +1084,6 @@ static int routing_hw_params(struct snd_soc_component *component,
 		break;
 	}
 
-	mutex_unlock(&data->lock);
 	return 0;
 }
 
-- 
2.43.0


  parent reply	other threads:[~2026-06-03 11:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 11:49 [PATCH 0/9] ASoC: qcom: Use guard() for mutex & spin locks phucduc.bui
2026-06-03 11:49 ` [PATCH 1/9] ASoC: qcom: audioreach: Use guard() for mutex locks phucduc.bui
2026-06-03 11:49 ` [PATCH 2/9] ASoc: qcom: q6adm: Use guard() for mutex & spin locks phucduc.bui
2026-06-03 11:49 ` [PATCH 3/9] ASoc: qcom: q6afe: Use guard() for mutex locks phucduc.bui
2026-06-03 11:49 ` [PATCH 4/9] ASoC: qcom: q6apm: " phucduc.bui
2026-06-03 11:49 ` [PATCH 5/9] ASoC: qcom: q6asm: Use guard() for mutex & spin locks phucduc.bui
2026-06-03 11:49 ` [PATCH 6/9] ASoC: qdsp6: q6core: Use guard() for mutex locks phucduc.bui
2026-06-03 11:49 ` phucduc.bui [this message]
2026-06-03 11:49 ` [PATCH 8/9] ASoC: qdsp6: q6usb: " phucduc.bui
2026-06-03 11:49 ` [PATCH 9/9] ASoC: qcom: topology: " phucduc.bui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260603114949.149595-8-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox