ALSA: x86: Clean up locks and runtime PM with guard() and co

Use PM_RUNTIME_ACQUIRE_*() and guard() for replacing the manual calls
of runtime PM and mutex lock in had_audio_wq().

Merely code cleanups and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20251216141154.172218-6-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2025-12-16 15:11:50 +01:00
parent be9dd97060
commit f8c537ff04

View File

@ -1517,13 +1517,12 @@ static void had_audio_wq(struct work_struct *work)
container_of(work, struct snd_intelhad, hdmi_audio_wq);
struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data;
struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port];
int ret;
ret = pm_runtime_resume_and_get(ctx->dev);
if (ret < 0)
PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(ctx->dev, pm);
if (PM_RUNTIME_ACQUIRE_ERR(&pm))
return;
mutex_lock(&ctx->mutex);
guard(mutex)(&ctx->mutex);
if (ppdata->pipe < 0) {
dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n",
__func__, ctx->port);
@ -1564,9 +1563,6 @@ static void had_audio_wq(struct work_struct *work)
/* Restart the stream if necessary */
had_process_mode_change(ctx);
}
mutex_unlock(&ctx->mutex);
pm_runtime_put_autosuspend(ctx->dev);
}
/*