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 6D18D4534B3 for ; Wed, 8 Jul 2026 14:20:41 +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=1783520442; cv=none; b=RtH2gpL7N7Zo47P89tahi6jhMiKyOf/NtQqPGrEwuM2eOjZRV02wgyrt6D0DkZ95fusMb32U7FjtsOIAz6W1uWGc7MBi5PwUCWgV4w5+a14fOKpLwl4iI+2Is7ftxhlhY0KUjPtewWxlNwCqcE29IYchrfcCHBJEs5Z4n5+uX8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783520442; c=relaxed/simple; bh=WwNjHw0SRNfo9aeoqwnXMQdjAxCjVTDeacaiflJQe6I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TOLQwO408cs8cGZiYtlTphnPZF+l03aDc7QWRefx0ekrd3WLGu9+AfPaUoLCmzYzbY7cjNQLPyaHxYCSMvmnK/C4xoc3NBiHNLhgpQw0g2G+6+6XsjlbMo4yiYv9zx/NFVKl/FEBZ8nnuKR2smAw/HFaJ4yFC3cp+RlUVp0Xf3E= 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=jJqreATo; 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="jJqreATo" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2caf4496889so5140225ad.1 for ; Wed, 08 Jul 2026 07:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783520441; x=1784125241; 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=AtVsXFH15IrgzMd0VFvy62roDSh+hKjqh257VzvTJMo=; b=jJqreATohoju0jHtxcNnAID3E4ucH6U1HOdifldRz2BA1qsaHQUBwVvqqQLWmXT7ZS Dbfy0wEY7nAzTwxQJbh8hZBn1BupkniSR1D5GDr/ZbVnXg9tjKGzKGPpsMRT4764duUk 7EcKd/ODEGQHemZ/JVqIHABRAeedwB6lyWJR4OgbX2HxQo8P3Q+1qTnJ04PWQxOCSo72 Di/8pjZWZrNwso2/27BQysSvWSMpqOJt5kWQ/V8fT1BlJjTx/Kr5CAOI0c03O7beAegC JJRi313D13C2YfAaAZsF6+sckWz79TYZ17xOf4Ow1AYHOr6a56s7eL/YQd+8x08QhpxQ gGmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783520441; x=1784125241; 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=AtVsXFH15IrgzMd0VFvy62roDSh+hKjqh257VzvTJMo=; b=anP76wKfZKxlOO7fRDkeiP3HbCZZJUxkiMqZqtSVVqErdVVFZV561JbVPc+GpDuSj2 cLmzRxN10YtR683n7vA1u3P2UqDdnNpnZeTB5RM107+TkfOhSD4fk+gnKFhm4NNho+sm KHjkhzzkP5OrGSyWu3lfurFlq6MkkcD6xi8pzYNV+2KeMx161oDlzO4v7K/tiownIOKf 8DjSo2eaxuW8qGGLGnxK1MOxFDtYZwffKVD2bn4/l6xrm2ntAFMcO6kEoqOlJv6K6en+ HsRejJNxfa4jJb1aN5DfHURChXes8BHdcCndLrDoufvlbj25hq3gBLVO3E5/NIkb85fl dLVQ== X-Forwarded-Encrypted: i=1; AHgh+RqFoo+z8//CsZITWmmgo5wlHC0boMoB90JLhk7sulxZiNYz9SWMlyOPbs4JRtMBUtGm7a8cuw5jpPQGZNI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0VWqI1MObi5z88Kt5cm6TzuCjV6TEdMrs2ktyCIfgzrtOLktr fa32UyIBCVn3aVZFUJVAopKVzYoM5qI1he/LqoVoyU+zQu2IYA4gpW6W X-Gm-Gg: AfdE7ckJY6aLPHJArtTsYqhewhrpToabLm4QgrDnXKhsRaJ7tiTFFm7RWcTzAqkHIq2 j69xAfsnQQrhbWed8zdZbpcdoYB9Lbl8Kvc6sQPyTUBQXfL8Qxcg8GKHBsqK133NASMH5Y8FbAj lfzDf2sdkVk6O1KcorlbPsYsbPVcnEOTUY6IOuLbWnfFA1XGdmK4aNwX/w8qDpmQRDAlz+QbtES 3ECGdjTHmEjoswTiVnJvDN72lL9EWSegXpj0EDnH/tSXsbXddJar6gsQ4P0vSH1KPt86Zvvbnnl 7jCas6NDNPy/yddXp0swOU3TwEP0tLErgBKriHuwHgbRUrA/C0IUmAUonSNJlud2/Lj8wLJhUf5 xkQfPAo8Bl47jvO8SLD6+0EzvAXcp0c92WtG4olSKyXlKi1bnp6ELEhLlTWsfGqYICFLWcC9Scd pvUsmC4WEWYGYHEP4SEXLj1HGI7YSONDRnT2usa0Y57N7sldo= X-Received: by 2002:a17:902:ce04:b0:2c9:fc4c:8142 with SMTP id d9443c01a7336-2cce9f79c01mr26690085ad.2.1783520440899; Wed, 08 Jul 2026 07:20:40 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9d3bcc0sm28841575ad.67.2026.07.08.07.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 07:20:40 -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 v2 12/27] ASoC: codecs: max98095: Use guard() for mutex locks Date: Wed, 8 Jul 2026 21:17:19 +0700 Message-ID: <20260708141734.578926-13-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260708141734.578926-1-phucduc.bui@gmail.com> References: <20260708141734.578926-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 ced9bd4d94da..c47bfa2378b8 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