mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: phucduc.bui@gmail.com, Mark Brown <broonie@kernel.org>,
	Takashi Iwai <tiwai@suse.com>, Tzung-Bi Shih <tzungbi@kernel.org>,
	David Rhodes <david.rhodes@cirrus.com>,
	Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Cheng-Yi Chiang <cychiang@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	povik+lin@cutebit.org, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, patches@opensource.cirrus.com,
	chrome-platform@lists.linux.dev, asahi@lists.linux.dev
Subject: Re: [PATCH 12/24] ASoC: codecs: cs-amp-lib: Use guard() for mutex locks
Date: Fri, 26 Jun 2026 09:47:06 +0100	[thread overview]
Message-ID: <9a31d81e-5656-4525-b5c0-89b02f179cc8@opensource.cirrus.com> (raw)
In-Reply-To: <20260626061329.23264-13-phucduc.bui@gmail.com>

On 26/06/2026 7:13 am, phucduc.bui@gmail.com wrote:
> 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>

It doesn't look cleaner.
But anyway,
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

> ---
>   sound/soc/codecs/cs-amp-lib.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c
> index 371e99205b58..41a9a5b005c6 100644
> --- a/sound/soc/codecs/cs-amp-lib.c
> +++ b/sound/soc/codecs/cs-amp-lib.c
> @@ -7,6 +7,7 @@
>   
>   #include <asm/byteorder.h>
>   #include <kunit/static_stub.h>
> +#include <linux/cleanup.h>
>   #include <linux/debugfs.h>
>   #include <linux/dev_printk.h>
>   #include <linux/efi.h>
> @@ -83,10 +84,12 @@ static int cs_amp_write_cal_coeff(struct cs_dsp *dsp,
>   	KUNIT_STATIC_STUB_REDIRECT(cs_amp_write_cal_coeff, dsp, controls, ctl_name, val);
>   
>   	if (IS_REACHABLE(CONFIG_FW_CS_DSP)) {
> -		mutex_lock(&dsp->pwr_lock);
> -		cs_ctl = cs_dsp_get_ctl(dsp, ctl_name, controls->mem_region, controls->alg_id);
> -		ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, &beval, sizeof(beval));
> -		mutex_unlock(&dsp->pwr_lock);
> +		scoped_guard(mutex, &dsp->pwr_lock) {
> +			cs_ctl = cs_dsp_get_ctl(dsp, ctl_name,
> +						controls->mem_region,
> +						controls->alg_id);
> +			ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, &beval, sizeof(beval));
> +		}
>   
>   		if (ret < 0) {
>   			dev_err(dsp->dev, "Failed to write to '%s': %d\n", ctl_name, ret);


  reply	other threads:[~2026-06-26  8:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  6:13 [PATCH 00/24] ASoC: codecs: Use guard() for mutex & spin locks phucduc.bui
2026-06-26  6:13 ` [PATCH 01/24] ASoC: codecs: ab8500: Use guard() for mutex locks phucduc.bui
2026-06-26  6:13 ` [PATCH 02/24] ASoC: codecs: ak4613: " phucduc.bui
2026-06-26  6:13 ` [PATCH 03/24] ASoC: codecs: arizona-jack: Use guard() cleanup helpers phucduc.bui
2026-06-26 12:06   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 04/24] ASoC: codecs: arizona: Use guard() for mutex locks phucduc.bui
2026-06-26 10:40   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 05/24] ASoC: codecs: aw87390: " phucduc.bui
2026-06-26  6:13 ` [PATCH 06/24] ASoC: codecs: aw88081: " phucduc.bui
2026-06-26  6:13 ` [PATCH 07/24] ASoC: codecs: aw88166: " phucduc.bui
2026-06-26  6:13 ` [PATCH 08/24] ASoC: codecs: aw88261: " phucduc.bui
2026-06-26  6:13 ` [PATCH 09/24] ASoC: codecs: aw88395: " phucduc.bui
2026-06-26  6:13 ` [PATCH 10/24] ASoC: codecs: aw88399: " phucduc.bui
2026-06-26  6:13 ` [PATCH 11/24] ASoC: codecs: cros_ec_codec: " phucduc.bui
2026-06-26  6:13 ` [PATCH 12/24] ASoC: codecs: cs-amp-lib: " phucduc.bui
2026-06-26  8:47   ` Richard Fitzgerald [this message]
2026-06-26  9:36     ` Bui Duc Phuc
2026-06-26  6:13 ` [PATCH 13/24] ASoC: codecs: cs35l56: Use guard() and PM runtime scope helpers phucduc.bui
2026-07-06  9:19   ` Richard Fitzgerald
2026-07-06  9:31     ` Bui Duc Phuc
2026-06-26  6:13 ` [PATCH 14/24] ASoC: codecs: cs42l42: Use guard() cleanup helpers phucduc.bui
2026-06-26 12:18   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 15/24] ASoC: codecs: cs42l43: Use guard() and PM runtime scope helpers phucduc.bui
2026-06-26 10:56   ` Charles Keepax
2026-06-26 12:57     ` Bui Duc Phuc
2026-06-27  9:50       ` Bui Duc Phuc
2026-07-06  8:56         ` Charles Keepax
2026-07-06  9:28           ` Bui Duc Phuc
2026-06-26  6:13 ` [PATCH 16/24] ASoC: codecs: cs42l84: Use guard() for mutex locks phucduc.bui
2026-06-26 10:58   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 17/24] ASoC: codecs: cs43130: " phucduc.bui
2026-06-26  6:13 ` [PATCH 18/24] ASoC: codecs: cs47l15: " phucduc.bui
2026-06-26 12:02   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 19/24] ASoC: codecs: cs47l35: " phucduc.bui
2026-06-26 12:03   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 20/24] ASoC: codecs: cs47l85: " phucduc.bui
2026-06-26 12:03   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 21/24] ASoC: codecs: cs47l90: " phucduc.bui
2026-06-26 12:03   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 22/24] ASoC: codecs: cs47l92: " phucduc.bui
2026-06-26 12:04   ` Charles Keepax
2026-06-26  6:13 ` [PATCH 23/24] ASoC: codecs: cs48l32: " phucduc.bui
2026-06-26 12:15   ` Charles Keepax
2026-06-27  9:36     ` Bui Duc Phuc
2026-06-26  6:13 ` [PATCH 24/24] ASoC: codecs: cs2072x: " 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=9a31d81e-5656-4525-b5c0-89b02f179cc8@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=asahi@lists.linux.dev \
    --cc=bleung@chromium.org \
    --cc=broonie@kernel.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=cychiang@chromium.org \
    --cc=david.rhodes@cirrus.com \
    --cc=groeck@chromium.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=phucduc.bui@gmail.com \
    --cc=povik+lin@cutebit.org \
    --cc=tiwai@suse.com \
    --cc=tzungbi@kernel.org \
    /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

all inboxes | Powered by JetHome®