From f8c537ff0492eb27c160592702a96ea7cb19b493 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 16 Dec 2025 15:11:50 +0100 Subject: [PATCH] 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 Link: https://patch.msgid.link/20251216141154.172218-6-tiwai@suse.de --- sound/x86/intel_hdmi_audio.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 8e2a007311d36..f5807fc73c54f 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -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); } /* -- 2.47.3