From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171]) (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 AC43C3CF1F2 for ; Wed, 17 Jun 2026 10:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781692446; cv=none; b=oxnJDf2rJW7kwFFdzuvWP10RDZpqphLXxgCoWH4+32ugMEwynhOOURESA/bmWVsB7rpLw3ltAq07lGcxBqv4oKwPRcR0dpAFizgaLadL8q8RLPe//o2jn2pBrKNN9my57g7fRDLnCxPEK9vH3smB8gBU1HipZxyzt78iA1Lup0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781692446; c=relaxed/simple; bh=0VKFkNlEKDw288PdSdXQHhZ6q0aNgLP3kbBRSkQ53io=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ez6c2Omv68vLP91kTw/OF+NSf/AaESDRv7c5S800ydEyiTWXFswayhz9NUjFprGAW1qTY7qmiePPZwLKOBSbOelc6r69i/cAEZ4V0eAqj4j/eww9Jwfz4pvR5PfWhLZl28C1kNflU9R6Vhd9jARtcKnqc10fOS5ot/m8HttQ3ik= 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=sLCHEUTh; arc=none smtp.client-ip=74.125.82.171 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="sLCHEUTh" Received: by mail-dy1-f171.google.com with SMTP id 5a478bee46e88-30bd47b9f0fso479903eec.0 for ; Wed, 17 Jun 2026 03:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781692445; x=1782297245; 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=yrGTC5BuLCcleWlyDxhfzmeV1rXl6zWQpWVZTTauIJk=; b=sLCHEUTh/sM1p1b7zaued3tAOgbVZn5Nl6hBsNqKWIEMTcPZiNDcFVfnAbVCkWesZU +7GfExcqtrg8pgV7j7UZP5Em1dMLD71Brpfr0DkE6qbueXBqHiAU0ZjNkTQNKnrf9Ke8 ZsB0gffIat204H47eOJqL7bmXcNTCWBEJnTxvqYfBpRzNkYmO+uYsp0Q9uWUaVDJYqq/ TcUiSwT4sDe59veHKQ3Zd1jO24qKJ7DfFFvsJ6845zYJnZlWOg/T6FYiYUmamQG2LLUl aLIvJELcfdi7NO1qn6cVtuQzH48HURjz7xBvFGuKT29EfgncgMC4oMST3P8aFjLL2fp3 rIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781692445; x=1782297245; 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=yrGTC5BuLCcleWlyDxhfzmeV1rXl6zWQpWVZTTauIJk=; b=FPHHjN9bPIPuDSywCydGp8yBhOi9RJEQAqvVlOzK0aDphwq5I5uUAs7vy6uU/iGAtp Spxywa35vKY79q6wrfMQTFj9wSYuYP9Xjd65dQwwPccDw8gLNgSkuJF6Vy6Z217WZKVi PuKf5IA2JxMFrqgGbmMuLVWrjrT58EC43352d0dRYBsTSK5VXCFR5t1uN2uqSx1liU2D LJ/s6ebUBci4HkK0IQA1fck6oF1yFQmTK5GMQwV4yZh8AX0PEN3sZgM2gN29yu3ux5LG xxThn1YCtqcT3h0yE6BQ6gDhVFWRUSIV7lPSLuZF8GTIfcnVz/QCrfVxxep/NjURzJ02 sHrg== X-Forwarded-Encrypted: i=1; AFNElJ86PIUBqSCqP3M1zYxsTw13i0vrQUB+2sk6zEoIHf8HN7HsHMlJYEfobN1JcbDKh5b7GXxFzBXMQW75Rv0=@vger.kernel.org X-Gm-Message-State: AOJu0YwfkaGnAzmkzyfwPjkTgLHOdmZSGslIhrMIcHG72laUbgVpjU4E uJyHfyqAwqfHH1+IAm/5nleMBocynxvBxjGVRXZXOB6t/l5YWkTlvnwL X-Gm-Gg: AfdE7ckHHagalLg2qYnGlNoIx/OA67PvYeK7Eoi9RD5eotRSRoLtutKP7nBnC8PGwbg hyTlD1fwanBwGtnrQdpBY6rndykj7rEaZanV1hd2arPlTks5i+IPcxNnzXh2sUMyP0YCo/El4PV yKAm/3u9KgtjyxD0wg20NpVb8w2cvJGtp9QaWuIPQoWe7anfcwUuDqiX591er33XDcepKpTMtC2 laxoCSIG2XPYWL32QzXI7RyYtcWKzkUDNgtPUkW+HSpbkKgX1wmkBtceW8KvGKx2dStHQt79j0I xRiysnBLtjJbxEbMexoP0rZ4L+ZoES0rdV5q1bpiXjj9ZhfsFZnxIkjwVUqw1Dcym3pfIM1Hmts A9LfEZkJToZGI96CDBATMRUc+eERjUItkneP3Ff5Z5FtAL8MOZnJ+GVTvOM+6SpJbCj4EJCowQJ SEA4tHJqsPeQoBmAxb1BEP8XUSmAQU4mbnQ3YK5Q01Cy4pMCo= X-Received: by 2002:a05:7300:ad24:b0:30b:c502:23cc with SMTP id 5a478bee46e88-30bca07744bmr1769706eec.17.1781692444831; Wed, 17 Jun 2026 03:34:04 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3081e5d0828sm24616275eec.10.2026.06.17.03.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2026 03:34:04 -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 07/78] ASoC: codecs: aw88166: Use guard() for mutex locks Date: Wed, 17 Jun 2026 17:31:24 +0700 Message-ID: <20260617103235.449609-8-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/aw88166.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c index 3f15f4ac51f7..aa37d1a3d1fa 100644 --- a/sound/soc/codecs/aw88166.c +++ b/sound/soc/codecs/aw88166.c @@ -1173,9 +1173,8 @@ static void aw88166_startup_work(struct work_struct *work) struct aw88166 *aw88166 = container_of(work, struct aw88166, start_work.work); - mutex_lock(&aw88166->lock); + guard(mutex)(&aw88166->lock); aw88166_start_pa(aw88166); - mutex_unlock(&aw88166->lock); } static void aw88166_start(struct aw88166 *aw88166, bool sync_start) @@ -1413,11 +1412,10 @@ static int aw88166_profile_set(struct snd_kcontrol *kcontrol, struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); int ret; - mutex_lock(&aw88166->lock); + guard(mutex)(&aw88166->lock); ret = aw88166_dev_set_profile_index(aw88166->aw_pa, ucontrol->value.integer.value[0]); if (ret) { dev_dbg(codec->dev, "profile index does not change"); - mutex_unlock(&aw88166->lock); return 0; } @@ -1426,8 +1424,6 @@ static int aw88166_profile_set(struct snd_kcontrol *kcontrol, aw88166_start(aw88166, AW88166_SYNC_START); } - mutex_unlock(&aw88166->lock); - return 1; } @@ -1607,12 +1603,12 @@ static int aw88166_request_firmware_file(struct aw88166 *aw88166) return ret; } - mutex_lock(&aw88166->lock); - /* aw device init */ - ret = aw88166_dev_init(aw88166, aw88166->aw_cfg); - if (ret) - dev_err(aw88166->aw_pa->dev, "dev init failed\n"); - mutex_unlock(&aw88166->lock); + scoped_guard(mutex, &aw88166->lock) { + /* aw device init */ + ret = aw88166_dev_init(aw88166, aw88166->aw_cfg); + if (ret) + dev_err(aw88166->aw_pa->dev, "dev init failed\n"); + } return ret; } @@ -1639,7 +1635,7 @@ static int aw88166_playback_event(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); - mutex_lock(&aw88166->lock); + guard(mutex)(&aw88166->lock); switch (event) { case SND_SOC_DAPM_PRE_PMU: aw88166_start(aw88166, AW88166_ASYNC_START); @@ -1650,7 +1646,6 @@ static int aw88166_playback_event(struct snd_soc_dapm_widget *w, default: break; } - mutex_unlock(&aw88166->lock); return 0; } -- 2.43.0