Skip to content

Commit cea54f8

Browse files
committed
PM: runtime: docs: Update pm_runtime_allow/forbid() documentation
Drop confusing descriptions of pm_runtime_allow() and pm_runtime_forbid() from Documentation/power/runtime_pm.rst and update the kerneldoc comments of these functions to better explain their purpose. Link: https://lore.kernel.org/linux-pm/08976178-298f-79d9-1d63-cff5a4e56cc3@linux.intel.com/ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://patch.msgid.link/12780841.O9o76ZdvQC@rafael.j.wysocki
1 parent db82b8d commit cea54f8

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

Documentation/power/runtime_pm.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,6 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
480480
`bool pm_runtime_status_suspended(struct device *dev);`
481481
- return true if the device's runtime PM status is 'suspended'
482482

483-
`void pm_runtime_allow(struct device *dev);`
484-
- set the power.runtime_auto flag for the device and decrease its usage
485-
counter (used by the /sys/devices/.../power/control interface to
486-
effectively allow the device to be power managed at run time)
487-
488-
`void pm_runtime_forbid(struct device *dev);`
489-
- unset the power.runtime_auto flag for the device and increase its usage
490-
counter (used by the /sys/devices/.../power/control interface to
491-
effectively prevent the device from being power managed at run time)
492-
493483
`void pm_runtime_no_callbacks(struct device *dev);`
494484
- set the power.no_callbacks flag for the device and remove the runtime
495485
PM attributes from /sys/devices/.../power (or prevent them from being

drivers/base/power/runtime.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,9 +1664,12 @@ EXPORT_SYMBOL_GPL(devm_pm_runtime_get_noresume);
16641664
* pm_runtime_forbid - Block runtime PM of a device.
16651665
* @dev: Device to handle.
16661666
*
1667-
* Increase the device's usage count and clear its power.runtime_auto flag,
1668-
* so that it cannot be suspended at run time until pm_runtime_allow() is called
1669-
* for it.
1667+
* Resume @dev if already suspended and block runtime suspend of @dev in such
1668+
* a way that it can be unblocked via the /sys/devices/.../power/control
1669+
* interface, or otherwise by calling pm_runtime_allow().
1670+
*
1671+
* Calling this function many times in a row has the same effect as calling it
1672+
* once.
16701673
*/
16711674
void pm_runtime_forbid(struct device *dev)
16721675
{
@@ -1687,7 +1690,13 @@ EXPORT_SYMBOL_GPL(pm_runtime_forbid);
16871690
* pm_runtime_allow - Unblock runtime PM of a device.
16881691
* @dev: Device to handle.
16891692
*
1690-
* Decrease the device's usage count and set its power.runtime_auto flag.
1693+
* Unblock runtime suspend of @dev after it has been blocked by
1694+
* pm_runtime_forbid() (for instance, if it has been blocked via the
1695+
* /sys/devices/.../power/control interface), check if @dev can be
1696+
* suspended and suspend it in that case.
1697+
*
1698+
* Calling this function many times in a row has the same effect as calling it
1699+
* once.
16911700
*/
16921701
void pm_runtime_allow(struct device *dev)
16931702
{

0 commit comments

Comments
 (0)