Re: [PATCH 1/2] pm: runtime: Simplify pm_runtime_get_if_active() usage

Sakari Ailus
2024-01-10T11:58:21Z

Hi Rodrigo,

On Tue, Jan 09, 2024 at 12:35:25PM -0500, Rodrigo Vivi wrote:
> On Tue, Jan 09, 2024 at 03:36:57PM +0200, Sakari Ailus wrote:
> > There are two ways to opportunistically increment a device's runtime PM
> > usage count, calling either pm_runtime_get_if_active() or
> > pm_runtime_get_if_in_use(). The former has an argument to tell whether to
> > ignore the usage count or not, and the latter simply calls the former with
> > ign_usage_count set to false. The other users that want to ignore the
> > usage_count will have to explitly set that argument to true which is a bit
> > cumbersome.
> >
> > To make this function more practical to use, remove the ign_usage_count
> > argument from the function. The main implementation is renamed as
> > __pm_runtime_get_conditional().
>
> Great idea! I recently found a bug in Xe caused by some confusion
> with the ign_usage_count var.
>
> > + * This function is not intended to be called by drivers, use
> > + * pm_runtime_get_if_active() or pm_runtime_get_if_in_use() instead.
> > */
>
> Well, it is not intended, but we already have an usage for that.

I'll change the above text to:

* This function is not primarily intended for use in drivers, most of which are
* better served by either pm_runtime_get_if_active() or
* pm_runtime_get_if_in_use() instead.

Perhaps it would better reflect the intention and actual use.

--
Regards,

Sakari Ailus