From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 6612C3DB310 for ; Wed, 10 Jun 2026 10:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781086929; cv=none; b=td+jbnwBnvfyA7R1fyzGYwSf6XilAcau7cdW9SRJ7l2FfzYy+1vWybNMR8ldbmJ7sV8DvzFo4vf5KysjtkLoSyOrWhON42/soxHW2WHql5EXaC+RDIAsXq4p7Jm0sI3TakqFyk96sxUUfX6kOvE358nxz2oQg7m5PC53QP1lTwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781086929; c=relaxed/simple; bh=ZgLsOTmDPgl0bOgLFz0unt3vkdsvvmeFeKMYXg/J4hs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VdOgM9+m+mo1m8s3f0l38bk/ElgBGsRnJyrsbnw03uE4DYwBQiOWffBycC3X4gNCaTduT2QvXR90hznGKC6L1i7upqWDisrXGNIWySSt1MEmB/dDmLC8dwUb9S0idKq/bj6k+INoHGBRq43/1BdaTYnsLzjz7NezgDI40AbsOLY= 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=SR5U19pJ; arc=none smtp.client-ip=209.85.214.178 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="SR5U19pJ" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2c0bd02d97eso73398155ad.2 for ; Wed, 10 Jun 2026 03:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781086928; x=1781691728; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7rPTGNjskcRtQTw6mA5VpAqBzsjh0SlCyTZZ3Fz9+0M=; b=SR5U19pJAM20BOq1NDdOcmkZaNmEJ3lsnulAARNNmQIPYxt5oU9mSgQis9VUOudkdy mfJ8ggxXZQBYKBSTnDkIMkvfZWwzSwhERSJogULH1mIr44skcyHcwCVdKhcej3YPIGR7 HPt9wjBorx5fe6YXij3lMM9cFK7D6jlY5LABRJEqvZqVaHKlGdQ+C4s29j5Y6wL+WRR6 Hc46ZCjQjnmiBoDbAY+/8OFItLPBdxgtlKuh9Fzegkt0ATaKvyy2XcmpHm/D+kHvIn6T dF9Vsah8Rxpi1TY4DUSx0sBtDQWDUXkZo2fehhLz2QkKZsOVNy8p1Uyldtp/4cWfB0WJ 5Izg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781086928; x=1781691728; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7rPTGNjskcRtQTw6mA5VpAqBzsjh0SlCyTZZ3Fz9+0M=; b=Y+b9agR3dsEEHH0xvWWGl1SSqPCJWoVu/6tZxlhqZWEEC+tTBmkodma/T2u+hTMWVA 6gl28fd3D2axj/oJTdzh3yRhWH0gUdhrHCsMnred8RFHUAKMd6bcryiZBRxhAXF0qyi5 hHkvd8Nu1SHl/gTteJmlxXigvKwt0wzkf7PVLhLV5NzaYI21i7KYwQchMsquNob7iE3W MMHlHEAXNCkhKjCJSIb37bQpju0w9LUij2VIbait4UQBM6wDxB8gNr2EY9cXRuCLmSYP XxV88DR2yNiIDv4AF1oyy/7KvSqyN7A7S/XhHHu+BDLJuC5o8rRuSo5Ygp2zopyL4b0m pgWQ== X-Forwarded-Encrypted: i=1; AFNElJ/9Dq738LgXyzMrRX6eTxJMfmJHyOPkRgthPWcZ6q4qDZFm2mV/R3BxhT7A16tsIDuFhxBtEmLOWjS2xqI=@vger.kernel.org X-Gm-Message-State: AOJu0YznIiarvWPIyv8rzi9LWcV7j6Tys86pH0yBa5sHsQWev4gL0b2r fkBrfYWzmXhgw5QKFwsnaG94zAlxF5K79JatTMWKynLGoN8N87GoxL4d X-Gm-Gg: Acq92OFKxzh5iYpu6l3hVDu0kFTOUxjo5YGl8jwx/o+u7PHqpJmhWiNLgtauBVgMStk SqocEZfZh7WtyPiWDd81tUwpG6tNxtVdWGEhi0YOcD+WbFqns+DoEJCYFXl5NbrdhQ0aoQ7ofCh yFL0Ma94qE/wg2Tthih/jrZ1l1Gsf+JMnx1MP27g8K1mxPucpGFBefIEIyxmnC3g6qL6AThfxbE WgZ+1ShFTDBQ3V2gWGyLidUoKmSVZt3alavXsWoq8GZ4hAYcwVing8giUJDsvYN6sy4n0SwQa78 TodNM6UDvqL09GBo7IfALRmWtDivqnqavNcMx9Zkkf90KiMoIiwO8TgvPHC28Z/PRr7VhvulvEO VIOCMrA2E+utc5Gq7Sxp3aaqGPygNneur/qsLonPBKNKwkKHU9f1FIj8BbVTmDQVwAicHWtikzB sSPogL/rMQfMv1iGEXNW7boplycNB4Vi1OJIGNtT79aJxgCel8WOdmLD1PoqMupLriBSXM X-Received: by 2002:a17:902:f711:b0:2c0:ab82:6ba7 with SMTP id d9443c01a7336-2c1e85ad8d7mr289553825ad.33.1781086927749; Wed, 10 Jun 2026 03:22:07 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c1663981basm239924075ad.67.2026.06.10.03.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 03:22:07 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Jerome Brunet Cc: Liam Girdwood , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH] ASoC: meson: axg-tdm-formatter: Use guard() for mutex locks Date: Wed, 10 Jun 2026 17:21:53 +0700 Message-ID: <20260610102153.83367-1-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 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/meson/axg-tdm-formatter.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c index f451e4dce442..a6ba401104d5 100644 --- a/sound/soc/meson/axg-tdm-formatter.c +++ b/sound/soc/meson/axg-tdm-formatter.c @@ -157,20 +157,19 @@ static int axg_tdm_formatter_attach(struct axg_tdm_formatter *formatter) struct axg_tdm_stream *ts = formatter->stream; int ret = 0; - mutex_lock(&ts->lock); + guard(mutex)(&ts->lock); /* Catch up if the stream is already running when we attach */ if (ts->ready) { ret = axg_tdm_formatter_enable(formatter); if (ret) { pr_err("failed to enable formatter\n"); - goto out; + return ret; } } list_add_tail(&formatter->list, &ts->formatter_list); -out: - mutex_unlock(&ts->lock); + return ret; } @@ -178,9 +177,8 @@ static void axg_tdm_formatter_dettach(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; - mutex_lock(&ts->lock); - list_del(&formatter->list); - mutex_unlock(&ts->lock); + scoped_guard(mutex, &ts->lock) + list_del(&formatter->list); axg_tdm_formatter_disable(formatter); } @@ -330,7 +328,7 @@ int axg_tdm_stream_start(struct axg_tdm_stream *ts) struct axg_tdm_formatter *formatter; int ret = 0; - mutex_lock(&ts->lock); + guard(mutex)(&ts->lock); ts->ready = true; /* Start all the formatters attached to the stream */ @@ -338,12 +336,10 @@ int axg_tdm_stream_start(struct axg_tdm_stream *ts) ret = axg_tdm_formatter_enable(formatter); if (ret) { pr_err("failed to start tdm stream\n"); - goto out; + return ret; } } -out: - mutex_unlock(&ts->lock); return ret; } EXPORT_SYMBOL_GPL(axg_tdm_stream_start); @@ -352,15 +348,13 @@ void axg_tdm_stream_stop(struct axg_tdm_stream *ts) { struct axg_tdm_formatter *formatter; - mutex_lock(&ts->lock); + guard(mutex)(&ts->lock); ts->ready = false; /* Stop all the formatters attached to the stream */ list_for_each_entry(formatter, &ts->formatter_list, list) { axg_tdm_formatter_disable(formatter); } - - mutex_unlock(&ts->lock); } EXPORT_SYMBOL_GPL(axg_tdm_stream_stop); -- 2.43.0