mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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

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

all inboxes | Powered by JetHome®