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/tas2781: Clean up runtime PM with guard()

Use guard(pm_runtime_active_auto) for replacing the manual calls of
pm_runtime_get_sync() and pm_runtime_put_autosuspend().

Along with this, we can use guard() for the tas_priv->codec_lock mutex
in tasdev_fw_ready(), too (that aligns both i2c and spi codes).

Merely code cleanups and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20251216141154.172218-4-tiwai@suse.de

+5 -12
+3 -7
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
··· 500 500 struct hda_codec *codec = tas_priv->codec; 501 501 int ret; 502 502 503 - pm_runtime_get_sync(tas_priv->dev); 504 - mutex_lock(&tas_priv->codec_lock); 503 + guard(pm_runtime_active_auto)(tas_priv->dev); 504 + guard(mutex)(&tas_priv->codec_lock); 505 505 506 506 ret = tasdevice_rca_parser(tas_priv, fmw); 507 507 if (ret) ··· 537 537 } 538 538 539 539 out: 540 - mutex_unlock(&tas_hda->priv->codec_lock); 541 540 release_firmware(fmw); 542 - pm_runtime_put_autosuspend(tas_hda->dev); 543 541 } 544 542 545 543 static int tas2781_hda_bind(struct device *dev, struct device *master, ··· 569 571 break; 570 572 } 571 573 572 - pm_runtime_get_sync(dev); 574 + guard(pm_runtime_active_auto)(dev); 573 575 574 576 comp->dev = dev; 575 577 ··· 578 580 ret = tascodec_init(tas_hda->priv, codec, THIS_MODULE, tasdev_fw_ready); 579 581 if (!ret) 580 582 comp->playback_hook = tas2781_hda_playback_hook; 581 - 582 - pm_runtime_put_autosuspend(dev); 583 583 584 584 return ret; 585 585 }
+2 -5
sound/hda/codecs/side-codecs/tas2781_hda_spi.c
··· 636 636 struct hda_codec *codec = tas_priv->codec; 637 637 int ret, val; 638 638 639 - pm_runtime_get_sync(tas_priv->dev); 639 + guard(pm_runtime_active_auto)(tas_priv->dev); 640 640 guard(mutex)(&tas_priv->codec_lock); 641 641 642 642 ret = tasdevice_rca_parser(tas_priv, fmw); ··· 699 699 tas2781_save_calibration(tas_hda); 700 700 out: 701 701 release_firmware(fmw); 702 - pm_runtime_put_autosuspend(tas_hda->priv->dev); 703 702 } 704 703 705 704 static int tas2781_hda_bind(struct device *dev, struct device *master, ··· 719 720 720 721 codec = parent->codec; 721 722 722 - pm_runtime_get_sync(dev); 723 + guard(pm_runtime_active_auto)(dev); 723 724 724 725 comp->dev = dev; 725 726 ··· 729 730 tasdev_fw_ready); 730 731 if (!ret) 731 732 comp->playback_hook = tas2781_hda_playback_hook; 732 - 733 - pm_runtime_put_autosuspend(dev); 734 733 735 734 return ret; 736 735 }