From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 898B139B49E for ; Thu, 23 Jul 2026 04:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784782598; cv=none; b=eWH5OrLDf6Dg+8Re1ZRj/R1X2S2KdULsc99q7xpXs4ocrWMe6sTa7q1zFOYpSMn3oN0ygSyhCLKHngMp2qF+/qXwQbpl/2S5shZNppGyjIWBqOM/ZcAN7ztunstkpvk92u8xi2f15BxQEaK/kgVf3SrlbuXO4nF/ySR1cCpq1qI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784782598; c=relaxed/simple; bh=mTFpbE7y3C+2o7mpAVBR3/EaCOyAljsg1tywzWeZ7gY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g1yI5FYDghay9kr8CXfGQt2/ChiKrZMkPzuIlOh/7PYpb5MCR0XTOptazzs87/c4acNnQWmF5VzCvXh+POE/ZSfmtOfxxfSFfUXOSVBVGV3AFVnAUORqpvZNjzPxKucjGbUxz/F/3TwMOU/bczEBDhmo3kURdWvgTxfWLHbIad0= 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=a6mrd0YZ; arc=none smtp.client-ip=209.85.214.175 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="a6mrd0YZ" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2ceae1ed204so2228185ad.0 for ; Wed, 22 Jul 2026 21:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784782591; x=1785387391; 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:content-type; bh=2qqyvFlsAJpGp08mEcLtsqWSAzW5XWPBTBAzSWZnfs4=; b=a6mrd0YZkIHxLi4ckfh1lZoTYS87DUn2J33GMTQby2aqb09DpgtZVUWbOMQE4ekx8f t2SBlyOIXrY0JnEgQbBLzEG4q6+gXefqtNm6sCc91edJny2rUddhqwui6YdnQS2P1Mpa t+rirL31kj011rXaePXdmNSOrhZvbJ/CsQlHp+sJZqCKIH6HZSReLuYWxT87TwWOFrda OQPTQ6OEFKfusRwakNkCHeV5dBLvHl/WyW7z7jSD6eKYUwqXIBg5eRAvm49McdtijPIg 35Oj58k7XiesnrRvQRm82hzOXmUfOE3JdNssTP1eyGvPer1NQpsVWh3Gg0rjg0moARx3 aiKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784782591; x=1785387391; 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:content-type; bh=2qqyvFlsAJpGp08mEcLtsqWSAzW5XWPBTBAzSWZnfs4=; b=pWrt+a3wY71CMkCmgs1XC5uMEVBinGS5/VUlIto19cOe026Y+ZY7+gdmd7C8yfR3si Uh+rTmThGdfriT74o9WUdYXK4oP7TysgtkRMwK2kq4bN0JdPXjwBGzwO4ewenBSeFg7J UllZbNIf1R7zkfVMczqYBzRFcHA7qu53x4eFZiiklDMMKgH65lc80FtmzWtsvCD6i8ps 5bAwGidjzkGBiwR/Kmg+X4U+jSQMqFc28zseQhHaIhp5TIlAb2dG08w03InKZwQXkOKU 9oIypZpx8ekCitvdXUy9EJ+rISxx9iakGd2rDFO/rJAENDK8eFeWnMYYymsP9Eeh6xIi 9EoQ== X-Forwarded-Encrypted: i=1; AHgh+RpW/AOHY7JIzMACHrxAWJcrbYQJyDkV7Olup0TlzXooQaHz0lAC1FVDPQHWis1UEOS6StyYRspjdYHH6+Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzPwGm81tHHku57Tpd/byPRzEGKvb4zc7q+ZiGtpSjANzpK86EB /m1zTZYVVtUUqpxwlyL2eMlfmxQqPvo0REBZ+ffQ3uj+j2ATnGnqdiz9 X-Gm-Gg: AR+sD10e0lPX5KYKC6EXa0t5Z9RmSaU/n3FOmMsrrDgFebcD7RGXcECATX99DcnyuX/ 6LSAcch3I7Igp5aEUf8es5JzkhAOoBmoOpBNpxRWrG/4Dz2088ncph9egm/WaNQqmCZpZ1CqVxq iumiARlkxZZNsYUuOofDvGFBvZqWC0LJta1xhbbKXXbknxAdxWOSpPb3YI2QAP73CJ2raCfhGSr ZPLUQKKS32qBP+LJdck33qZUV3QeCVK8Mg5k6Y9BcX+LwTaVCIwp1jO9IHhTa3HyROF/Lv7ZFbl Ovt9Mp5coT750rMYFdEv92yBuuJLjGI3POtHaG9KdDItbTTda2CZv0OTMkvQbYDg/50nqBFNVQ8 dC55qfoBcw4KnmffXV0Fo/iBFCcuhQwPjDcpVqpverVblFM8vf/cAdkqC9s3sKZpF96bAZLmcu7 rI8kCTUIhfpFoq523cG+h0e+eiUAvFwG29jYL+ X-Received: by 2002:a17:902:e801:b0:2c9:8f4a:90b with SMTP id d9443c01a7336-2cfa6a54e47mr20230015ad.3.1784782591028; Wed, 22 Jul 2026 21:56:31 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cfa57542e0sm7258365ad.67.2026.07.22.21.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 21:56:30 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen , nuno.sa@analog.com, Shenghao Ding , Kevin Lu Cc: Baojun Xu , Sen Wang , Steven Eckhoff , Srinivas Kandagatla , Kuninori Morimoto , Charles Keepax , Linus Walleij , u.kleine-koenig@baylibre.com, Thorsten Blum , Kees Cook , Chen Ni , Bartosz Golaszewski , Shengjiu Wang , Sebastian Krzyszkowiak , Pengpeng Hou , Richard Fitzgerald , patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, bui duc phuc Subject: [PATCH 22/26] ASoC: codecs: wm8962: Use guard() for mutex locks Date: Thu, 23 Jul 2026 11:53:23 +0700 Message-ID: <20260723045327.28260-23-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260723045327.28260-1-phucduc.bui@gmail.com> References: <20260723045327.28260-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/wm8962.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 2db822fc1de7..8a9598161b35 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1564,11 +1565,10 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct wm8962_priv *wm8962 = snd_soc_component_get_drvdata(component); int old = wm8962->dsp2_ena; - int ret = 0; int dsp2_running = snd_soc_component_read(component, WM8962_DSP2_POWER_MANAGEMENT) & WM8962_DSP2_ENA; - mutex_lock(&wm8962->dsp2_ena_lock); + guard(mutex)(&wm8962->dsp2_ena_lock); if (ucontrol->value.integer.value[0]) wm8962->dsp2_ena |= 1 << shift; @@ -1576,9 +1576,7 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol, wm8962->dsp2_ena &= ~(1 << shift); if (wm8962->dsp2_ena == old) - goto out; - - ret = 1; + return 0; if (dsp2_running) { if (wm8962->dsp2_ena) @@ -1587,10 +1585,7 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol, wm8962_dsp2_stop(component); } -out: - mutex_unlock(&wm8962->dsp2_ena_lock); - - return ret; + return 1; } /* The VU bits for the headphones are in a different register to the mute -- 2.43.0