diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-12-16 17:11:48 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-12-23 12:51:58 +0300 |
| commit | 4a91da4afc7db944d17234e4ecc164df8252b23b (patch) | |
| tree | 81db929ebbf4b3eac4bb9d2526c7038e2f91609f | |
| parent | 0ff22680e51f4c636f9fa98a1357f21310cb2a9a (diff) | |
| download | linux-4a91da4afc7db944d17234e4ecc164df8252b23b.tar.xz | |
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
| -rw-r--r-- | sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 10 | ||||
| -rw-r--r-- | sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 7 |
2 files changed, 5 insertions, 12 deletions
diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c index c8619995b1d7..c74f83d4ec7f 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c @@ -500,8 +500,8 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context) struct hda_codec *codec = tas_priv->codec; int ret; - pm_runtime_get_sync(tas_priv->dev); - mutex_lock(&tas_priv->codec_lock); + guard(pm_runtime_active_auto)(tas_priv->dev); + guard(mutex)(&tas_priv->codec_lock); ret = tasdevice_rca_parser(tas_priv, fmw); if (ret) @@ -537,9 +537,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context) } out: - mutex_unlock(&tas_hda->priv->codec_lock); release_firmware(fmw); - pm_runtime_put_autosuspend(tas_hda->dev); } static int tas2781_hda_bind(struct device *dev, struct device *master, @@ -571,7 +569,7 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, break; } - pm_runtime_get_sync(dev); + guard(pm_runtime_active_auto)(dev); comp->dev = dev; @@ -581,8 +579,6 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, if (!ret) comp->playback_hook = tas2781_hda_playback_hook; - pm_runtime_put_autosuspend(dev); - return ret; } diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c index b9a55672bf15..f8412c5df919 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c @@ -636,7 +636,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context) struct hda_codec *codec = tas_priv->codec; int ret, val; - pm_runtime_get_sync(tas_priv->dev); + guard(pm_runtime_active_auto)(tas_priv->dev); guard(mutex)(&tas_priv->codec_lock); ret = tasdevice_rca_parser(tas_priv, fmw); @@ -699,7 +699,6 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context) tas2781_save_calibration(tas_hda); out: release_firmware(fmw); - pm_runtime_put_autosuspend(tas_hda->priv->dev); } static int tas2781_hda_bind(struct device *dev, struct device *master, @@ -720,7 +719,7 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, codec = parent->codec; - pm_runtime_get_sync(dev); + guard(pm_runtime_active_auto)(dev); comp->dev = dev; @@ -731,8 +730,6 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, if (!ret) comp->playback_hook = tas2781_hda_playback_hook; - pm_runtime_put_autosuspend(dev); - return ret; } |
