From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 C15553EFFAF for ; Thu, 18 Jun 2026 11:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780933; cv=none; b=GckcPhMUCaxmURQasnXe6XW4TNe4PJwmkozjkMet7fwGoKqdDcxLttM8OLwCIXh3sg3uCTtC9ViHd4YeznjH3WWYDi1sp4wICODzZssUAHPHsQZdwxul4rELxAHAvH5m3fdBKmu11UWRHu0gHUojJNNHfMQninFkcYw1LVbDKbg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780933; c=relaxed/simple; bh=0yaQq+Grvu3FGJjYsD1MZsTbz1cHiqbNEJ6t3Xr8ZZs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CYnEBaz0r1rsFG8TVY9Ve1SYYLxpegB09EIApuzd7ShOqvWOltpgxQbd5VWJZmZyWS+MqZGn74ycogck3RBWvDT+p2V7rbSjoDpO8Jv3FzM3iU+00qHvwgpfd1OI8fctry6ERt+xIcCi5bzVuV0FSuMNPC9Z9TJXo/5Yetct1Ys= 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.172 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-f172.google.com with SMTP id d9443c01a7336-2bf22d29dabso5155575ad.2 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=qBcPowG9hMC/e31GaUKh0TK8s8JXrAPDnMl+yhjKc3EsQgyA3iJoqaJTHFWuVwjG1y ZA8toYhBhC9fWgpyBjHZGKLYE/gQlzKGvtkRPXbem9L1d8Z3lSYB8Ky9NuGUlkcvGXgf aMK8xZRZ38OFhEpirSWPHxY0pfMyhCqVcRrhyNt7E4aXTEspqz5eJzBasnapr906nINe ouGh9vxyrf+aHvHhvLHhf4VyLj+MUadgifz4uC9kGc7Q4jy/BiJGggtW7F82qXPwlHMi 6vxVnopFsIfYxYqvGH9UD5y+ubtkPPKrrUrMtJTZZ/c0V5+xKRzxgp9d9gfr3GcUh2TE TUKg== X-Forwarded-Encrypted: i=1; AFNElJ+EnY18lPQemE6lCjdElYwVy26UBS9YhJ1rKb8eK/w8l2gglZqA4rMkqt1dXqBE1ANJzd7fQfFXhmNIEAo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8+tmdj3+3M4AuOQu8gi/zKj29szIwFg/Zw2y3Z+ZRDfvn5YbB QTO2TEPfOeyfDK1gY01Nz3sWufEkFkxBFwIqt2YTv7XCsd1JXAtE9b0V X-Gm-Gg: AfdE7clnJoed91qz7A5/SUCZIhciWkiQtMxnPOqQK29yWNi6U4DeLvNTN1xTsm8FCI4 YYoQebhtd8RFncuIg7cCJGeO/I+M364LtKBoZrWxidgyvEliX9SB0X67FkYortSIm2rIGrUZFrd L5bF/oEBC2wSOpHckU89Od7iotL6dR1mGFM+UzU8dorK4cAzV7frMf5FDnXwJkvsZPZIri4p7J9 +FsIknSo1hZQuceC/oaaVBrVpK7e8mVzn7nHBIqY8RIFoQXdFt98kTOUfT0sS1K0ugPvBSQbvH/ WYlaDBXf9RQe7V6FSjizTXSXJys/4b8tHByk9K63+crOgxLNWLb1+cYy5gZTC477FkF+Upv+KV3 AFaBCjlcfakOoRAHaEu7rmZMg9THnoTHiWzPl/t2QjYwMYH3EG677qZcSZXCF7mjAboV4eselR+ h8X7pypOc3WPptBvavyHOgAb52hV5+9EI6tVTLHcd2WbaFWEtaxi1f4HqFag== 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-kernel@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