[PATCH 00/13] PM: runtime: Convert pm_runtime_put_autosuspend() and friends to a void function
Similar to this effort: Subject: [PATCH v1 00/23] PM: runtime: Convert pm_runtime_put() to a void function https://lore.kernel.org/all/6245770.lOV4Wx5bFT@rafael.j.wysocki/ i.e., commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return type to void") and friends. As with pm_runtime_put(), there is very little value in return-code checking for any of the other async __pm_runtime_suspend() and __pm_runtime_idle() APIs: pm_runtime_put_autosuspend() pm_request_idle() pm_request_autosuspend() Checking the return code is more likely to produce a race condition (fighting with user space writing "on" to the "control" attribute) than to tell a consumer useful info. Nobody outside KUnit tests checks pm_request_idle() or pm_request_autosuspend() return codes, but there are a number of pm_runtime_put_autosuspend() callers that check its return code. Thus, this series largely deals with pm_runtime_put_autosuspend(). Patches 1-11 are independent of each other, and similarly to the last series, I expect the respective maintainers can pick them up. We can apply patch 12 later. Patch 13 is also independent, but included in this topic for completeness. It can be applied any time. This touches a lot of trees/maintainers, so I tried to keep CC's only for the relevant patch(es), plus the cover letter. I hope that's not too noisy. - Brian Brian Norris (13): hwrng: cctrng: Discard pm_runtime_put_autosuspend() return value drm: Discard pm_runtime_put_autosuspend() return values iio: Discard pm_runtime_put_autosuspend() return values media: venus: Discard pm_runtime_put_autosuspend() return values pinctrl: qcom: lpass-lpi: Discard pm_runtime_put_autosuspend() return values spi: ti-qspi: Discard pm_runtime_put_autosuspend() return value greybus: Discard pm_runtime_put_autosuspend() return value ALSA: hda: Discard pm_runtime_put_autosuspend() return value ASoC: codecs: lpass: Discard pm_runtime_put_autosuspend() return values ASoC: intel: atom: Discard pm_runtime_put_autosuspend() return value ASoC: SOF: Discard pm_runtime_put_autosuspend() return values PM: runtime: Drop pm_runtime_put_autosuspend() return code PM: runtime: Drop pm_request_{idle,autosuspend}() return codes drivers/base/power/runtime-test.c | 8 --- drivers/char/hw_random/cctrng.c | 6 +- drivers/gpu/drm/panel/panel-simple.c | 8 +-- drivers/gpu/drm/tidss/tidss_drv.c | 7 +-- drivers/gpu/drm/v3d/v3d_drv.h | 4 +- drivers/iio/accel/bmc150-accel-core.c | 14 ++--- drivers/iio/accel/fxls8962af-core.c | 11 +--- drivers/iio/accel/kxcjk-1013.c | 15 ++--- drivers/iio/accel/mma8452.c | 15 +++-- drivers/iio/accel/mma9551_core.c | 15 +++-- drivers/iio/adc/rcar-gyroadc.c | 4 +- drivers/iio/adc/ti-ads1015.c | 8 +-- drivers/iio/chemical/atlas-sensor.c | 4 +- .../common/hid-sensors/hid-sensor-trigger.c | 14 ++--- drivers/iio/gyro/bmg160_core.c | 17 +++-- drivers/iio/gyro/fxas21002c_core.c | 12 ++-- drivers/iio/imu/kmx61.c | 17 +++-- drivers/iio/light/apds9960.c | 2 +- drivers/iio/light/isl29028.c | 15 +---- drivers/iio/light/pa12203001.c | 3 +- drivers/iio/light/rpr0521.c | 15 +++-- drivers/iio/light/tsl2583.c | 27 ++------ drivers/iio/light/us5182d.c | 3 +- drivers/media/platform/qcom/venus/vdec.c | 10 ++- drivers/media/platform/qcom/venus/venc.c | 10 ++- drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 16 +++-- drivers/spi/spi-ti-qspi.c | 6 +- drivers/staging/greybus/power_supply.c | 8 +-- include/linux/greybus/bundle.h | 12 +--- include/linux/pm_runtime.h | 63 +++---------------- include/sound/hdaudio.h | 8 +-- sound/hda/core/device.c | 13 ++-- sound/soc/codecs/lpass-rx-macro.c | 4 +- sound/soc/codecs/lpass-tx-macro.c | 4 +- sound/soc/codecs/lpass-va-macro.c | 17 ++--- sound/soc/codecs/lpass-wsa-macro.c | 8 +-- sound/soc/intel/atom/sst/sst.h | 2 +- sound/soc/intel/atom/sst/sst_drv_interface.c | 4 +- sound/soc/intel/atom/sst/sst_pvt.c | 9 +-- sound/soc/sof/control.c | 6 +- sound/soc/sof/sof-client-ipc-flood-test.c | 5 +- .../soc/sof/sof-client-ipc-kernel-injector.c | 4 +- sound/soc/sof/sof-client-ipc-msg-injector.c | 6 +- sound/soc/sof/sof-client-probes.c | 18 ++---- 44 files changed, 152 insertions(+), 325 deletions(-) -- 2.56.0.360.g66cac248cb-goog
Printing error messages on pm_runtime_put_autosuspend() returning negative values is not particularly useful. Returning an error code from pm_runtime_put_autosuspend() merely means that it has not queued up a timer or work item to check whether or not the device can be suspended and there are many perfectly valid situations in which that can happen, like after writing "on" to the device's runtime PM "control" attribute in sysfs for one example. Accordingly, update the SOF driver to simply discard the return value of pm_runtime_put_autosuspend(). This will facilitate a planned change of the pm_runtime_put_autosuspend() return type to void in the future, similar to commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return type to void"). Signed-off-by: Brian Norris <briannorris@chromium.org> --- This patch is independent of the rest of the series, except for the end (changing the return type). I expect it can be applied by individual maintainers, and we pick up the end once the dust is settled. sound/soc/sof/control.c | 6 ++---- sound/soc/sof/sof-client-ipc-flood-test.c | 5 +---- sound/soc/sof/sof-client-ipc-kernel-injector.c | 4 +--- sound/soc/sof/sof-client-ipc-msg-injector.c | 6 ++---- sound/soc/sof/sof-client-probes.c | 18 ++++++------------ 5 files changed, 12 insertions(+), 27 deletions(-) diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index 74d997a4f620..8718c293c5b9 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -185,7 +185,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ struct snd_soc_component *scomp = scontrol->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); - int ret, err; + int ret; /* ignore the ext_volatile_get call if the callbacks are not provided */ if (!tplg_ops || !tplg_ops->control || @@ -205,9 +205,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ binary_data, size); - err = pm_runtime_put_autosuspend(scomp->dev); - if (err < 0) - dev_err_ratelimited(scomp->dev, "%s: failed to idle %d\n", __func__, err); + pm_runtime_put_autosuspend(scomp->dev); return ret; } diff --git a/sound/soc/sof/sof-client-ipc-flood-test.c b/sound/soc/sof/sof-client-ipc-flood-test.c index 2396cc35489a..a86dd5630790 100644 --- a/sound/soc/sof/sof-client-ipc-flood-test.c +++ b/sound/soc/sof/sof-client-ipc-flood-test.c @@ -157,7 +157,6 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf unsigned long ipc_duration_ms = 0; bool flood_duration_test = false; unsigned long ipc_count = 0; - int err; char *string; int ret; @@ -223,9 +222,7 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf ret = sof_debug_ipc_flood_test(cdev, flood_duration_test, ipc_duration_ms, ipc_count); - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", err); + pm_runtime_put_autosuspend(dev); /* return count if test is successful */ if (ret >= 0) diff --git a/sound/soc/sof/sof-client-ipc-kernel-injector.c b/sound/soc/sof/sof-client-ipc-kernel-injector.c index 02d0d97ad1a0..751d6a0bef79 100644 --- a/sound/soc/sof/sof-client-ipc-kernel-injector.c +++ b/sound/soc/sof/sof-client-ipc-kernel-injector.c @@ -66,9 +66,7 @@ static ssize_t sof_kernel_msg_inject_dfs_write(struct file *file, const char __u if (!ret) sof_client_ipc_rx_message(cdev, hdr, priv->kernel_buffer); - ret = pm_runtime_put_autosuspend(dev); - if (ret < 0) - dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", ret); + pm_runtime_put_autosuspend(dev); return count; }; diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c index 932ab459c079..2eaec52ab439 100644 --- a/sound/soc/sof/sof-client-ipc-msg-injector.c +++ b/sound/soc/sof/sof-client-ipc-msg-injector.c @@ -122,7 +122,7 @@ static int sof_msg_inject_send_message(struct sof_client_dev *cdev) { struct sof_msg_inject_priv *priv = cdev->data; struct device *dev = &cdev->auxdev.dev; - int ret, err; + int ret; ret = pm_runtime_resume_and_get(dev); if (ret < 0 && ret != -EACCES) { @@ -140,9 +140,7 @@ static int sof_msg_inject_send_message(struct sof_client_dev *cdev) dev_err(dev, "IPC message send failed: %d\n", ret); } - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", err); + pm_runtime_put_autosuspend(dev); return ret; } diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c index 124f55508159..32e31d6aa9bb 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -211,7 +211,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, int remaining, offset; size_t num_desc; char *buf; - int i, ret, err; + int i, ret; if (priv->extractor_stream_tag == SOF_PROBES_INVALID_NODE_ID) { dev_warn(dev, "no extractor stream running\n"); @@ -258,9 +258,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, kfree(desc); pm_error: - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err); + pm_runtime_put_autosuspend(dev); exit: kfree(buf); @@ -294,7 +292,7 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from, struct sof_probe_point_desc *desc; u32 num_elems, *array; size_t bytes; - int ret, err; + int ret; if (priv->extractor_stream_tag == SOF_PROBES_INVALID_NODE_ID) { dev_warn(dev, "no extractor stream running\n"); @@ -327,9 +325,7 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from, ret = count; } - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", err); + pm_runtime_put_autosuspend(dev); exit: kfree(array); return ret; @@ -360,7 +356,7 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from, struct sof_probes_priv *priv = cdev->data; const struct sof_probes_ipc_ops *ipc = priv->ipc_ops; struct device *dev = &cdev->auxdev.dev; - int ret, err; + int ret; u32 *array; if (priv->extractor_stream_tag == SOF_PROBES_INVALID_NODE_ID) { @@ -385,9 +381,7 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from, ret = count; } - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", err); + pm_runtime_put_autosuspend(dev); exit: kfree(array); return ret; -- 2.56.0.360.g66cac248cb-goog
On Tue, 06 Oct 2026 16:13:28 -0700, Brian Norris wrote:
Similar to this effort:
Subject: [PATCH v1 00/23] PM: runtime: Convert pm_runtime_put() to a void function https://lore.kernel.org/all/6245770.lOV4Wx5bFT@rafael.j.wysocki/
i.e., commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return type to void") and friends.
[...]
Applied, thanks! [05/13] pinctrl: qcom: lpass-lpi: Discard pm_runtime_put_autosuspend() return values https://git.kernel.org/brgl/c/9bcd1725b0cc7954525e3d0d02fecaec7c7aab33 Best regards, -- Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
participants (2)
-
Bartosz Golaszewski -
Brian Norris