Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Waqar Hameed" <waqar.hameed@axis.com>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Julien Stephan" <jstephan@baylibre.com>,
	"Bo Liu" <liubo03@inspur.com>,
	"Al Viro" <viro@zeniv.linux.org.uk>,
	"Sean Nyekjaer" <sean@geanix.com>,
	"Haibo Chen" <haibo.chen@nxp.com>, "Han Xu" <han.xu@nxp.com>,
	"Francisco Henriques" <franciscolealhenriques@usp.br>,
	"Gustavo Vaz" <gustavo.vaz@usp.br>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 01/12] iio: accel: Remove redundant pm_runtime_mark_last_busy() calls
Date: Wed, 9 Jul 2025 16:28:05 +0100	[thread overview]
Message-ID: <20250709162805.37e472ac@jic23-huawei> (raw)
In-Reply-To: <aG4sZohbXE6kmq2G@smile.fi.intel.com>

On Wed, 9 Jul 2025 11:46:30 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Wed, Jul 09, 2025 at 02:11:51AM +0300, Sakari Ailus 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().  
> 
> ...
> 
> > -	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);
> > -	}  
> 
> The following blank line can be removed as it's done in the other file.
> 
> ...
> 
> Side note: Looking at this, perhaps we can also have a helper to toggle state?
> 
> ...
> 
> >  	if (on)
> >  		ret = pm_runtime_resume_and_get(&data->client->dev);
> > -	else {
> > -		pm_runtime_mark_last_busy(&data->client->dev);
> > +	else
> >  		ret = pm_runtime_put_autosuspend(&data->client->dev);
> > -	}  
> 
> So, already two users of the potential new helper :-)

Maybe, but also worth a close look at whether, after this simplification
these little functions to set power state add anything over just
calling pm_runtime_resume_and_get() or *_put_autosuspend()
inline at the call sites.   There are some cases in these drivers
where the state is not hard coded at the call site though so
a helper might be useful for those.

I'm not thinking of it as a job for this patch though which shouldn't
be making significant changes even if they are enabled by
the removals of the calls to pm_runtime_mark_last_busy()

So good idea, but probably get this in first.


> 
> ...
> 
> > -	if (on) {
> > +	if (on)
> >  		ret = pm_runtime_resume_and_get(&client->dev);
> > -	} else {
> > -		pm_runtime_mark_last_busy(&client->dev);
> > +	else
> >  		ret = pm_runtime_put_autosuspend(&client->dev);
> > -	}
> >    
> 
> No blank line?
> 
> Three!
> 
> >  	if (ret < 0) {  
> 
> ...
> 
> >  	if (on)
> >  		ret = pm_runtime_resume_and_get(&client->dev);
> > -	else {
> > -		pm_runtime_mark_last_busy(&client->dev);
> > +	else
> >  		ret = pm_runtime_put_autosuspend(&client->dev);
> > -	}
> >  
> >  	if (ret < 0) {  
> 
> As per above and counting...
> 


  reply	other threads:[~2025-07-09 15:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 23:11 [PATCH v2 00/12] iio: Remove redundant pm_runtime_mark_last_busy() calls Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 01/12] iio: accel: " Sakari Ailus
2025-07-09  8:46   ` Andy Shevchenko
2025-07-09 15:28     ` Jonathan Cameron [this message]
2025-07-08 23:11 ` [PATCH v2 03/12] iio: chemical: " Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 07/12] iio: imu: " Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 08/12] iio: light: " Sakari Ailus
2025-07-09 15:45   ` Jonathan Cameron
2025-07-08 23:11 ` [PATCH v2 06/12] iio: gyro: " Sakari Ailus
2025-07-09  8:51   ` Andy Shevchenko
2025-07-09 15:51   ` Jonathan Cameron
2025-07-08 23:11 ` [PATCH v2 02/12] iio: adc: " Sakari Ailus
2025-07-09  3:52   ` Chen-Yu Tsai
2025-07-09 15:37   ` Jonathan Cameron
2025-08-25 11:57     ` Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 09/12] iio: magnetometer: " Sakari Ailus
2025-07-09 15:47   ` Jonathan Cameron
2025-07-08 23:11 ` [PATCH v2 05/12] iio: dac: " Sakari Ailus
2025-07-09  8:48   ` Andy Shevchenko
2025-07-09 15:49     ` Jonathan Cameron
2025-07-08 23:11 ` [PATCH v2 04/12] iio: common: " Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 11/12] iio: proximity: " Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 12/12] iio: temperature: " Sakari Ailus
2025-07-08 23:11 ` [PATCH v2 10/12] iio: pressure: " Sakari Ailus
2025-07-09 15:55 ` [PATCH v2 00/12] iio: " 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=20250709162805.37e472ac@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=franciscolealhenriques@usp.br \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.vaz@usp.br \
    --cc=haibo.chen@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=jstephan@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=peterz@infradead.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sean@geanix.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=waqar.hameed@axis.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