From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16FB4CD98ED for ; Thu, 18 Jun 2026 11:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eeDyrRSgLV/yx9S+U/FOT1rxO1cOlIi+l6TEpJj57t4=; b=MxRzwalfcyW62LN8y18kPttalf 4w7Gs5+AeuIjFREf1ogmVrucWCLO1PjO/y4vbYpZNAUDYGzyVapXD+71HlPqLwZUfrJdgr+re/uw2 nrR08uZ3h9Q7toDTmnhE6vpiKeSbcZcCunYBkpR4+pvIo1NnR81qdnJGbLi6+ifW32ksFa7x1UscB pxWPYQY4L7VxZBKtbkHJbBLLBTXS5JGKL4upUhCh/lXJxzfbEaAHWoHE0yHboX+JT1go8yLgX4MlS D6e79ExWeBqXVB5PiXSdAHUdZ6UbzPMMiO7AOD/G1WzCUJOMHWq9sXmAoHarGCTRFlRQBQR8ixbha 3nk4R63Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1waAcC-000000018vi-3kkS; Thu, 18 Jun 2026 11:08:56 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1waAc9-000000018uj-0kdz for linux-mediatek@lists.infradead.org; Thu, 18 Jun 2026 11:08:55 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2c0b9328c4aso5608555ad.0 for ; Thu, 18 Jun 2026 04:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781780932; x=1782385732; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eeDyrRSgLV/yx9S+U/FOT1rxO1cOlIi+l6TEpJj57t4=; b=or90lKnubYwUHSeA6ZM7Ir2Vofukt4wydffQQxdZlFeN1b/MyigD3qDhWGZzaLeoYb tfzZSB7WFY0OU9UWVBt3BfHbb87fgk5BE+7N7vcCt3mSOtgGZzwnM2kXlk1up5O5x35E 38l8jGa9UBFFZZRdjRZizg77iM2r4qAKsMgriqD6jwx97tzy3vhxE+oWRNLpJXnbNp+x zgyOWgwmgeRv7ZMtLylqPcU0C5LEd+Uhl1wGPFhQj5xYm1uxb0DV3ECQSIbEyZOdw+Nk REJw9o/lgZeIOLXriOXqqa1XcKIOKeUef1hD9GVMZgiIMOdO6IhjNzyKMCOYEXPBrD6F d/Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781780932; x=1782385732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eeDyrRSgLV/yx9S+U/FOT1rxO1cOlIi+l6TEpJj57t4=; b=GJyWPwQMclU6YODCn+zOAbFlNLoR/T9FwwfOfIokTaylqbAtZFd51KBDw5TK5uxHFa zoLb3FEaUlhYKxRNz1znVaBWTsKP3uZ0gCelKVoahEj3X2q4oOGnhxyd/I001bTV1TOT ndwstQGlXCdnbxVLyESAh/loekR+duBibj7sKBSEQeKBDTuzxRdXnTlMACJbNk00RkdQ dkAzxtyWsrhiCsQMiF9x5cuSNfDFwhvJIsxa3en9SsmysObC9dib68p+D4EyCWqX4yLU VJTkd7LoBxSN3VKnR6SZgvWcw4cWl8jmqKSIqWnxNkwmOgrymJ+KnTTwiNgy6v4lnSLq eehA== X-Forwarded-Encrypted: i=1; AFNElJ9TA+nqIYpt99NTXwUPVUhVMG39K6/f9e7S5AFJWFY29SnkvrttGybJVSLQndcxN5EZLyOf4ixiZp/1/ZTGXw==@lists.infradead.org X-Gm-Message-State: AOJu0YwTgdTIWz2+QuUfzUqQ/0h1SOd4X/zawyUjncpjsnGB3SMOZScM ZN6gP38y029dSi29x8/Uo8fgSQ+OMs6ZjTme5jiW/VWECb0cydgQcuoU X-Gm-Gg: AfdE7cmS/vj+ilBeqSX/7NDI8n2NCdut5tv+QTPzqv+8VZvCTZ8P7hH88lL6uShggKo Jj3y3lGQzv+OJJWWb+vtuTQQ1R+UNEoaf++hRyNvEWXvlfejiikEh5EchK0pNnGYB54UH7rtr0l Z+y+ZjDYVNarFx9DFKQlsEON2ydD/BbA3EkC0swsWHe6ctZ6VKfBy034JSjQU5c7Wm7wfr3Ql8p kGhyhQ/SsFyfE3mIEGgixZz0gI12qFyyP3dkunu3p85V36wqBarqv8veZ3QbwpR6lJ+anP4XS1R DF5ooAqmnbynDj1Lcx9A/Ugg5sNhiWnKY6CtcMbEwsn8Zdz16o62ElXWEd0q+WmTDdfPfDgJ7y0 fR1lZo/ianSSzWKySXB3zVs6CjBkJMIdx5YAp9PmQqB42nxk0zZHwHsDJuxI9rm41PHnDqu9AtH 99+wAB+DiIIhFuWx4BKBOCFnKKQIHD+QwOF0xRHmpKtQHCOWxoAAMLTVlh2A== X-Received: by 2002:a17:903:2447:b0:2c0:b5c1:8e22 with SMTP id d9443c01a7336-2c6f34218aamr24583345ad.12.1781780932102; Thu, 18 Jun 2026 04:08:52 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c42f1f0f19sm196384565ad.10.2026.06.18.04.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 04:08:51 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Cheng-Yi Chiang , Tzung-Bi Shih , Guenter Roeck , Benson Leung , David Rhodes , Richard Fitzgerald , povik+lin@cutebit.org, Charles Keepax , Support Opensource , Nick Li , Herve Codina , Srinivas Kandagatla , Matthias Brugger , AngeloGioacchino Del Regno , Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Oder Chiou , Lars-Peter Clausen , nuno.sa@analog.com, Steven Eckhoff , patches@opensource.cirrus.com, chrome-platform@lists.linux.dev, asahi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bui duc phuc Subject: [PATCH 57/78] ASoC: codecs: tas5805m: Use guard() for mutex locks Date: Thu, 18 Jun 2026 18:08:06 +0700 Message-ID: <20260618110827.232983-1-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260617103235.449609-1-phucduc.bui@gmail.com> References: <20260617103235.449609-1-phucduc.bui@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260618_040853_340194_B91E3E45 X-CRM114-Status: GOOD ( 11.12 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: bui duc phuc Clean up the code using guard() for mutex locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc --- sound/soc/codecs/tas5805m.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/tas5805m.c b/sound/soc/codecs/tas5805m.c index bcc8cab8d667..f21670dab0f4 100644 --- a/sound/soc/codecs/tas5805m.c +++ b/sound/soc/codecs/tas5805m.c @@ -230,10 +230,9 @@ static int tas5805m_vol_get(struct snd_kcontrol *kcontrol, struct tas5805m_priv *tas5805m = snd_soc_component_get_drvdata(component); - mutex_lock(&tas5805m->lock); + guard(mutex)(&tas5805m->lock); ucontrol->value.integer.value[0] = tas5805m->vol[0]; ucontrol->value.integer.value[1] = tas5805m->vol[1]; - mutex_unlock(&tas5805m->lock); return 0; } @@ -255,7 +254,7 @@ static int tas5805m_vol_put(struct snd_kcontrol *kcontrol, volume_is_valid(ucontrol->value.integer.value[1]))) return -EINVAL; - mutex_lock(&tas5805m->lock); + guard(mutex)(&tas5805m->lock); if (tas5805m->vol[0] != ucontrol->value.integer.value[0] || tas5805m->vol[1] != ucontrol->value.integer.value[1]) { tas5805m->vol[0] = ucontrol->value.integer.value[0]; @@ -267,7 +266,6 @@ static int tas5805m_vol_put(struct snd_kcontrol *kcontrol, tas5805m_refresh(tas5805m); ret = 1; } - mutex_unlock(&tas5805m->lock); return ret; } @@ -332,7 +330,7 @@ static void do_work(struct work_struct *work) dev_dbg(&tas5805m->i2c->dev, "DSP startup\n"); - mutex_lock(&tas5805m->lock); + guard(mutex)(&tas5805m->lock); /* We mustn't issue any I2C transactions until the I2S * clock is stable. Furthermore, we must allow a 5ms * delay after the first set of register writes to @@ -345,7 +343,6 @@ static void do_work(struct work_struct *work) tas5805m->is_powered = true; tas5805m_refresh(tas5805m); - mutex_unlock(&tas5805m->lock); } static int tas5805m_dac_event(struct snd_soc_dapm_widget *w, @@ -362,7 +359,7 @@ static int tas5805m_dac_event(struct snd_soc_dapm_widget *w, dev_dbg(component->dev, "DSP shutdown\n"); cancel_work_sync(&tas5805m->work); - mutex_lock(&tas5805m->lock); + guard(mutex)(&tas5805m->lock); if (tas5805m->is_powered) { tas5805m->is_powered = false; @@ -379,7 +376,6 @@ static int tas5805m_dac_event(struct snd_soc_dapm_widget *w, regmap_write(rm, REG_DEVICE_CTRL_2, DCTRL2_MODE_HIZ); } - mutex_unlock(&tas5805m->lock); } return 0; @@ -414,14 +410,13 @@ static int tas5805m_mute(struct snd_soc_dai *dai, int mute, int direction) struct tas5805m_priv *tas5805m = snd_soc_component_get_drvdata(component); - mutex_lock(&tas5805m->lock); + guard(mutex)(&tas5805m->lock); dev_dbg(component->dev, "set mute=%d (is_powered=%d)\n", mute, tas5805m->is_powered); tas5805m->is_muted = mute; if (tas5805m->is_powered) tas5805m_refresh(tas5805m); - mutex_unlock(&tas5805m->lock); return 0; } -- 2.43.0