aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-05-15 20:08:26 +0900
committerMark Brown <broonie@kernel.org>2023-05-15 20:08:26 +0900
commitaa70f36fe6c345cc8679e034b0dd4213f1f9c7d9 (patch)
tree7385f0cbf3be008e850fb3bdd78418eb70d6cfdd
parentdc60b67d259ea63196dcd0400dd43ba062e2e097 (diff)
parentbc424273c74c1565c459c8f2a6ed95caee368d0a (diff)
downloadlinux-aa70f36fe6c345cc8679e034b0dd4213f1f9c7d9.tar.gz
ASoC: SOF: Various runtime pm fixes, improvements
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>: Three patch to correct error path PM runtime handling in few places. Regards, Peter --- Pierre-Louis Bossart (3): ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions ASoC: SOF: pcm: fix pm_runtime imbalance in error handling ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling sound/soc/sof/debug.c | 4 ++-- sound/soc/sof/pcm.c | 11 ++++++----- sound/soc/sof/sof-client-probes.c | 14 ++++++++------ 3 files changed, 16 insertions(+), 13 deletions(-) -- 2.40.1
-rw-r--r--sound/soc/sof/debug.c4
-rw-r--r--sound/soc/sof/pcm.c11
-rw-r--r--sound/soc/sof/sof-client-probes.c14
3 files changed, 16 insertions, 13 deletions
diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index b42b5982cbbca..d547318e0d32f 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -438,8 +438,8 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev, const char *msg)
/* should we prevent DSP entering D3 ? */
if (!sdev->ipc_dump_printed)
dev_info(sdev->dev,
- "preventing DSP entering D3 state to preserve context\n");
- pm_runtime_get_noresume(sdev->dev);
+ "Attempting to prevent DSP from entering D3 state to preserve context\n");
+ pm_runtime_get_if_in_use(sdev->dev);
}
/* dump vital information to the logs */
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 567db32173a88..d0ab6f390734e 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -643,16 +643,17 @@ static int sof_pcm_probe(struct snd_soc_component *component)
"%s/%s",
plat_data->tplg_filename_prefix,
plat_data->tplg_filename);
- if (!tplg_filename)
- return -ENOMEM;
+ if (!tplg_filename) {
+ ret = -ENOMEM;
+ goto pm_error;
+ }
ret = snd_sof_load_topology(component, tplg_filename);
- if (ret < 0) {
+ if (ret < 0)
dev_err(component->dev, "error: failed to load DSP topology %d\n",
ret);
- return ret;
- }
+pm_error:
pm_runtime_mark_last_busy(component->dev);
pm_runtime_put_autosuspend(component->dev);
diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
index fff126808bc04..8d9e9d5f40e45 100644
--- a/sound/soc/sof/sof-client-probes.c
+++ b/sound/soc/sof/sof-client-probes.c
@@ -218,12 +218,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
ret = ipc->points_info(cdev, &desc, &num_desc);
if (ret < 0)
- goto exit;
-
- pm_runtime_mark_last_busy(dev);
- err = pm_runtime_put_autosuspend(dev);
- if (err < 0)
- dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);
+ goto pm_error;
for (i = 0; i < num_desc; i++) {
offset = strlen(buf);
@@ -241,6 +236,13 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf));
kfree(desc);
+
+pm_error:
+ pm_runtime_mark_last_busy(dev);
+ err = pm_runtime_put_autosuspend(dev);
+ if (err < 0)
+ dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);
+
exit:
kfree(buf);
return ret;