[PATCH v4 1/1] iio: dac: Remove redundant pm_runtime_mark_last_busy() calls

Andy Shevchenko andy.shevchenko at gmail.com
Tue Aug 26 01:05:35 PDT 2025


On Mon, Aug 25, 2025 at 11:53 PM Sakari Ailus
<sakari.ailus at linux.intel.com> wrote:
>
> pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(),
> pm_runtime_autosuspend() and pm_request_autosuspend() now include a call
> to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to
> pm_runtime_mark_last_busy().
>
> Also clean up error handling in stm32_dac_set_enable_state().

TL;DR: I think this change makes it harder to follow (due to complex
conditional).

...

>         ret = regmap_update_bits(dac->common->regmap, STM32_DAC_CR, msk, en);
>         mutex_unlock(&dac->lock);
> -       if (ret < 0) {
> +       if (ret) {
>                 dev_err(&indio_dev->dev, "%s failed\n", str_enable_disable(en));
> -               goto err_put_pm;
> +               goto err_pm_put;

This is one time use for the label and we know that ret is set here.

Just

  if (enable)
    pm_runtime_put_autosuspend(dev);
  return ret;

should work.

>         }

...

> -       if (!enable) {
> -               pm_runtime_mark_last_busy(dev);
> -               pm_runtime_put_autosuspend(dev);
> -       }
> -
> -       return 0;
> -
> -err_put_pm:
> -       if (enable) {
> -               pm_runtime_mark_last_busy(dev);
> +err_pm_put:
> +       if (!enable || (enable && ret))
>                 pm_runtime_put_autosuspend(dev);
> -       }
>
>         return ret;


And here is as simple as

if (!enable)
  pm_runtime_put_autosuspend(dev);

return 0;

and remove the unneeded label altogether with the error path.

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list