* [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
@ 2026-06-16 9:31 Yash Suthar
2026-06-16 10:23 ` Andy Shevchenko
2026-06-16 11:46 ` [PATCH v2] " Yash Suthar
0 siblings, 2 replies; 7+ messages in thread
From: Yash Suthar @ 2026-06-16 9:31 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, jic23, dlechner, nuno.sa, andy, salah.triki,
sakari.ailus, Achim.Gratz, yashsuthar983
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and
propagate error.
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---
drivers/iio/pressure/bmp280-core.c | 32 ++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index d983ce9c0b99..7f4b0976ff22 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -749,8 +749,10 @@ static int bmp280_read_raw(struct iio_dev *indio_dev,
{
struct bmp280_data *data = iio_priv(indio_dev);
int ret;
+ 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);
@@ -923,8 +925,10 @@ static int bmp280_write_raw(struct iio_dev *indio_dev,
{
struct bmp280_data *data = iio_priv(indio_dev);
int ret;
+ ret = pm_runtime_resume_and_get(data->dev);
+ if (ret < 0)
+ return ret;
- pm_runtime_get_sync(data->dev);
ret = bmp280_write_raw_impl(indio_dev, chan, val, val2, mask);
pm_runtime_put_autosuspend(data->dev);
@@ -2253,8 +2257,10 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val,
{
struct bmp280_data *data = priv;
int ret;
+ ret = pm_runtime_resume_and_get(data->dev);
+ if (ret < 0)
+ return ret;
- pm_runtime_get_sync(data->dev);
ret = bmp580_nvmem_read_impl(priv, offset, val, bytes);
pm_runtime_put_autosuspend(data->dev);
@@ -2327,8 +2333,10 @@ static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val,
{
struct bmp280_data *data = priv;
int ret;
+ ret = pm_runtime_resume_and_get(data->dev);
+ if (ret < 0)
+ return ret;
- pm_runtime_get_sync(data->dev);
ret = bmp580_nvmem_write_impl(priv, offset, val, bytes);
pm_runtime_put_autosuspend(data->dev);
@@ -3108,9 +3116,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;
+
+ ret = data->chip_info->set_mode(data, BMP280_NORMAL);
+ if (ret) {
+ pm_runtime_put_autosuspend(data->dev);
+ return ret;
+ }
return 0;
}
@@ -3133,8 +3149,8 @@ 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)
+ pm_runtime_put_noidle(dev);
pm_runtime_disable(dev);
}
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-16 9:31 [PATCH] iio: pressure: bmp280: return on runtime PM resume failure Yash Suthar
@ 2026-06-16 10:23 ` Andy Shevchenko
2026-06-16 11:25 ` Yash Suthar
2026-06-16 11:46 ` [PATCH v2] " Yash Suthar
1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-06-16 10:23 UTC (permalink / raw)
To: Yash Suthar
Cc: linux-iio, linux-kernel, jic23, dlechner, nuno.sa, andy,
salah.triki, sakari.ailus, Achim.Gratz
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-16 10:23 ` Andy Shevchenko
@ 2026-06-16 11:25 ` Yash Suthar
0 siblings, 0 replies; 7+ messages in thread
From: Yash Suthar @ 2026-06-16 11:25 UTC (permalink / raw)
To: andriy.shevchenko
Cc: Achim.Gratz, andy, dlechner, jic23, linux-iio, linux-kernel,
nuno.sa, sakari.ailus, salah.triki, yashsuthar983
Thanks for the review.
> No, here must be a blank line. And so on...
> Also possible
>
> ret = data->chip_info->set_mode(data, BMP280_NORMAL);
> if (ret)
> pm_runtime_put_autosuspend(data->dev);
>
> return ret;
Agreed, will ship in v2.
> Why this change?
Fair, there is nothing to propagate, will drop that change in v2.
The intent is to use pm_runtime_resume_and_get() instead of
pm_runtime_get_sync().
Sincerly,
Yash Suthar
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-16 9:31 [PATCH] iio: pressure: bmp280: return on runtime PM resume failure Yash Suthar
2026-06-16 10:23 ` Andy Shevchenko
@ 2026-06-16 11:46 ` Yash Suthar
2026-06-17 6:58 ` Andy Shevchenko
1 sibling, 1 reply; 7+ messages in thread
From: Yash Suthar @ 2026-06-16 11:46 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, jic23, dlechner, nuno.sa, andy, andriy.shevchenko,
salah.triki, sakari.ailus, Achim.Gratz, Yash Suthar
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and
propagate error.
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---
drivers/iio/pressure/bmp280-core.c | 32 +++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index d983ce9c0b99..e2e22b1c7288 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -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)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-16 11:46 ` [PATCH v2] " Yash Suthar
@ 2026-06-17 6:58 ` Andy Shevchenko
2026-06-17 8:20 ` Yash Suthar
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-06-17 6:58 UTC (permalink / raw)
To: Yash Suthar
Cc: linux-iio, linux-kernel, jic23, dlechner, nuno.sa, andy,
salah.triki, sakari.ailus, Achim.Gratz
On Tue, Jun 16, 2026 at 05:16:21PM +0530, Yash Suthar wrote:
> Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and
> propagate error.
>
> Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
> ---
v2? Where is the changelog, please?
(This time just reply to this email with a changelog text, next time put it for
a single patch after the '---' line.)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-17 6:58 ` Andy Shevchenko
@ 2026-06-17 8:20 ` Yash Suthar
2026-06-23 18:57 ` Jonathan Cameron
0 siblings, 1 reply; 7+ messages in thread
From: Yash Suthar @ 2026-06-17 8:20 UTC (permalink / raw)
To: andriy.shevchenko
Cc: Achim.Gratz, andy, dlechner, jic23, linux-iio, linux-kernel,
nuno.sa, sakari.ailus, salah.triki, yashsuthar983
v2:
- Restore the blank line after the variable.
- Simplify the error path in bmp280_buffer_preenable().
- Drop the bmp280_pm_disable() change, because no
caller to propagate the error.
Sincerely,
Yash Suthar
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] iio: pressure: bmp280: return on runtime PM resume failure
2026-06-17 8:20 ` Yash Suthar
@ 2026-06-23 18:57 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-06-23 18:57 UTC (permalink / raw)
To: Yash Suthar
Cc: andriy.shevchenko, Achim.Gratz, andy, dlechner, linux-iio,
linux-kernel, nuno.sa, sakari.ailus, salah.triki
On Wed, 17 Jun 2026 13:50:58 +0530
Yash Suthar <yashsuthar983@gmail.com> wrote:
> v2:
> - Restore the blank line after the variable.
> - Simplify the error path in bmp280_buffer_preenable().
> - Drop the bmp280_pm_disable() change, because no
> caller to propagate the error.
>
Applied to the testing branch of iio.git which will get
rebase on rc1 once available.
thanks,
Jonathan
> Sincerely,
> Yash Suthar
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-06-23 18:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 9:31 [PATCH] iio: pressure: bmp280: return on runtime PM resume failure Yash Suthar
2026-06-16 10:23 ` Andy Shevchenko
2026-06-16 11:25 ` Yash Suthar
2026-06-16 11:46 ` [PATCH v2] " Yash Suthar
2026-06-17 6:58 ` Andy Shevchenko
2026-06-17 8:20 ` Yash Suthar
2026-06-23 18:57 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox