Page MenuHomeFreeBSD

sys/power.h: `enum power_sstate_transition`
ClosedPublic

Authored by obiwac on Sep 12 2025, 1:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 28, 3:20 AM
Unknown Object (File)
Sat, Jan 10, 4:46 PM
Unknown Object (File)
Sat, Jan 10, 4:31 PM
Unknown Object (File)
Dec 10 2025, 9:50 AM
Unknown Object (File)
Nov 29 2025, 1:02 AM
Unknown Object (File)
Nov 22 2025, 3:10 AM
Unknown Object (File)
Oct 29 2025, 1:44 AM
Unknown Object (File)
Oct 25 2025, 11:35 AM
Subscribers

Details

Summary

Turn POWER_SLEEP_STATE_* defines into enum power_sstate_transition.

Maybe I missed some places where just an int is being used for the sleep state, gonna look at this deeper later.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/sys/power.h
55–57

Is there a particular reason we'd want to explicitly set these values? Is it preferred style in FreeBSD to explicitly set these when an enum is used in an interface or something?

sys/dev/acpi_support/acpi_ibm.c
1454

Does this perhaps suggest that it isn't very useful in general to distinguish between SSTATE_TRANSITION_* and STYPE_*?

sys/sys/power.h
55–57

That's not necessary for internal kernel interfaces.

obiwac added inline comments.
sys/dev/acpi_support/acpi_ibm.c
1454

can you elaborate on in what way this suggests the distinction is not useful? Other places need to know if the suspend type is s2idle or s2mem, I just added this comment to note that the use of the name "IBM_EVENT_SUSPEND_TO_RAM" here doesn't necessarily mean s2mem, but could also be s2idle

Sorry for the delay. I think this is ok.

sys/dev/acpi_support/acpi_ibm.c
1454

I think I was wondering what things would look like if we had a suspend-to-disk implementation. Presumably you'd end up with both POWER_SSTATE_TRANSITION_SUSPEND_TO_DISK and POWER_SSTATE_TRANSITION_SUSPEND?

sys/sys/power.h
54

This should be removed before committing.

This revision is now accepted and ready to land.Thu, Feb 5, 2:20 PM
sys/dev/acpi_support/acpi_ibm.c
1454

you'd use POWER_SSTATE_TRANSITION_HIBERNATE for suspend-to-disk. I agree this is not the clearest thing ever considering "suspend" could also be understood to mean "suspend to disk", but these are the existing names for POWER_SSTATE_* anyway and I'm not really sure of a better nomenclature here.

This revision was automatically updated to reflect the committed changes.