pm_runtime_get_conditional(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– pm_runtime_get_conditional(9) πŸ’–

okay so bestie, welcome to the pm_runtime_get_conditional(9) page from the Kernel API Manual 🫢✨ This one is lowkey all about conditionally bumping a device’s usage counter, and the way that one tiny counter controls suspend vibes is honestly iconic πŸ’…

🌸 NAME 🌸

pm_runtime_get_conditional β€” Conditionally bump up device usage counter. πŸ’–

✨ SYNOPSIS ✨

int pm_runtime_get_conditional (struct device *dev , bool
       ign_usage_count );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” Device to handle. 🫢
  • ign_usage_count β€” Whether or not to look at the current usage counter value. πŸ‘€

πŸ¦‹ DESCRIPTION πŸ¦‹

If runtime PM is disabled for dev, it returns -EINVAL β€” yes, that’s the vibe-check fail πŸ˜­πŸ’€

Otherwise, if its runtime PM status is RPM_ACTIVE and any one of these is true:

  1. ign_usage_count is set.
  2. dev is not ignoring children and its active child count is nonzero.
  3. the runtime PM usage counter of dev is not zero.

then it increments the usage counter of dev and returns 1 πŸ”₯ periodt πŸ‘‘

Otherwise, it returns 0 and does not change the usage counter. no cap πŸ™ˆβœ¨

If ign_usage_count is true, this function can be used to prevent suspending the device when its runtime PM status is RPM_ACTIVE. πŸ’…

If ign_usage_count is false, this function can be used to prevent suspending the device when both its runtime PM status is RPM_ACTIVE and its runtime PM usage counter is not zero. πŸ¦‹

bestie, this part is literally important: the caller is responsible for decrementing the runtime PM usage counter of dev after this function has returned a positive value for it. not optional, fr fr 🫢

🌈 SEE ALSO 🌈

okay the cross-ref list is long but we are not skipping a single one, iykyk πŸ‘‘βœ¨

Catch you later, bestie πŸ’– β€” this one’s filed under source/version ./drivers/base/power, dated October 2026, and signed pm_runtime_get_conditional(9) from the Kernel API Manual. Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from