iio: pressure: bmp280: return on runtime PM resume failure

Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and
propagate error.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Yash Suthar 2026-06-16 17:16:21 +05:30 committed by Jonathan Cameron
parent 2f8225b91e
commit 7758cd4922

View File

@ -750,7 +750,10 @@ static int bmp280_read_raw(struct iio_dev *indio_dev,
struct bmp280_data *data = iio_priv(indio_dev);
int ret;
pm_runtime_get_sync(data->dev);
ret = pm_runtime_resume_and_get(data->dev);
if (ret < 0)
return ret;
ret = bmp280_read_raw_impl(indio_dev, chan, val, val2, mask);
pm_runtime_put_autosuspend(data->dev);
@ -924,7 +927,10 @@ static int bmp280_write_raw(struct iio_dev *indio_dev,
struct bmp280_data *data = iio_priv(indio_dev);
int ret;
pm_runtime_get_sync(data->dev);
ret = pm_runtime_resume_and_get(data->dev);
if (ret < 0)
return ret;
ret = bmp280_write_raw_impl(indio_dev, chan, val, val2, mask);
pm_runtime_put_autosuspend(data->dev);
@ -2254,7 +2260,10 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val,
struct bmp280_data *data = priv;
int ret;
pm_runtime_get_sync(data->dev);
ret = pm_runtime_resume_and_get(data->dev);
if (ret < 0)
return ret;
ret = bmp580_nvmem_read_impl(priv, offset, val, bytes);
pm_runtime_put_autosuspend(data->dev);
@ -2328,7 +2337,10 @@ static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val,
struct bmp280_data *data = priv;
int ret;
pm_runtime_get_sync(data->dev);
ret = pm_runtime_resume_and_get(data->dev);
if (ret < 0)
return ret;
ret = bmp580_nvmem_write_impl(priv, offset, val, bytes);
pm_runtime_put_autosuspend(data->dev);
@ -3108,11 +3120,17 @@ EXPORT_SYMBOL_NS(bmp085_chip_info, "IIO_BMP280");
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;
return 0;
ret = data->chip_info->set_mode(data, BMP280_NORMAL);
if (ret)
pm_runtime_put_autosuspend(data->dev);
return ret;
}
static int bmp280_buffer_postdisable(struct iio_dev *indio_dev)