Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+9 -14
+9 -14
sound/hda/codecs/side-codecs/cs35l41_hda.c
··· 1255 1255 { 1256 1256 struct cs35l41_hda *cs35l41 = container_of(work, struct cs35l41_hda, fw_load_work); 1257 1257 1258 - pm_runtime_get_sync(cs35l41->dev); 1258 + guard(pm_runtime_active_auto)(cs35l41->dev); 1259 1259 1260 - scoped_guard(mutex, &cs35l41->fw_mutex) { 1261 - /* Recheck if playback is ongoing, mutex will block playback during firmware loading */ 1262 - if (cs35l41->playback_started) 1263 - dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback. Retrying...\n"); 1264 - else 1265 - cs35l41_load_firmware(cs35l41, cs35l41->request_fw_load); 1260 + guard(mutex)(&cs35l41->fw_mutex); 1261 + /* Recheck if playback is ongoing, mutex will block playback during firmware loading */ 1262 + if (cs35l41->playback_started) 1263 + dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback. Retrying...\n"); 1264 + else 1265 + cs35l41_load_firmware(cs35l41, cs35l41->request_fw_load); 1266 1266 1267 - cs35l41->fw_request_ongoing = false; 1268 - } 1269 - 1270 - pm_runtime_put_autosuspend(cs35l41->dev); 1267 + cs35l41->fw_request_ongoing = false; 1271 1268 } 1272 1269 1273 1270 static int cs35l41_fw_load_ctl_put(struct snd_kcontrol *kcontrol, ··· 1452 1455 if (comp->dev) 1453 1456 return -EBUSY; 1454 1457 1455 - pm_runtime_get_sync(dev); 1458 + guard(pm_runtime_active_auto)(dev); 1456 1459 1457 1460 mutex_lock(&cs35l41->fw_mutex); 1458 1461 ··· 1495 1498 if (!device_link_add(&cs35l41->codec->core.dev, cs35l41->dev, DL_FLAG_STATELESS)) 1496 1499 dev_warn(dev, "Unable to create device link\n"); 1497 1500 unlock_system_sleep(sleep_flags); 1498 - 1499 - pm_runtime_put_autosuspend(dev); 1500 1501 1501 1502 dev_info(cs35l41->dev, 1502 1503 "CS35L41 Bound - SSID: %s, BST: %d, VSPK: %d, CH: %c, FW EN: %d, SPKID: %d\n",