From: Yash Suthar <yashsuthar983@gmail.com>
To: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jic23@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
salah.triki@gmail.com, sakari.ailus@linux.intel.com,
Achim.Gratz@Stromeko.DE, yashsuthar983@gmail.com
Subject: [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
Date: Tue, 16 Jun 2026 15:01:26 +0530 [thread overview]
Message-ID: <20260616093126.66312-1-yashsuthar983@gmail.com> (raw)
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
next reply other threads:[~2026-06-16 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 9:31 Yash Suthar [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260616093126.66312-1-yashsuthar983@gmail.com \
--to=yashsuthar983@gmail.com \
--cc=Achim.Gratz@Stromeko.DE \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=sakari.ailus@linux.intel.com \
--cc=salah.triki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®