mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ulf Hansson" <ulfh@kernel.org>,
	linux-pm@vger.kernel.org, "Andy Shevchenko" <andy@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 01/17] iio: accel: fxls8962af: Discard pm_runtime_put_autosuspend() return values
Date: Thu, 22 Oct 2026 10:51:43 -0700	[thread overview]
Message-ID: <atpNLy6Tb46hroHf@google.com> (raw)
In-Reply-To: <atmy2Db_DlLUuOeC@ashevche-desk.local>

On Thu, Oct 22, 2026 at 09:53:12AM +0300, Andy Shevchenko wrote:
> On Wed, Oct 21, 2026 at 04:57:02PM -0700, Brian Norris wrote:
> > This driver propagates the return value of pm_runtime_put_autosuspend(),
> > which is not particularly useful.
> > 
> > Returning an error code from pm_runtime_put_autosuspend() merely means
> > that it has not queued up a timer or work item to check whether or not
> > the device can be suspended and there are many perfectly valid
> > situations in which that can happen, like after writing "on" to the
> > device's runtime PM "control" attribute in sysfs for one example.
> > 
> > For this reason, modify this driver to simply discard the
> > pm_runtime_put_autosuspend() return value, and inline the
> > fxls8962af_power_off/on() helpers to their callsites, as they're even
> > more trivial now.
> > 
> > This will facilitate a planned change of the
> > pm_runtime_put_autosuspend() return type to void in the future, similar
> > to commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return
> > type to void").
> 
> ...
> 
> > static int fxls8962af_get_out(struct fxls8962af_data *data,
> 
> >  
> >  	is_active = fxls8962af_is_active(data);
> 
> >  	if (!is_active) {
> 
> Why do we have this check at all?

Frankly, I don't know. It seems logically wrong; you shouldn't even be
reading device registers without first grabbing a runtime PM reference.

But I'm also loathe to go tweak a bunch of driver-specific details I'm
completely unfamiliar with, when my main purpose is extremely simple --
to stop checking one return code.

All in all, I think this is beside the point, and I'd rather not try to
address it in this series. For one, even if I try to address it, there's
more chance of regressions that will distract from my purpose.

> > -		ret = fxls8962af_power_on(data);
> > -		if (ret)
> > +		ret = pm_runtime_resume_and_get(dev);
> > +		if (ret) {
> > +			dev_err(dev, "failed to power on: %d\n", ret);
> >  			return ret;
> > +		}
> >  	}
> >  
> >  	ret = regmap_bulk_read(data->regmap, chan->address,
> >  			       &raw_val, sizeof(data->lower_thres));
> >  
> >  	if (!is_active)
> > -		fxls8962af_power_off(data);
> > +		pm_runtime_put_autosuspend(dev);
> 
> If it's active my understanding that runtime PM keeps device already resumed,
> so these two will be just a reference counting calls, no?

Right. I don't really see the point.

Brian

  reply	other threads:[~2026-10-22 17:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 23:57 [PATCH v2 00/17] iio: Stop looking at pm_runtime_put_autosuspend() return codes Brian Norris
2026-10-21 23:57 ` [PATCH v2 01/17] iio: accel: fxls8962af: Discard pm_runtime_put_autosuspend() return values Brian Norris
2026-10-22  6:53   ` Andy Shevchenko
2026-10-22 17:51     ` Brian Norris [this message]
2026-10-23  3:29       ` Jonathan Cameron
2026-10-21 23:57 ` [PATCH v2 02/17] iio: accel: kxcjk-1013: " Brian Norris
2026-10-22  6:58   ` Andy Shevchenko
2026-10-23  3:36   ` Jonathan Cameron
2026-10-23 16:43     ` Brian Norris
2026-10-21 23:57 ` [PATCH v2 03/17] iio: accel: mma8452: " Brian Norris
2026-10-22  6:59   ` Andy Shevchenko
2026-10-21 23:57 ` [PATCH v2 04/17] iio: accel: mma955x: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 05/17] iio: accel: bmc150: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 06/17] iio: adc: rcar-gyroadc: " Brian Norris
2026-10-22  9:23   ` Geert Uytterhoeven
2026-10-21 23:57 ` [PATCH v2 07/17] iio: adc: ti-ads1015: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 08/17] iio: chemical: atlas-sensor: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 09/17] iio: hid-sensors: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 10/17] iio: gyro: bmg160: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 11/17] iio: gyro: fxas21002c: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 12/17] iio: imu: kmx61: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 13/17] iio: light: apds9960: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 14/17] iio: light: pa12203001: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 15/17] iio: light: rpr0521: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 16/17] iio: light: tsl2583: " Brian Norris
2026-10-21 23:57 ` [PATCH v2 17/17] iio: light: us5182d: " Brian Norris
2026-10-22  7:01 ` [PATCH v2 00/17] iio: Stop looking at pm_runtime_put_autosuspend() return codes Andy Shevchenko
2026-10-22 17:47   ` Brian Norris
2026-10-23  6:54     ` Andy Shevchenko
2026-10-23 16:43       ` Brian Norris

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=atpNLy6Tb46hroHf@google.com \
    --to=briannorris@chromium.org \
    --cc=andriy.shevchenko@intel.com \
    --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=linux-pm@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=rafael@kernel.org \
    --cc=ulfh@kernel.org \
    /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®