mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Yash Suthar <yashsuthar983@gmail.com>
Cc: linux-iio@vger.kernel.org, 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
Subject: Re: [PATCH] iio: pressure: bmp280: return on runtime PM resume failure
Date: Tue, 16 Jun 2026 13:23:56 +0300	[thread overview]
Message-ID: <ajEkPFyOJAI_TO-5@ashevche-desk.local> (raw)
In-Reply-To: <20260616093126.66312-1-yashsuthar983@gmail.com>

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



  reply	other threads:[~2026-06-16 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  9:31 Yash Suthar
2026-06-16 10:23 ` Andy Shevchenko [this message]
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=ajEkPFyOJAI_TO-5@ashevche-desk.local \
    --to=andriy.shevchenko@intel.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 \
    --cc=yashsuthar983@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®