Re: [PATCH v2 2/4] ASoC: Intel: avs: Use scoped_guard() for scoped locking
From: Mark Brown
Date: Thu Jun 18 2026 - 13:15:28 EST
On Thu, Jun 18, 2026 at 06:06:46PM +0700, phucduc.bui@xxxxxxxxx wrote:
> Clean up the code using scoped_guard() for mutex & spin locks.
> Merely code refactoring, and no behavior change.
> @@ -338,21 +338,18 @@ static int avs_ipc_wait_busy_completion(struct avs_ipc *ipc, int timeout)
> }
>
> /* Ongoing notification's bottom-half may cause early wakeup */
> - spin_lock(&ipc->rx_lock);
> - if (!ipc->rx_completed) {
> - if (repeats_left) {
> + scoped_guard(spinlock, &ipc->rx_lock) {
> + if (!ipc->rx_completed) {
> + if (!repeats_left)
> + return -ETIMEDOUT;
> +
> /* Reply delayed due to notification. */
> repeats_left--;
> reinit_completion(&ipc->busy_completion);
> - spin_unlock(&ipc->rx_lock);
> goto again;
> }
> -
> - spin_unlock(&ipc->rx_lock);
> - return -ETIMEDOUT;
> }
This has a goto from a scoped_guard().
Attachment:
signature.asc
Description: PGP signature