]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: x86: Clean up locks and runtime PM with guard() and co
authorTakashi Iwai <tiwai@suse.de>
Tue, 16 Dec 2025 14:11:50 +0000 (15:11 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 Dec 2025 09:51:58 +0000 (10:51 +0100)
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
sound/x86/intel_hdmi_audio.c

index 8e2a007311d361d44072747a0e844d5c9dd5a0bb..f5807fc73c54f40e1d03cb8ef6b648f9e06c09e3 100644 (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);
 }
 
 /*