From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 B860E330B0B for ; Fri, 8 May 2026 10:39:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778236752; cv=none; b=O/gEm1xqlvnR3ArRXk4hkSuQwJe5SE/mN2JaDdx4hg4DXZdqk0i2pMZnkV5revmb09jjExm/ENIxsufcSPEUBAfd05Gt31IJCGdmp3QewYJHp3Yz4slpsHn3kMLhYtx9dh1h7UdMTbVrROhwBW/XeuHIj6pwOoQNagaeU9eZsnE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778236752; c=relaxed/simple; bh=IDfulofV8L3pjBAwtb/03nHXAYUcs5a20eJyXfotbwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XyljfyfEizATOBpfPZ7NPLEz9l63XI/BzDorzPrq7OAb3ik+YajxIXbnFlUN/Rutxm8I9/Blqw6jERvuFB8zKFHdve8AI6FVahnnQOMRxlEt/Th1l3tB1xngym6e5zmbS/P1WTqEv04Hqt2QfJcb9q7UMitL1PdcBGofcEH/YcA= 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=HADUq02j; arc=none smtp.client-ip=209.85.214.176 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="HADUq02j" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2babfd18435so9431555ad.1 for ; Fri, 08 May 2026 03:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778236751; x=1778841551; 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=4zKyR5U1yAXuf2WaMek/cM/qR7vazFRcQvHEtxImguA=; b=HADUq02jxeyeOIveZd7w7EYwT6G1v3nrgHsV69x8oSiWWp3JiVtiokQQFF7jGH4HfN HLVTdYpn4UJ6nVoyXCPxG0FRcKyZRu76H6/xx23OV0Lm5WsoJbVrF5adVXji7UprChJK isi3VqYUkJePRvHkG9kznDKJWJQwKSC5I2P/COoy2EB3yTJOT4krTWM8zDLsGR9hkJWY C20HB3EPnKyDvLMaYLYhLE36BevGpLS+OabokUsgoen81CIeVPLof0cw99aLsradV/Vs 4yw6cir6cPBP/CHbiyUpcBawdQ8eZ7lt8segjYnT9NtLDgI9NuXeWI5F9PYH+WTrDw6p 2xIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778236751; x=1778841551; 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=4zKyR5U1yAXuf2WaMek/cM/qR7vazFRcQvHEtxImguA=; b=eGppiKJipjFUI4N/GgO7NZZW1RucN4LPCk7PLT3+aFJoGORy4dlDHioG1m/PAvLjR0 QoP2GflJI6tSsoYpJt/kMs28aeCev+QqSEDeZNIKG7Vx5iMYkdx6OkSQpoaRLyi6Vgy7 CPPr6N8j+/2zRNKfM245cSGkVj/kDeHar+vlMOPxn57r6xvFOnSjX2KB9fT3EiZTJWfv qo+NkuSsNiQH8Ifi/GgbTXVLc1QVsiFJwaCHJNElM1vinm1pOF5p/zKNi/qOweF0yBiC oES5HQShXt0xCE3irrt0VjCdpP4O+pL1nScDan/XpflN1hXicZW9YEstIaCQ3hhZ9y5b 3u3Q== X-Forwarded-Encrypted: i=1; AFNElJ9qjDUOnDazZ/XaCTxcBYdVusWkkNlEUHSS2xBhV4lUnraI323nzWdtN3yFuN2s1pIeJYHxuX6MmYs9K68=@vger.kernel.org X-Gm-Message-State: AOJu0YxWiqDIhI6W5QUfb9+uoaQ0SKICgZce9auxYZgigqBJd3yZKXTB 6PAyK7Uni8vJpYMwOAEa49YqmlsZ3tBugeGYM9+37jtQKThbz91H/E7U X-Gm-Gg: Acq92OF+1lAoP0N0XnC3/U1oxihu0pM9UceLY0/qtkcT+baUFIr4+R6rcoZSHeG2I3k CBPJ+lWhFg7dfrWX/+ra5rLkBmHMM6c8KnH99LDYPw4kk4bFDRwlK29Z0m88ffiscX8XYD5Yv1N R4mTtSpptJPcXiE+NAobQ/swcjcnmAe+phtwGLxzybWRKDmj2YDeHNwepVY+RJsOdllob9XcPCy QEzTcaejcFXcXxCYtm6bEKFxMvUQNG39JHyyDiU3LC/n/pYHMJmvKpDhnY0k/BtNmXHEFKlJxXI E681eiyv9AzPklrZvL22xLAtX67sGtVj9urT9UCYpYHTlyFna89+CV9V77LjzodwBS189+UAKZc vrIToCR2W61SUadiHTCxnZRPYvAcBLJkHLdnBTYvgQYAzlKBNGM8I90tRtIqSRV9T4Ij+9xfmkV JKa/+gzYILHHKzYDjbiJAYTut0TYHUudtWnZ6DTOgmH7ApfEvNQlDp/v+1FQ== X-Received: by 2002:a17:902:e98e:b0:2b4:5e65:5d0e with SMTP id d9443c01a7336-2ba78c40260mr94019615ad.10.1778236750894; Fri, 08 May 2026 03:39:10 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1d27109sm18309345ad.1.2026.05.08.03.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 03:39:10 -0700 (PDT) From: phucduc.bui@gmail.com To: peter.ujfalusi@gmail.com, broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, jarkko.nikula@bitmer.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, bui duc phuc Subject: [PATCH 3/7] ASoC: ti: omap-hdmi: Use guard() for mutex locks Date: Fri, 8 May 2026 17:38:33 +0700 Message-ID: <20260508103837.138142-4-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260508103837.138142-1-phucduc.bui@gmail.com> References: <20260508103837.138142-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/ti/omap-hdmi.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c index 55e7cb96858f..e60f5b483fc5 100644 --- a/sound/soc/ti/omap-hdmi.c +++ b/sound/soc/ti/omap-hdmi.c @@ -49,7 +49,7 @@ static void hdmi_dai_abort(struct device *dev) { struct hdmi_audio_data *ad = dev_get_drvdata(dev); - mutex_lock(&ad->current_stream_lock); + guard(mutex)(&ad->current_stream_lock); if (ad->current_stream && ad->current_stream->runtime && snd_pcm_running(ad->current_stream)) { dev_err(dev, "HDMI display disabled, aborting playback\n"); @@ -57,7 +57,6 @@ static void hdmi_dai_abort(struct device *dev) snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED); snd_pcm_stream_unlock_irq(ad->current_stream); } - mutex_unlock(&ad->current_stream_lock); } static int hdmi_dai_startup(struct snd_pcm_substream *substream, @@ -86,16 +85,14 @@ static int hdmi_dai_startup(struct snd_pcm_substream *substream, snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data); - mutex_lock(&ad->current_stream_lock); - ad->current_stream = substream; - mutex_unlock(&ad->current_stream_lock); + scoped_guard(mutex, &ad->current_stream_lock) + ad->current_stream = substream; ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort); if (ret) { - mutex_lock(&ad->current_stream_lock); - ad->current_stream = NULL; - mutex_unlock(&ad->current_stream_lock); + scoped_guard(mutex, &ad->current_stream_lock) + ad->current_stream = NULL; } return ret; @@ -261,9 +258,8 @@ static void hdmi_dai_shutdown(struct snd_pcm_substream *substream, ad->ops->audio_shutdown(ad->dssdev); - mutex_lock(&ad->current_stream_lock); - ad->current_stream = NULL; - mutex_unlock(&ad->current_stream_lock); + scoped_guard(mutex, &ad->current_stream_lock) + ad->current_stream = NULL; } static const struct snd_soc_dai_ops hdmi_dai_ops = { -- 2.43.0