All of lore.kernel.org
 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 1/9] ASoC: qcom: audioreach: Use guard() for mutex locks
Date: Wed,  3 Jun 2026 18:49:41 +0700	[thread overview]
Message-ID: <20260603114949.149595-2-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/audioreach.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index a13f753eff98..8b3d1410c788 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -585,7 +585,7 @@ int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev,
 	const struct gpr_hdr *hdr = &pkt->hdr;
 	int rc;
 
-	mutex_lock(cmd_lock);
+	guard(mutex)(cmd_lock);
 	result->opcode = 0;
 	result->status = 0;
 
@@ -597,7 +597,7 @@ int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev,
 		rc = -EINVAL;
 
 	if (rc < 0)
-		goto err;
+		return rc;
 
 	if (rsp_opcode)
 		rc = wait_event_timeout(*cmd_wait, (result->opcode == hdr->opcode) ||
@@ -616,8 +616,6 @@ int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev,
 		rc = 0;
 	}
 
-err:
-	mutex_unlock(cmd_lock);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(audioreach_send_cmd_sync);
@@ -1387,7 +1385,7 @@ void audioreach_graph_free_buf(struct q6apm_graph *graph)
 {
 	struct audioreach_graph_data *port;
 
-	mutex_lock(&graph->lock);
+	guard(mutex)(&graph->lock);
 	port = &graph->rx_data;
 	port->num_periods = 0;
 	kfree(port->buf);
@@ -1397,7 +1395,6 @@ void audioreach_graph_free_buf(struct q6apm_graph *graph)
 	port->num_periods = 0;
 	kfree(port->buf);
 	port->buf = NULL;
-	mutex_unlock(&graph->lock);
 }
 EXPORT_SYMBOL_GPL(audioreach_graph_free_buf);
 
-- 
2.43.0


  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 ` phucduc.bui [this message]
2026-06-03 11:49 ` [PATCH 2/9] ASoc: qcom: q6adm: " 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 ` [PATCH 7/9] ASoC: qdsp6: q6routing: " phucduc.bui
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-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.