From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
linux-acpi@vger.kernel.org, linux-media@vger.kernel.org,
jacopo.mondi@ideasonboard.com
Subject: Re: [PATCH v2 2/7] pm: runtime: Add pm_runtime_put_mark_busy_autosusp() helper
Date: Mon, 20 Nov 2023 11:47:43 +0200 [thread overview]
Message-ID: <20231120094743.GC6824@pendragon.ideasonboard.com> (raw)
In-Reply-To: <ZVsml5E46uAM-94q@kekkonen.localdomain>
Hi Sakari,
On Mon, Nov 20, 2023 at 09:27:51AM +0000, Sakari Ailus wrote:
> On Sat, Nov 18, 2023 at 11:30:31PM +0200, Laurent Pinchart wrote:
> > On Sat, Nov 18, 2023 at 10:20:46PM +0100, Rafael J. Wysocki wrote:
> > > On Sat, Nov 18, 2023 at 6:49 PM Laurent Pinchart wrote:
> > > > On Fri, Nov 17, 2023 at 01:14:28PM +0200, Sakari Ailus wrote:
> > > > > Add pm_runtime_put_mark_busy_autosusp() helper function for users that
> > > > > wish to set the last_busy timestamp to current time and put the
> > > > > usage_count of the device and set the autosuspend timer.
> > > > >
> > > > > Essentially calling pm_runtime_suspend_mark_busy_autosusp() equal to
> > > > > calling first pm_runtime_mark_last_busy() and then
> > > > > pm_runtime_put_autosuspend().
> > > >
> > > > The vast majority if the pm_runtime_put_autosuspend() users call
> > > > pm_runtime_mark_last_busy() right before. Let's make the
> > > > pm_runtime_put_autosuspend() function do that by default, and add a
> > > > __pm_runtime_put_autosuspend() (name to be bikshedded) for the minority
> > > > of cases where updating the last busy timestamp isn't desired. We want
> > > > to simplify the API, not make it more complex.
> > >
> > > I would also prefer it to be done this way if not too problematic.
> >
> > I'm glad you agree :-) The change will probably be a bit painful, but I
> > think it's for the best. Sakari, please let me know if I can help.
>
> I actually do prefer this approach, too.
>
> There about 350 drivers using pm_runtime_autosuspend() currently. Around
> 150 uses pm_runtime_autosuspend() which is not preceded by
> pm_runtime_mark_last_busy(). Call-wise the numbers are ~ 1050 and ~ 330.
>
> I checked some of what's left: most do still call both, but in a way that
> evades Coccinelle matching. Some omissions seem to remain.
>
> Given that there are way more users that do also call
> pm_runtime_mark_last_busy(), I think I'll try to introduce
> __pm_runtime_put_autosuspend() and pm_runtime_put_autosuspend()
> documentation change first and then rename the callers that don't use
> pm_runtime_mark_last_busy().
And also drop pm_runtime_mark_last_busy() from the drivers that call
pm_runtime_put_autosuspend(), right ?
This sounds good to me. Thank you for working on this. Two RPM API
simplifications in a week, it feels like Christmas is coming :-)
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-11-20 9:47 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 11:14 [PATCH v2 0/7] Small Runtime PM API changes Sakari Ailus
2023-11-17 11:14 ` [PATCH v2 1/7] pm: runtime: Simplify pm_runtime_get_if_active() usage Sakari Ailus
2023-11-18 17:46 ` Laurent Pinchart
2023-11-17 11:14 ` [PATCH v2 2/7] pm: runtime: Add pm_runtime_put_mark_busy_autosusp() helper Sakari Ailus
2023-11-18 17:49 ` Laurent Pinchart
2023-11-18 21:20 ` Rafael J. Wysocki
2023-11-18 21:30 ` Laurent Pinchart
2023-11-20 9:27 ` Sakari Ailus
2023-11-20 9:47 ` Laurent Pinchart [this message]
2023-11-21 8:41 ` Sakari Ailus
2023-11-21 8:50 ` Laurent Pinchart
2023-11-21 10:00 ` Sakari Ailus
2023-11-17 11:14 ` [PATCH v2 3/7] ACPI: Documentation: Document acpi_dev_state_d0() Sakari Ailus
2023-11-18 18:50 ` Laurent Pinchart
2023-11-20 9:31 ` Sakari Ailus
2023-11-20 12:52 ` Rafael J. Wysocki
2023-11-20 20:03 ` Sakari Ailus
2023-11-20 20:22 ` Rafael J. Wysocki
2023-11-20 20:53 ` Sakari Ailus
2023-11-17 11:14 ` [PATCH v2 4/7] media: Documentation: Improve camera sensor runtime PM documentation Sakari Ailus
2023-11-18 18:49 ` Laurent Pinchart
2023-11-17 11:14 ` [PATCH v2 5/7] media: ov8858: Use pm_runtime_get_if_active(), put usage_count correctly Sakari Ailus
2023-11-17 15:30 ` Jacopo Mondi
2023-11-18 11:12 ` Sakari Ailus
2023-11-18 17:33 ` Laurent Pinchart
2023-11-20 8:31 ` Sakari Ailus
2023-11-17 11:14 ` [PATCH v2 6/7] media: imx319: Put usage_count correctly in s_ctrl callback Sakari Ailus
2023-11-18 18:52 ` Laurent Pinchart
2023-11-20 9:32 ` Sakari Ailus
2023-11-20 9:45 ` Laurent Pinchart
2023-11-21 8:18 ` Sakari Ailus
2023-11-21 8:25 ` Laurent Pinchart
2023-11-21 8:44 ` Sakari Ailus
2023-11-17 11:14 ` [PATCH v2 7/7] media: imx219: " Sakari Ailus
2023-11-17 14:20 ` Dave Stevenson
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=20231120094743.GC6824@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.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