From nobody Tue Jun 16 20:34:56 2026 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 C13E138947F for ; Wed, 29 Apr 2026 09:16:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777454203; cv=none; b=TVsmVhtWE/TWDgp98FPjMfMVIQETuaifmkPsWazYma8y4xRB+33dZaElLAp1Ic6pu2YlzfGv7MR3J7hcRSQcz/g5d3ZvjpOOl4U+/uy1047hMPNgaAGvK05TGmxpAWDdVRRGkvxuS8Ug/LL1aaokNRUts2dXifcM8UWmq4HJvpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777454203; c=relaxed/simple; bh=asmLzk15w4qcDc3+YDRty0B27VnKKWHuP4plGIAO018=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bl5na0qDWoS1ByA/YR5ufPoY9oIa6n84DEXlybPn97CrcfdpN4S2y/TF+2CMSE2za/1yjzP07hma2Ep/S/Cj5mNF3axLodlDdppRXzWywxTWHgXtKEZTfcIiL9QHKjafCBRC9WK25vQttuddLVXxabrfcQDqihiAGcO959/rasE= 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=EF75QOEr; arc=none smtp.client-ip=209.85.215.181 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="EF75QOEr" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-c648bc907ebso8096610a12.3 for ; Wed, 29 Apr 2026 02:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777454201; x=1778059001; 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=2mR6jaRrQtul9BjU1rNfgdz8/F4zlTqQGy4RoZ421d4=; b=EF75QOEr0tbtuxP6tmqcNKrWcgCpYHsjpTxEiIs918o8gGLoP1nTnvJhtAq+lSGDUK YLlnjRlak0NlDyLN8nZKqvWd2owW7s/DZM+o6Wa34luHxf9UZS58vbV8IpHA0nc45nUm VZqP/UTtSo7JIiKtUpg0bTKVwxuUT03XJs+tSX1KPWGTqpv3KR7vkfZqdKLXggMUeHpx 8dclo4IjKSjr0BSs+fqeiQ6qv3egzxJazvDnsK5tO1nm5hBglUPfG3g02N23UOzgcUJL SDnntI2o+348WRgCmDvLUphKSdBoO7DfIPSKLQHhHwGQ+05EQZ4A91ycDgXdFjVSfpbP m65w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777454201; x=1778059001; 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=2mR6jaRrQtul9BjU1rNfgdz8/F4zlTqQGy4RoZ421d4=; b=HGVFik1/sv/wqL2bBV3loNwF/KtkJVEdoA7Zkd6JlH4QGiwA/QS0UA7vW3w0wckYMc r3lvHAo6CfP3i5VzFCeJCfo8VFmUq2iCMz4nLJfWvzO330dOBBBVB+/99869Huf+/U6w uFpJ/fj60z4vgDAjUGnddtIAIkr/LwjnIwYDm++daF8dmerLTGwlnSuhwyu8jfq4AFlG yFdYdoy+5VHvt15HmVT3iejJe9osmd6yP3NaC11nhdfdX1poLLad62DnouJ/Q+hA4CrY 8FDV700+UG7EleeIj8jhVfwxUuOD1S1nAhD6lwgDT/m59/5S2DJe2v2ljN3OSvtMt0Q+ Xm+g== X-Forwarded-Encrypted: i=1; AFNElJ/Xl4Y541BAqTybIQVRNtNluLgTPR45rgTDwUpW6/0dCXNhGkOXZoJyFBoCq0u7rXtqfhivDp19nY7mB6g=@vger.kernel.org X-Gm-Message-State: AOJu0YyrLfjCVjpVGSCthDjkHh1U82D3sX6+bR/fhb4xHVKYIxiLbSST TUUShlOiZ6F5KJcpGV5JvvTt2qgG6/e8542o87r4OsZZPBDOIWNCVVNR X-Gm-Gg: AeBDievlolTC3AAuqtada/vcaQaACQfxNTOeW6xTxUUXcKIOAKeCecNzRKSTPZz6rQZ Q+up3Lt1EaU9JlX3zzgQ3AUDskGTLjxPFfmNAheKLniahXR3GnhhXaqKudLoHNKq+2ORsvCpPiv mLnZaQxGp0BdrgoV1EJ8lUfI6wPXadLKvena1/hPhQMtxAXdTKFzryKLkNVI2+zAVCaqP34B2Rd /4JEj38t+7ybF8BilOXKEChGcg/ZIt9Ka0vnM/UOqGr2Dx84/UqXRRCbOsJa0g7NeQx+UlC2J7v +9W6Ha2fpJvlg3NOCyuNYwYQMSVSmGjTBMkTwY5byW0X5BLSW8+IZACTqJMAKR1Nn1+djAQLUIt a7powRos6CQD5tLhdrEQla8YBBt/vdxojRiMzigMw7D1qWnbv4bPL3pSSrUrEpV5dSFPWe8g8NY Svqi1vVajCRVYDWEYcB6umKu4BoWtuGnA65m3+FqawXk9ulFCV9WFWm2y4rZc1DdOA9gPv X-Received: by 2002:a05:6a21:e082:b0:39b:d937:8010 with SMTP id adf61e73a8af0-3a39c388dcfmr7710744637.45.1777454201088; Wed, 29 Apr 2026 02:16:41 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-834ed5cd3b8sm1586865b3a.16.2026.04.29.02.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2026 02:16:40 -0700 (PDT) From: phucduc.bui@gmail.com To: Liam Girdwood , Mark Brown Cc: Jaroslav Kysela , Takashi Iwai , Kunihiko Hayashi , Masami Hiramatsu , Kuninori Morimoto , Joris Verhaegen , Miller Liang , linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH 1/2] ASoC: uniphier: aio-compress: Use guard() for spin locks Date: Wed, 29 Apr 2026 16:16:13 +0700 Message-ID: <20260429091614.96667-2-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260429091614.96667-1-phucduc.bui@gmail.com> References: <20260429091614.96667-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: quoted-printable Content-Type: text/plain; charset="utf-8" From: bui duc phuc Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc --- sound/soc/uniphier/aio-compress.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sound/soc/uniphier/aio-compress.c b/sound/soc/uniphier/aio-com= press.c index b18af98a552b..57247a03b5c9 100644 --- a/sound/soc/uniphier/aio-compress.c +++ b/sound/soc/uniphier/aio-compress.c @@ -183,18 +183,16 @@ static int uniphier_aio_compr_prepare(struct snd_soc_= component *component, struct uniphier_aio *aio =3D uniphier_priv(snd_soc_rtd_to_cpu(rtd, 0)); struct uniphier_aio_sub *sub =3D &aio->sub[cstream->direction]; int bytes =3D runtime->fragment_size; - unsigned long flags; int ret; =20 ret =3D aiodma_ch_set_param(sub); if (ret) return ret; =20 - spin_lock_irqsave(&sub->lock, flags); - ret =3D aiodma_rb_set_buffer(sub, sub->compr_addr, - sub->compr_addr + sub->compr_bytes, - bytes); - spin_unlock_irqrestore(&sub->lock, flags); + scoped_guard(spinlock_irqsave, &sub->lock) + ret =3D aiodma_rb_set_buffer(sub, sub->compr_addr, + sub->compr_addr + sub->compr_bytes, + bytes); if (ret) return ret; =20 @@ -223,9 +221,8 @@ static int uniphier_aio_compr_trigger(struct snd_soc_co= mponent *component, struct uniphier_aio_sub *sub =3D &aio->sub[cstream->direction]; struct device *dev =3D &aio->chip->pdev->dev; int bytes =3D runtime->fragment_size, ret =3D 0; - unsigned long flags; =20 - spin_lock_irqsave(&sub->lock, flags); + guard(spinlock_irqsave)(&sub->lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); @@ -242,7 +239,6 @@ static int uniphier_aio_compr_trigger(struct snd_soc_co= mponent *component, dev_warn(dev, "Unknown trigger(%d)\n", cmd); ret =3D -EINVAL; } - spin_unlock_irqrestore(&sub->lock, flags); =20 return ret; } @@ -256,10 +252,9 @@ static int uniphier_aio_compr_pointer(struct snd_soc_c= omponent *component, struct uniphier_aio *aio =3D uniphier_priv(snd_soc_rtd_to_cpu(rtd, 0)); struct uniphier_aio_sub *sub =3D &aio->sub[cstream->direction]; int bytes =3D runtime->fragment_size; - unsigned long flags; u32 pos; =20 - spin_lock_irqsave(&sub->lock, flags); + guard(spinlock_irqsave)(&sub->lock); =20 aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); =20 @@ -273,8 +268,6 @@ static int uniphier_aio_compr_pointer(struct snd_soc_co= mponent *component, } tstamp->byte_offset =3D pos; =20 - spin_unlock_irqrestore(&sub->lock, flags); - return 0; } =20 @@ -332,7 +325,6 @@ static int uniphier_aio_compr_copy(struct snd_soc_compo= nent *component, struct uniphier_aio_sub *sub =3D &aio->sub[cstream->direction]; size_t cnt =3D min_t(size_t, count, aio_rb_space_to_end(sub) / 2); int bytes =3D runtime->fragment_size; - unsigned long flags; size_t s; int ret; =20 @@ -360,7 +352,7 @@ static int uniphier_aio_compr_copy(struct snd_soc_compo= nent *component, if (ret) return -EFAULT; =20 - spin_lock_irqsave(&sub->lock, flags); + guard(spinlock_irqsave)(&sub->lock); =20 sub->threshold =3D 2 * bytes; aiodma_rb_set_threshold(sub, sub->compr_bytes, 2 * bytes); @@ -376,8 +368,6 @@ static int uniphier_aio_compr_copy(struct snd_soc_compo= nent *component, } aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); =20 - spin_unlock_irqrestore(&sub->lock, flags); - return cnt; } =20 --=20 2.43.0 From nobody Tue Jun 16 20:34:56 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 545A43AB299 for ; Wed, 29 Apr 2026 09:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777454209; cv=none; b=PWZ1hvlIG+f0gXbDjY8S2FEo2iPl+4tr33FuOTj++LAKwxXwt8v3Ik9ybjMscyGki//U9W++/MBPyqA2VMv9aSd+XFqGrNfVdnSJqqQKkMdOj9bHSKEUb4dHudrCxwaDnLtGWSKLn9bJJA+m1J1gz55AvAjEY3U4cu/IePh+KhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777454209; c=relaxed/simple; bh=VjVSRWG2abSYsb/wTYHT+3dbM9kBQXjmurL6mO+xRKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lXR1ooux9VxBr1sCI58CQnBOn3PXnZwgUFEZiR6c7MTGtdLz2KjBgR5Rkun9bHdYzMLjJO+m7Ww0NU+nJPCd7wDv44CBI+mNSAUCrDu816crDFDpPk8JxoVInRFbzhkU19N7mq5Sfeb3vE0Kc+Y9ztguLQMLkSzFEjPJe9cKPCQ= 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=lPWBSdbt; arc=none smtp.client-ip=209.85.210.180 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="lPWBSdbt" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82f943870baso5271879b3a.1 for ; Wed, 29 Apr 2026 02:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777454207; x=1778059007; 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=wOQASXH1zi/ymC17DpxSnsJj0Xv7qAzrcrKjqR45UNg=; b=lPWBSdbtgNRXNAF8V2igYjCWgjxe2SpCwh1bgKJzs9q7p1C20j2DSA3sVu/Sn8TwLw YBb6P4TvN77wSNcEQoJ1UQ2MG4n9YDDR+RJDi7RJYc9wqtCisjD8jrc+dtxGaP0D0aPe 9oV6McGLPoPNavRP9TJJFKc1orQLIcjLFoLIVr2GwfTxKacm06KQ8bpKeLIDULgBIqGd gBEgdOf9yzPhV8BRQCuLy6oZBQiJRlPw3CG6U9h+PZ8fU2cvUVlXOIzhoeG0UVrCPNoX BshN1YjzBiSOtEmcuXEp4CrtK24bavdXkK4JfiilFiMMdt2MFMeTACXXnCTSz1Vgrzmy +VPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777454207; x=1778059007; 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=wOQASXH1zi/ymC17DpxSnsJj0Xv7qAzrcrKjqR45UNg=; b=Bbf9V1KLRiMX+8FQIAnomhR/WkOOAZqSwgen+P4qLBdJYU9k6o3qk7sE/DjgJXFnvW XDJJQuACOT0nywwQybGWI5R3ZPod5As/isFyJTjRjb9lK761U8F0FQMi4dKf1DbEa9F/ M7RI7CdmeqllLkrnXZLCH9+gSKySoR/3PvH8TJWU3YprL9WbEYeXFQqW+3MTJm1sHSjp 5ERtHJ2j21DpUcEb65w0QC1Fu6I+i2Rqq6B7jRHYDQtW+UNmJPWkjpUjlojRBVUpLI1F EuDo3aGdbwMfvg68Yhwvau9yN2HyZaJXBlDerElwSxPfwgPppWFWenCzy6wBkqP/8Imt S0OA== X-Forwarded-Encrypted: i=1; AFNElJ+cGV5z+3eZWZuewoI41FPFmW33lMk0Q2KAs2vhUIvvafGJUgY43+3IddDG6Xq5rptRgNDjFHauC9SumnA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxa2hK/Kdd++2oGxwjT4LxfJ9ZQPpnW+gMcqkbA06CreeRMUUDz q3ZlSE0TN5nhGxVVjPeQecvMaMNs1QTMy+9gTulAkg6o693cmqlDaaa0 X-Gm-Gg: AeBDiescNpnFsryUak93+rTeedxPlPGHu2nHaYI1AiHxssvv6iTTgxzKpnoj2kQ+krG sh0nsUg31difmfF2cCi6XktbjIrLHTgtSJjFpPjYGbWVEyJwT3W6DdwyR7eUYu8lRxIhQkXCoSM /nbODbqWkryegmTVRo7yU4pLkt7Aaly0RMh/28K61DNeghwlsfMeTy147/h6UkghuSUeCzRhs5z EdzN3OgaArv1AcSUH/Xrc6e/0JrrE+i6XiMNp06cb/OOgVKWTHylfvRiFTY5v/qCpu16dtzbDaA mM6R+qfxJpqpzaeAkIs+FjR+Jq9RaJC2e1yK6cmD3ew5BhIU0pUcPt7y8KB8ANC9AHO3YfKydmK 6qQIcgMmJHLZ2irNQm/UiQfopKVJ+sdCRa2URhT0WkxxRbeYtlrqstQSxb8exVn0UBYT7B84tvS ASYb9UKpLtitTHtwmIxqO5WXQBz5KbOGOcI/3a+vTSDY4iYuYYkQkEUIOo3AoX7XTjDls4 X-Received: by 2002:a05:6a00:1885:b0:82f:5c3f:94c6 with SMTP id d2e1a72fcca58-834ddc146c3mr6886356b3a.28.1777454207406; Wed, 29 Apr 2026 02:16:47 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-834ed5cd3b8sm1586865b3a.16.2026.04.29.02.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2026 02:16:47 -0700 (PDT) From: phucduc.bui@gmail.com To: Liam Girdwood , Mark Brown Cc: Jaroslav Kysela , Takashi Iwai , Kunihiko Hayashi , Masami Hiramatsu , Kuninori Morimoto , Joris Verhaegen , Miller Liang , linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH 2/2] ASoC: uniphier: aio-dma: Use guard() for spin locks Date: Wed, 29 Apr 2026 16:16:14 +0700 Message-ID: <20260429091614.96667-3-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260429091614.96667-1-phucduc.bui@gmail.com> References: <20260429091614.96667-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: quoted-printable Content-Type: text/plain; charset="utf-8" From: bui duc phuc Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc --- sound/soc/uniphier/aio-dma.c | 52 ++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/sound/soc/uniphier/aio-dma.c b/sound/soc/uniphier/aio-dma.c index c1ca55997103..c01eae55d4fc 100644 --- a/sound/soc/uniphier/aio-dma.c +++ b/sound/soc/uniphier/aio-dma.c @@ -32,15 +32,15 @@ static void aiodma_pcm_irq(struct uniphier_aio_sub *sub) runtime->channels * samples_to_bytes(runtime, 1); int ret; =20 - spin_lock(&sub->lock); - ret =3D aiodma_rb_set_threshold(sub, runtime->dma_bytes, - sub->threshold + bytes); - if (!ret) - sub->threshold +=3D bytes; - - aiodma_rb_sync(sub, runtime->dma_addr, runtime->dma_bytes, bytes); - aiodma_rb_clear_irq(sub); - spin_unlock(&sub->lock); + scoped_guard(spinlock, &sub->lock) { + ret =3D aiodma_rb_set_threshold(sub, runtime->dma_bytes, + sub->threshold + bytes); + if (!ret) + sub->threshold +=3D bytes; + + aiodma_rb_sync(sub, runtime->dma_addr, runtime->dma_bytes, bytes); + aiodma_rb_clear_irq(sub); + } =20 snd_pcm_period_elapsed(sub->substream); } @@ -51,15 +51,15 @@ static void aiodma_compr_irq(struct uniphier_aio_sub *s= ub) int bytes =3D runtime->fragment_size; int ret; =20 - spin_lock(&sub->lock); - ret =3D aiodma_rb_set_threshold(sub, sub->compr_bytes, - sub->threshold + bytes); - if (!ret) - sub->threshold +=3D bytes; + scoped_guard(spinlock, &sub->lock) { + ret =3D aiodma_rb_set_threshold(sub, sub->compr_bytes, + sub->threshold + bytes); + if (!ret) + sub->threshold +=3D bytes; =20 - aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); - aiodma_rb_clear_irq(sub); - spin_unlock(&sub->lock); + aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); + aiodma_rb_clear_irq(sub); + } =20 snd_compr_fragment_elapsed(sub->cstream); } @@ -113,18 +113,16 @@ static int uniphier_aiodma_prepare(struct snd_soc_com= ponent *component, struct uniphier_aio_sub *sub =3D &aio->sub[substream->stream]; int bytes =3D runtime->period_size * runtime->channels * samples_to_bytes(runtime, 1); - unsigned long flags; int ret; =20 ret =3D aiodma_ch_set_param(sub); if (ret) return ret; =20 - spin_lock_irqsave(&sub->lock, flags); - ret =3D aiodma_rb_set_buffer(sub, runtime->dma_addr, - runtime->dma_addr + runtime->dma_bytes, - bytes); - spin_unlock_irqrestore(&sub->lock, flags); + scoped_guard(spinlock_irqsave, &sub->lock) + ret =3D aiodma_rb_set_buffer(sub, runtime->dma_addr, + runtime->dma_addr + runtime->dma_bytes, + bytes); if (ret) return ret; =20 @@ -141,9 +139,8 @@ static int uniphier_aiodma_trigger(struct snd_soc_compo= nent *component, struct device *dev =3D &aio->chip->pdev->dev; int bytes =3D runtime->period_size * runtime->channels * samples_to_bytes(runtime, 1); - unsigned long flags; =20 - spin_lock_irqsave(&sub->lock, flags); + guard(spinlock_irqsave)(&sub->lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: aiodma_rb_sync(sub, runtime->dma_addr, runtime->dma_bytes, @@ -161,7 +158,6 @@ static int uniphier_aiodma_trigger(struct snd_soc_compo= nent *component, dev_warn(dev, "Unknown trigger(%d) ignored\n", cmd); break; } - spin_unlock_irqrestore(&sub->lock, flags); =20 return 0; } @@ -176,17 +172,15 @@ static snd_pcm_uframes_t uniphier_aiodma_pointer( struct uniphier_aio_sub *sub =3D &aio->sub[substream->stream]; int bytes =3D runtime->period_size * runtime->channels * samples_to_bytes(runtime, 1); - unsigned long flags; snd_pcm_uframes_t pos; =20 - spin_lock_irqsave(&sub->lock, flags); + guard(spinlock_irqsave)(&sub->lock); aiodma_rb_sync(sub, runtime->dma_addr, runtime->dma_bytes, bytes); =20 if (sub->swm->dir =3D=3D PORT_DIR_OUTPUT) pos =3D bytes_to_frames(runtime, sub->rd_offs); else pos =3D bytes_to_frames(runtime, sub->wr_offs); - spin_unlock_irqrestore(&sub->lock, flags); =20 return pos; } --=20 2.43.0