acpi_pm_device_sleep_state(9)
π€ acpi_pm_device_sleep_state(9) β the Kernel API Manual tea ββ¨
okay so real talk, bestie: this is a page from the Kernel API Manual, and it's all about figuring out the preferred power state of an ACPI device. it's giving "nap time optimization" energy and honestly? we're obsessed. π
β¨ NAME β¨
acpi_pm_device_sleep_state β Get preferred power state of ACPI device. π
like, it literally just tells you what power state the device would prefer to snooze in. no cap.
πΈ SYNOPSIS πΈ
int acpi_pm_device_sleep_state (struct device *dev , int *d_min_p , int d_max_in );
look at her. three args, one int coming back. she's simple, she's iconic, she's the main character of ./drivers/acpi/device_pm.c. π¦
π«Ά ARGUMENTS π«Ά
devβ the Device whose preferred target power state to return. bestie in question. πd_min_pβ Location to store the upper limit of the allowed states range. yeah, it's a pointer, so it gets to hold the ceiling of the allowed range. lowkey important.d_max_inβ Deepest low-power state to take into consideration. Return value: Preferred power state of the device on success,-ENODEVif there's no 'struct acpi_device' fordev,-EINVALifd_max_inis incorrect, or-ENODATAon ACPI method failure. π so yeah, that whole return-value situation lives here, don't skip it, iykyk.
ok but fr, peep the error codes:-ENODEV= no 'struct acpi_device' fordev,-EINVAL=d_max_inis incorrect,-ENODATA= ACPI method failure. memorize them, they WILL show up. π
π DESCRIPTION π
The caller must ensure that dev is valid before using this function. π¨
that's it. that's the whole description. but it's a big deal, so let me say it again with my whole chest: the caller has to make sure dev is valid before using this function. don't come crying to the kernel when you hand it a garbage pointer, because it will not be cute. π not me warning you twice π
π SEE ALSO π
Kernel file ./drivers/acpi/device_pm.c β and the whole squad, because this function does not roll alone:
acpi_power_state_string(9)acpi_device_get_power(9)acpi_device_set_power(9)acpi_device_fix_up_power(9)acpi_device_fix_up_power_extended(9)acpi_device_fix_up_power_children(9)acpi_dev_power_up_children_with_adr(9)acpi_dev_power_state_for_wake(9)acpi_add_pm_notifier(9)acpi_remove_pm_notifier(9)acpi_dev_pm_get_state(9)acpi_pm_notify_work_func(9)acpi_device_wakeup_enable(9)acpi_device_wakeup_disable(9)acpi_pm_set_device_wakeup(9)acpi_dev_pm_low_power(9)acpi_dev_pm_full_power(9)acpi_dev_suspend(9)acpi_dev_resume(9)acpi_subsys_runtime_suspend(9)acpi_subsys_runtime_resume(9)acpi_subsys_prepare(9)acpi_subsys_complete(9)acpi_subsys_suspend(9)acpi_subsys_suspend_late(9)acpi_subsys_suspend_noirq(9)acpi_subsys_resume_noirq(9)acpi_subsys_resume_early(9)acpi_subsys_resume(9)acpi_subsys_freeze(9)acpi_subsys_restore_early(9)acpi_subsys_poweroff(9)acpi_subsys_poweroff_late(9)acpi_subsys_poweroff_noirq(9)acpi_dev_pm_detach(9)acpi_dev_pm_attach(9)acpi_storage_d3(9)acpi_dev_state_d0(9)
thirty-eight entries. thirty-eight!! she said "bring the whole friend group" and honestly? respect. π«Άβ¨
and that's the page, bestie β sourced from ./drivers/acpi, out of the Kernel API Manual, dated October 2026. slay, go read some kernel source, and remember: validate your dev. ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms