summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-12-16 17:11:46 +0300
committerTakashi Iwai <tiwai@suse.de>2025-12-23 12:51:57 +0300
commite38bdd30708b8bad577b07de5fdb2baa1cae8527 (patch)
tree1b38a4421e7e226bcf0049ee05ead31d6b04f271
parent5de5db35350d9c4def1de2ae273e224a4eee5ed1 (diff)
downloadlinux-e38bdd30708b8bad577b07de5fdb2baa1cae8527.tar.xz
ALSA: hda/cs35l41: Clean up runtime PM with guard()
Replace the manual pm_runtime_get_sync() and pm_runtime_put_autosuspend() calls with the new guard(pm_runtime_active_auto) for code simplification. Along with this change, the former scoped_guard(mutex) can be set back to the plain guard(mutex), and the indent level is taken back, too. Merely code cleanups, and no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20251216141154.172218-2-tiwai@suse.de
-rw-r--r--sound/hda/codecs/side-codecs/cs35l41_hda.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c
index 21e00055c0c4..b64890006bb7 100644
--- a/sound/hda/codecs/side-codecs/cs35l41_hda.c
+++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c
@@ -1255,19 +1255,16 @@ static void cs35l41_fw_load_work(struct work_struct *work)
{
struct cs35l41_hda *cs35l41 = container_of(work, struct cs35l41_hda, fw_load_work);
- pm_runtime_get_sync(cs35l41->dev);
-
- scoped_guard(mutex, &cs35l41->fw_mutex) {
- /* Recheck if playback is ongoing, mutex will block playback during firmware loading */
- if (cs35l41->playback_started)
- dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback. Retrying...\n");
- else
- cs35l41_load_firmware(cs35l41, cs35l41->request_fw_load);
+ guard(pm_runtime_active_auto)(cs35l41->dev);
- cs35l41->fw_request_ongoing = false;
- }
+ guard(mutex)(&cs35l41->fw_mutex);
+ /* Recheck if playback is ongoing, mutex will block playback during firmware loading */
+ if (cs35l41->playback_started)
+ dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback. Retrying...\n");
+ else
+ cs35l41_load_firmware(cs35l41, cs35l41->request_fw_load);
- pm_runtime_put_autosuspend(cs35l41->dev);
+ cs35l41->fw_request_ongoing = false;
}
static int cs35l41_fw_load_ctl_put(struct snd_kcontrol *kcontrol,
@@ -1455,7 +1452,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
if (comp->dev)
return -EBUSY;
- pm_runtime_get_sync(dev);
+ guard(pm_runtime_active_auto)(dev);
mutex_lock(&cs35l41->fw_mutex);
@@ -1499,8 +1496,6 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
dev_warn(dev, "Unable to create device link\n");
unlock_system_sleep(sleep_flags);
- pm_runtime_put_autosuspend(dev);
-
dev_info(cs35l41->dev,
"CS35L41 Bound - SSID: %s, BST: %d, VSPK: %d, CH: %c, FW EN: %d, SPKID: %d\n",
cs35l41->acpi_subsystem_id, cs35l41->hw_cfg.bst_type,