linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
	linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Stanislaw Gruszka" <stanislaw.gruszka@linux.intel.com>,
	laurent.pinchart@ideasonboard.com,
	"David Airlie" <airlied@gmail.com>,
	"Paul Elder" <paul.elder@ideasonboard.com>,
	linux-media@vger.kernel.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-gfx@lists.freedesktop.org,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jacek Lawrynowicz" <jacek.lawrynowicz@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	intel-xe@lists.freedesktop.org,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"Alex Elder" <elder@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-sound@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v3 1/2] pm: runtime: Simplify pm_runtime_get_if_active() usage
Date: Mon, 22 Jan 2024 12:12:05 -0600	[thread overview]
Message-ID: <20240122181205.GA275751@bhelgaas> (raw)
In-Reply-To: <20240122114121.56752-2-sakari.ailus@linux.intel.com>

On Mon, Jan 22, 2024 at 01:41:21PM +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.

s/explitly/explicitly/

> 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().
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Reviewed-by: Alex Elder <elder@linaro.org> # drivers/net/ipa/ipa_smp2p.c
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Acked-by: Takashi Iwai <tiwai@suse.de> # sound/
> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> # drivers/accel/ivpu/
> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> # drivers/gpu/drm/i915/
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com> # drivers/pci/

> -EXPORT_SYMBOL_GPL(pm_runtime_get_if_active);
> +EXPORT_SYMBOL_GPL(pm_runtime_get_conditional);

If pm_runtime_get_conditional() is exported, shouldn't it also be
documented in Documentation/power/runtime_pm.rst?

But I'm dubious about exporting it because
__intel_runtime_pm_get_if_active() is the only caller, and you end up
with the same pattern there that we have before this series in the PM
core.  Why can't intel_runtime_pm.c be updated to use
pm_runtime_get_if_active() or pm_runtime_get_if_in_use() directly, and
make pm_runtime_get_conditional() static?

> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -246,7 +246,7 @@ static intel_wakeref_t __intel_runtime_pm_get_if_active(struct intel_runtime_pm
>  		 * function, since the power state is undefined. This applies
>  		 * atm to the late/early system suspend/resume handlers.
>  		 */
> -		if (pm_runtime_get_if_active(rpm->kdev, ignore_usecount) <= 0)
> +		if (pm_runtime_get_conditional(rpm->kdev, ignore_usecount) <= 0)
>  			return 0;
>  	}

Bjorn

  reply	other threads:[~2024-01-22 18:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 11:41 [PATCH v3 0/2] Small runtime PM API changes Sakari Ailus
2024-01-22 11:41 ` [PATCH v3 1/2] pm: runtime: Simplify pm_runtime_get_if_active() usage Sakari Ailus
2024-01-22 18:12   ` Bjorn Helgaas [this message]
2024-01-22 18:16     ` Rafael J. Wysocki
2024-01-23  7:45       ` Sakari Ailus
2024-01-26 15:12   ` Alex Elder
2024-01-26 17:23     ` Sakari Ailus
2024-01-22 11:41 ` [PATCH v3 2/2] pm: runtime: Add pm_runtime_put_autosuspend() replacement Sakari Ailus

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=20240122181205.GA275751@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=perex@perex.cz \
    --cc=rafael@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stanislaw.gruszka@linux.intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=tvrtko.ursulin@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;
as well as URLs for NNTP newsgroup(s).