lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aKxPo3Kg0ppOcczG@kekkonen.localdomain>
Date: Mon, 25 Aug 2025 14:57:23 +0300
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Linus Walleij <linus.walleij@...aro.org>,
	David Lechner <dlechner@...libre.com>,
	Nuno Sá <nuno.sa@...log.com>,
	Andy Shevchenko <andy@...nel.org>,
	Eugen Hristev <eugen.hristev@...aro.org>,
	Nicolas Ferre <nicolas.ferre@...rochip.com>,
	Alexandre Belloni <alexandre.belloni@...tlin.com>,
	Claudiu Beznea <claudiu.beznea@...on.dev>,
	Cai Huoqing <cai.huoqing@...ux.dev>,
	Haibo Chen <haibo.chen@....com>, Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Marek Vasut <marek.vasut@...il.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Magnus Damm <magnus.damm@...il.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
	Maxime Coquelin <mcoquelin.stm32@...il.com>,
	Alexandre Torgue <alexandre.torgue@...s.st.com>,
	Chen-Yu Tsai <wens@...e.org>,
	Jernej Skrabec <jernej.skrabec@...il.com>,
	Samuel Holland <samuel@...lland.org>,
	Francesco Dolcini <francesco@...cini.it>,
	João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>,
	"Jiri Slaby (SUSE)" <jirislaby@...nel.org>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
	"Rob Herring (Arm)" <robh@...nel.org>,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	Julien Stephan <jstephan@...libre.com>,
	linux-arm-kernel@...ts.infradead.org, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
	linux-renesas-soc@...r.kernel.org,
	linux-stm32@...md-mailman.stormreply.com,
	linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH v2 02/12] iio: adc: Remove redundant
 pm_runtime_mark_last_busy() calls

Hi Jonathan,

Thanks for the review.

On Wed, Jul 09, 2025 at 04:37:56PM +0100, Jonathan Cameron wrote:
> On Wed,  9 Jul 2025 02:11:52 +0300
> Sakari Ailus <sakari.ailus@...ux.intel.com> wrote:
> 
> > pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(),
> > pm_runtime_autosuspend() and pm_request_autosuspend() now include a call
> > to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to
> > pm_runtime_mark_last_busy().
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
> > Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
> 
> Some comments for the future as more about what can be improved on the back
> of this than what you have here.
> 
> >
> > diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
> > index cc326f21d398..3a17b3898bf6 100644
> > --- a/drivers/iio/adc/rcar-gyroadc.c
> > +++ b/drivers/iio/adc/rcar-gyroadc.c
> > @@ -163,12 +163,10 @@ static int rcar_gyroadc_set_power(struct rcar_gyroadc *priv, bool on)
> >  {
> >  	struct device *dev = priv->dev;
> >  
> This is a very clear example of where the *_set_power() pattern is a bad idea.
> There are two calls of this function, one with it hard coded as on and one with it
> hard coded as off.  We can just push the pm_runtime_resume_and_get()
> to the on case etc.
> 
> I don't mind that much if we do so as a follow up patch so this one can
> be the mechanical change and then we follow up with the enabled simplification.

Ack. I presume this pattern is due to one driver having used it first and
then other drivers copying that. I haven't seen it elsewhere, or at least
not being used as widely.

> 
> > -	if (on) {
> > +	if (on)
> >  		return pm_runtime_resume_and_get(dev);
> > -	} else {
> > -		pm_runtime_mark_last_busy(dev);
> > -		return pm_runtime_put_autosuspend(dev);
> > -	}
> > +
> > +	return pm_runtime_put_autosuspend(dev);
> >  }
> >  
> >  static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
> >> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> > index 48549d617e5f..f2a93c63ca14 100644
> > --- a/drivers/iio/adc/ti-ads1015.c
> > +++ b/drivers/iio/adc/ti-ads1015.c
> > @@ -374,12 +374,10 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
> >  	int ret;
> >  	struct device *dev = regmap_get_device(data->regmap);
> >  
> > -	if (on) {
> > +	if (on)
> >  		ret = pm_runtime_resume_and_get(dev);
> > -	} else {
> > -		pm_runtime_mark_last_busy(dev);
> > +	else
> >  		ret = pm_runtime_put_autosuspend(dev);
> > -	}
> >  
> >  	return ret < 0 ? ret : 0;
> So this one has a stub version which only brings benefits because
> we have checks on the pm_runtime_put_autosuspend() path failing
> (which it does if we have !CONFIG_PM).
> 
> I think the right option there is check the return value is < 0
> for the resume_and_get() and don't check the _put_autosuspend()
> return value at all.  Then we can just push this down to the
> call sites as all of them hard code the bool value.

Ack.

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ