From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 AD2F43BC68A for ; Tue, 21 Jul 2026 10:27:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784629678; cv=none; b=px3FBy2IFqN2jW/0isLC4W5XR1Je5utJR78LBAew2cgXdlEgKNZlXaqEa35OGdVLyn1xr+a8PJOp0cvzB6iujAMHAc2gR8zaC5AYfkCpLge2AyrdXZRzCKN4JD4aHqxlpsKVXBAx6KSqW86TCdGhJ4gQ0gqHSwpU5ckOEHrOHE8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784629678; c=relaxed/simple; bh=j7IRCq6xm1VYCtZq2k62j8PjKHVyBOvTOYRKr/IN3Nw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=txsk4fDWoV7a5i2chDVMZTfd9o7wlVTvHXuZIh8agzhY3i9JL9SNHKJt7djpYXknYB+kU0jfFfuq8u6stH/wKEtsSwm87dMOzUXjcXPu5DwQUcYYDsQmgosSWNzrEtuMN097pvIOznFqAYjemtkM9aMYL1TOpsSP/ZlDeHcPFTk= 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=Inslfchp; arc=none smtp.client-ip=209.85.214.173 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="Inslfchp" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2cad4170e8eso156530915ad.3 for ; Tue, 21 Jul 2026 03:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784629676; x=1785234476; 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=gCCco9cVx1cOuMyiOEUiJ1UTQlQHfjoxsoHM/LTW3Ro=; b=InslfchpZf5UpXvxDYIljexmMg0s0FZz916/HyswVgMpXgD6E/29XIEuKu4Nn/qOGx tZ1PN9L7gGmBVijUn//N0JEM9CxZbA8P1c7yTC3poo+OI9VFxJPrlsyERwqIhVkT7x55 4B6Z/WBzev71lo1STx5CGisVun22QP9SAn+h6cva5NjpWScsjYNt4u6mRhrw0Fa6ZXWv ENN+cQc6mefmFaswBF02YjmJKDzkhbGCVDPTlbOvnqDeEJqrNDxSssabsUjug1kcohbL F0XzKNjnWxGLexcNOwfoQDeo3FErb0VR66kyRQ/o/vhhCVvboaRnp+ne8vUpROuDOHrn vQpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784629676; x=1785234476; 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=gCCco9cVx1cOuMyiOEUiJ1UTQlQHfjoxsoHM/LTW3Ro=; b=g9lQS1RvaSTTZdsdqNj0vbuxZxTH+sEUitvOHf8+mxbbRNAzRKgfwVM5dZfOSZt0Y0 w65gHOtlbzlDuU30Sfdz3xbXQSpruX2fftuWsS7iSBtAs8wqNv9om8fAoHyKfFeoK/O9 w8TULeNTyXOTt7rw0bxvelxVqG2+6sXMqry282N2kkqB8Eer6fmsIPbcALlddrwixSnW FYuieSQG21Gfz3PsHyN6GOd6uufeLScY3WLVP0s7IMWuE5oROjcWGluRIsyObCIIEcQu zDQbvnFnjNp5ikQiH373xI+xO+qRahA6m65LMEuUlkAWXt62itnA38tk2YSGz/Edra1g bZoA== X-Forwarded-Encrypted: i=1; AHgh+Rpfeekby1V418PjpYLDGWgHCGeLxmg22b+LmzEEKA06qte/GaP9hrstw/Tf0OQQLpo4tge+7iK7OPFVlbs=@vger.kernel.org X-Gm-Message-State: AOJu0YwcrfD+oCO+nbB9CkMKAaLmgaip26d0CBQ9G+pbabW+H/UApB1V Qwg0NOSVYKltLHyURq2Ucj4NJyhhHF3EwT4aR1CUsdZYwVgKvOGtlGMZ X-Gm-Gg: AR+sD12qPZQ975ApXgc+v/bveqvfp2DUOLFsSC02MUnjCF4jCgV999dZlOTAA2YIRYz MNXgw5wE7RW/stwRbHkT4MQTMqAmW5HkHeI/A4wyVoAIgENLVMjGOd4L/kRx0JqufGpJllAoxLR iSV5cu037h4SvTS99aboNlMBWHojMFqo/ruMUW5eat5g/Auu5GKfc6IzULkD3kdWD+s+v5sJEZ1 EfsR1x8K0JFkUii+vY58x2agW3MceS2QzvO5YNaHZDA2FT0DnWmbF6QTSNLEDJXU7RJNzCWOPXw an54+xt3mxg/9sMRfWavsmp37kXFi/GPerVgyLXhHvNAvH0RY3ZDncnw3qfipQp72psuRQfIoYX h51vbEuNvvxUhRkPzEniK0aS6nWRsCniEXzNeftFWxtQgAG01RRmSVFnE12I/YGsyeh+f4ic8bp dAuQZjf5yuIk2jdArdLH9xmPkYPlbzbsto52hK X-Received: by 2002:a17:902:dac6:b0:2cc:307c:51f2 with SMTP id d9443c01a7336-2cf34948943mr194104795ad.22.1784629676095; Tue, 21 Jul 2026 03:27:56 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf3448dac2sm73581365ad.3.2026.07.21.03.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 03:27:55 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Takashi Iwai , Nick Li , Herve Codina Cc: Support Opensource , Liam Girdwood , Jaroslav Kysela , Srinivas Kandagatla , Charles Keepax , Richard Fitzgerald , Matthias Brugger , AngeloGioacchino Del Regno , Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Oder Chiou , Linus Walleij , Kuninori Morimoto , u.kleine-koenig@baylibre.com, Zhang Yi , Marco Crivellari , Kees Cook , HyeongJun An , Arnd Bergmann , Qianfeng Rong , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bui duc phuc Subject: [PATCH v4 12/29] ASoC: codecs: max98095: Use guard() for mutex locks Date: Tue, 21 Jul 2026 17:25:43 +0700 Message-ID: <20260721102600.523199-13-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260721102600.523199-1-phucduc.bui@gmail.com> References: <20260721102600.523199-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/max98095.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 130b6694a634..d93436046849 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -5,6 +5,7 @@ * Copyright 2011 Maxim Integrated Products */ +#include #include #include #include @@ -1532,15 +1533,17 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, regsave = snd_soc_component_read(component, M98095_088_CFG_LEVEL); snd_soc_component_update_bits(component, M98095_088_CFG_LEVEL, regmask, 0); - mutex_lock(&max98095->lock); - snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, M98095_SEG, M98095_SEG); - m98095_eq_band(component, channel, 0, coef_set->band1); - m98095_eq_band(component, channel, 1, coef_set->band2); - m98095_eq_band(component, channel, 2, coef_set->band3); - m98095_eq_band(component, channel, 3, coef_set->band4); - m98095_eq_band(component, channel, 4, coef_set->band5); - snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, M98095_SEG, 0); - mutex_unlock(&max98095->lock); + scoped_guard(mutex, &max98095->lock) { + snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, + M98095_SEG, M98095_SEG); + m98095_eq_band(component, channel, 0, coef_set->band1); + m98095_eq_band(component, channel, 1, coef_set->band2); + m98095_eq_band(component, channel, 2, coef_set->band3); + m98095_eq_band(component, channel, 3, coef_set->band4); + m98095_eq_band(component, channel, 4, coef_set->band5); + snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, + M98095_SEG, 0); + } /* Restore the original on/off state */ snd_soc_component_update_bits(component, M98095_088_CFG_LEVEL, regmask, regsave); @@ -1683,12 +1686,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, regsave = snd_soc_component_read(component, M98095_088_CFG_LEVEL); snd_soc_component_update_bits(component, M98095_088_CFG_LEVEL, regmask, 0); - mutex_lock(&max98095->lock); - snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, M98095_SEG, M98095_SEG); - m98095_biquad_band(component, channel, 0, coef_set->band1); - m98095_biquad_band(component, channel, 1, coef_set->band2); - snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, M98095_SEG, 0); - mutex_unlock(&max98095->lock); + scoped_guard(mutex, &max98095->lock) { + snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, + M98095_SEG, M98095_SEG); + m98095_biquad_band(component, channel, 0, coef_set->band1); + m98095_biquad_band(component, channel, 1, coef_set->band2); + snd_soc_component_update_bits(component, M98095_00F_HOST_CFG, + M98095_SEG, 0); + } /* Restore the original on/off state */ snd_soc_component_update_bits(component, M98095_088_CFG_LEVEL, regmask, regsave); -- 2.43.0