From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795618448; b=vP5bicfggLAJlw029/vA3Vx9FtATFVY/duc7VGKB++NeZn8sEHnrkp8EVoMDm9IF0sg9 nHkV6wTCcbl+TmAUbVlQWJMza/HIpqy8BLUREvoc5JiyVPnKQDkWXH8aiQ9a1dTHvvb5D TKOfAZx8FmKSxmgQf7l6gz7hQngSGnhV1G1sMbj0rGyeV6RkLXLIbyHK7WSttInljnaFo yFKto+E4jMJXNkFYhDoeCFa4N6GwfKkIPQDhx4xoamUzbVlDSo77eZoPgF3dSqCztviR5 P5OUhOoED8GqtkZPGVYbk0Rc4/u07lcWO2fQ3SXnL3IyvDTFze9kl8nylWOF2kzLfDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795618448; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=K8DVmGxQ1rJmIJKp27AyteFy87jbBY/GFAYRyXn9mQw=; b=y9YpKhQxuUlVdRdemfErkTK8kUB3nSvJNMCTvT32vu0NPwgaJx/qr0L90Sy2oFln57c4 yHQ7uUf+vQvlzOW2eLSHhlPB+KXJIAol80xYLcUl3Sl1ez9pVrPMWrwMiFvCNL2RO7ADo 2qcga3FkK0/fmgatlFHTDdyffpG9bFTrIO9cpObzdsm0bqRCMlv5OqY3eoAur1rE2xaUP dy5i/0Se1TORDgv99NFXlXBH9z0mduxk3w4av+nL+5XwSgdEbzXXwS0kEUsZvwqcQ97+q isVlRqmNpLg+QdMssMkwxcexiqJLukSIbBz8kNzOCLcaUJcOZBFAvkOnaXiYlcVFoSQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="UU5Q4/7N"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75D92606A31E; Wed, 25 Nov 2026 14:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UU5Q4/7N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57BB81F000D3; Wed, 25 Nov 2026 14:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795618447; bh=K8DVmGxQ1rJmIJKp27AyteFy87jbBY/GFAYRyXn9mQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UU5Q4/7NiK8gNwSPsw41CG+VtiFOlXt/TDTyZncOXM8G77rS7mmk/Vf1x3gZPdCd+ i6h1mnTckAZIA+m/xgIEhM9eDG4dmC1/evXiK1j+MxgO+MVm3OclAk7/VOVM4zBGr8 7F9WmbxEOJOXlysTQBBDDZ+3Fv7BfG9DpD2OYbAU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Brian Norris , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 7.3 0283/1005] PM: runtime: Misc improvements to runtime_pm.rst Date: Wed, 25 Nov 2026 15:27:01 +0100 Message-ID: <20261125143828.373527629@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brian Norris [ Upstream commit 437b4ed6cb5848027fe9b9c8d0da495eef7f8de3 ] There are several small errors and omissions, as well as new updates (pm_runtime_resume_and_get(), devm_pm_runtime_enable()) we should incorporate. Signed-off-by: Brian Norris Link: https://patch.msgid.link/20260929194956.v3.3.I383681b22c12d7caee976cb91aa90d1a94d4a591@changeid Signed-off-by: Rafael J. Wysocki Stable-dep-of: 7a93f7e30a3f ("PM: runtime: Update runtime_pm.rst for non-fatal resume errors") Signed-off-by: Sasha Levin --- Documentation/power/runtime_pm.rst | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst index a53ab09c37d53..2498e4495daf8 100644 --- a/Documentation/power/runtime_pm.rst +++ b/Documentation/power/runtime_pm.rst @@ -529,6 +529,8 @@ It is safe to execute the following helper functions from interrupt context: - pm_request_resume() - pm_runtime_get_noresume() - pm_runtime_get() +- pm_runtime_get_if_active() +- pm_runtime_get_if_in_use() - pm_runtime_put_noidle() - pm_runtime_put() - pm_runtime_put_autosuspend() @@ -538,6 +540,9 @@ It is safe to execute the following helper functions from interrupt context: - pm_runtime_set_active() - pm_runtime_set_suspended() - pm_runtime_suspended() +- pm_runtime_active() +- pm_runtime_status_suspended() +- pm_runtime_enabled() - pm_runtime_mark_last_busy() - pm_runtime_autosuspend_expiration() @@ -549,6 +554,7 @@ functions may also be used in interrupt context: - pm_runtime_autosuspend() - pm_runtime_resume() - pm_runtime_get_sync() +- pm_runtime_resume_and_get() - pm_runtime_put_sync() - pm_runtime_put_sync_suspend() - pm_runtime_put_sync_autosuspend() @@ -558,7 +564,7 @@ functions may also be used in interrupt context: Initially, the runtime PM is disabled for all devices, which means that the majority of the runtime PM helper functions described in Section 4 will return --EAGAIN until pm_runtime_enable() is called for the device. +-EACCES until pm_runtime_enable() is called for the device. In addition to that, the initial runtime PM status of all devices is 'suspended', but it need not reflect the actual physical state of the device. @@ -587,7 +593,7 @@ enabled earlier by calling pm_runtime_enable(). Note, if the device may execute pm_runtime calls during the probe (such as if it is registered with a subsystem that may call back in) then the -pm_runtime_get_sync() call paired with a pm_runtime_put() call will be +pm_runtime_resume_and_get() call paired with a pm_runtime_put() call will be appropriate to ensure that the device is not put back to sleep during the probe. This can happen with systems such as the network device layer. @@ -615,7 +621,10 @@ removal of their drivers. Drivers in ->remove() callback should undo the runtime PM changes done in ->probe(). Usually this means calling pm_runtime_disable(), -pm_runtime_dont_use_autosuspend() etc. +pm_runtime_dont_use_autosuspend() etc. Alternatively, drivers can use +devm_pm_runtime_enable() during probe, which automatically takes care of +calling pm_runtime_disable() and pm_runtime_dont_use_autosuspend() upon driver +detachment. The user space can effectively disallow the driver of the device to power manage it at run time by changing the value of its /sys/devices/.../power/control @@ -726,7 +735,7 @@ out the following operations: Subsystems may wish to conserve code space by using the set of generic power management callbacks provided by the PM core, defined in -driver/base/power/generic_ops.c: +drivers/base/power/generic_ops.c: `int pm_generic_runtime_suspend(struct device *dev);` - invoke the ->runtime_suspend() callback provided by the driver of this @@ -800,8 +809,8 @@ subsystem-level dev_pm_ops structure. Device drivers that wish to use the same function as a system suspend, freeze, poweroff and runtime suspend callback, and similarly for system resume, thaw, restore, and runtime resume, can achieve similar behaviour with the help of the -DEFINE_RUNTIME_DEV_PM_OPS() defined in include/linux/pm_runtime.h (possibly setting its -last argument to NULL). +DEFINE_RUNTIME_DEV_PM_OPS() macro defined in include/linux/pm_runtime.h +(possibly setting its last argument to NULL). 8. "No-Callback" Devices ======================== @@ -864,7 +873,7 @@ registration the length should be controlled by user space, using the In order to use autosuspend, subsystems or drivers must call pm_runtime_use_autosuspend() (preferably before registering the device), and -thereafter they should use the various `*_autosuspend()` helper functions +thereafter they should use the various \*_autosuspend() helper functions instead of the non-autosuspend counterparts:: Instead of: pm_runtime_suspend use: pm_runtime_autosuspend; @@ -874,7 +883,7 @@ instead of the non-autosuspend counterparts:: Drivers may also continue to use the non-autosuspend helper functions; they will behave normally, which means sometimes taking the autosuspend delay into -account (see pm_runtime_idle). The autosuspend variants of the functions also +account (see pm_runtime_idle()). The autosuspend variants of the functions also call pm_runtime_mark_last_busy(). Under some circumstances a driver or subsystem may want to prevent a device @@ -917,7 +926,7 @@ Here is a schematic pseudo-code example:: int foo_runtime_suspend(struct device *dev) { - struct foo_priv foo = container_of(dev, ...); + struct foo_priv *foo = container_of(dev, ...); int ret = 0; lock(&foo->private_lock); @@ -933,7 +942,7 @@ Here is a schematic pseudo-code example:: int foo_runtime_resume(struct device *dev) { - struct foo_priv foo = container_of(dev, ...); + struct foo_priv *foo = container_of(dev, ...); lock(&foo->private_lock); /* ... resume the device ... */ -- 2.53.0