Re: [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
From: Andy Shevchenko
Date: Tue Jun 16 2026 - 06:24:09 EST
On Tue, Jun 16, 2026 at 03:01:26PM +0530, Yash Suthar wrote:
> Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and
> propagate error.
...
> static int bmp280_read_raw(struct iio_dev *indio_dev,
> {
> struct bmp280_data *data = iio_priv(indio_dev);
> int ret;
No, here must be a blank line. And so on...
> + ret = pm_runtime_resume_and_get(data->dev);
> + if (ret < 0)
> + return ret;
>
> - pm_runtime_get_sync(data->dev);
> ret = bmp280_read_raw_impl(indio_dev, chan, val, val2, mask);
> pm_runtime_put_autosuspend(data->dev);
...
> static int bmp280_buffer_preenable(struct iio_dev *indio_dev)
> {
> struct bmp280_data *data = iio_priv(indio_dev);
> + int ret;
>
> - pm_runtime_get_sync(data->dev);
> - data->chip_info->set_mode(data, BMP280_NORMAL);
> + ret = pm_runtime_resume_and_get(data->dev);
> + if (ret < 0)
> + return ret;
> +
> + ret = data->chip_info->set_mode(data, BMP280_NORMAL);
> + if (ret) {
> + pm_runtime_put_autosuspend(data->dev);
> + return ret;
> + }
>
> return 0;
Also possible
ret = data->chip_info->set_mode(data, BMP280_NORMAL);
if (ret)
pm_runtime_put_autosuspend(data->dev);
return ret;
> }
...
> static void bmp280_pm_disable(void *data)
> {
> struct device *dev = data;
>
> - pm_runtime_get_sync(dev);
> - pm_runtime_put_noidle(dev);
> + if (pm_runtime_resume_and_get(dev) >= 0)
Why this change?
> + pm_runtime_put_noidle(dev);
> pm_runtime_disable(dev);
> }
--
With Best Regards,
Andy Shevchenko