From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDF7B3EFD0B for ; Thu, 18 Jun 2026 11:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780934; cv=none; b=jjltczS5ch3FmRxwjX0ACldvyweCIWnK8RFeqVh1U6hCpF+aotB8AbcBMVXV2VKomOFvtUW9zt19Pd3z5w8VdVSxUCON1SIZ5DH8Qs/MJQuKCIi9XIwWku0SNc6HAgM6L6blA6MC2QEo3zy7yJx4k0evceobBQoL6OYQd/qdLPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780934; c=relaxed/simple; bh=0yaQq+Grvu3FGJjYsD1MZsTbz1cHiqbNEJ6t3Xr8ZZs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YBaYAHJJpEcZC32C0OFQrcWRu8fOMjsDOMhelabrHgZ9xJzjUbSblWWx96HkwVNPZxBGBfOv48rBxL6rivu1qcxKjrwVhJU2kgRorZ7sADPRo9LhaCxMUxFSXtYPJz+7QLFiyCiZ60Wxtx3cd/FROvwtoUzDU+h7Pjfk+qnYWn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XkXqWORH; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XkXqWORH" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2c40397e746so5393905ad.3 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=vger.kernel.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=XkXqWORHCkg1poTDWWkf1Tm2cXZ54ZRDRc0Usl27hIds3xaXKnr3En/96bpYZ77NBR +osEnqQqNYlOoe7jHfP9sMqHyaJ1KupEfCEdFZ4qMYCYzNHvp4t23/ZEUbpK0GgDCiSC uE9xBWV7f3bnMJ4f814pZjtuBaSnpv5RwMejppDXnOyFDOOHSpDDazzuNVd7yKtYBY5e iLGZ1zYX+iU8u5DkgfnLvD5/BAx89BMBi2KM4jKPBq4ndDNwCELUusEkV+wpH84Vm0Qu J1DhdHNI8FWQD0XA6yu7IZyUMqUjDydFD0XnmxuzsMkYhbWl3bKHCR1G8xcWWH5l2sZX kI9Q== 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=IdbIXqORGUHYqTAlqn/NxWJ5GutHzSR9D1D07VJGbgAo51Vt7x12dxF8kDKstS53oP W5FwqHU+ViTiTDouk44HyhasoOUelttW41rgyTkhY9UFMh8/usTMzLzbWCHXnUNTYFjY 1Nqkeg2WOnB8BzH92K6qwi9CVVwNGArrhotAePUW2CWh6+QT1vB7jygze4n5ja7AicQi kn1b7D32asFtGl1hLnYWEVb5N3ByftDzheHX8R6aMG6GJ1vXdFeDeme/oaGP87lYyBWA sDcumoaur8223MFg0e/Hx8GQrW02Yq4Hq87RPl+7QMNFFniiw0kd/YlIxokbRJXrZ/Qz 4vww== X-Forwarded-Encrypted: i=1; AFNElJ9QkdYP4tNzPJJsamPyMnQUzA+uNrcAhAD1bO++BADnwSPh3ieS8RtwcR/7Z6bkfheSPR6y45owcLo+THQm@vger.kernel.org X-Gm-Message-State: AOJu0YyPPx471vtpAstiFfvm6P8dh4v+HgnEhjMpMRBOHQSWnPiU2GF+ eBP51FYllngmxcmrDtxHqYf35g5uAV7CbNem3aN5314jrTmJZgZwb0Yw X-Gm-Gg: AfdE7cns3V2QBUA9FyswRluCnyT/8o1BOVHq6RQC3M1MyX0LKG0oBc3kK2dAMy93N0x TxkyPgouUz9bQGu6GA8+2Jin9BeZNsVFTXf3rMlVTWNAZqipG1b3PjwytpM2gXR+d8fLIRr84jg OqgKOH2paRQpgrbbV4sPw0VoeOCS6X5tyePRSk3g6foF8Kauffg1I0CXIl1/g4eUV9magUP/Oca tOYFxZP4F6Ej6R1/9DKffv5t4aXpLQi798nsobQAMHTjTpcxw2UgpEnIG3m0SJv8Lyrf9gBoptr 3JueYpQpbRvwV2SHsAWgp6nXl+6gA9yvyAnDc2pYEf8G2VjNuykHPlhpcImY3TgnBiWYlqqtREX fQu3zUFcopQYfaO+wN6vzPrXzlGEq99TdxZxY4Lw6QWOsYy8+nsBncLbuxDIUGvxIvtyEH1gemx h4+b5emeMkZq1cjAvcf2SF5aff0Ia5kTmhc+d40cx7MP03Nktbp5q84lM5oQ== 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> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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