The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=554a459ff59969e0f66b1b1c6695d249e2eecd84
commit 554a459ff59969e0f66b1b1c6695d249e2eecd84 Author: Olivier Certner <[email protected]> AuthorDate: 2026-06-17 03:03:20 +0000 Commit: Olivier Certner <[email protected]> CommitDate: 2026-06-17 03:06:22 +0000 acpi: Constify acpi_stype_to_sstate() and some users Reviewed by: obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57413 --- sys/dev/acpica/acpi.c | 14 ++++++++------ sys/kern/subr_power.c | 2 +- sys/sys/power.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 75cb99d2cdfe..9a85a0844de6 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -197,7 +197,8 @@ static int acpi_suspend_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_stype_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS); -static int acpi_stype_to_sstate(struct acpi_softc *sc, enum power_stype stype); +static int acpi_stype_to_sstate(const struct acpi_softc *const sc, + const enum power_stype stype); static int acpi_pm_func(u_long cmd, void *arg, enum power_stype stype); static void acpi_enable_pcie(void); static void acpi_reset_interfaces(device_t dev); @@ -808,7 +809,8 @@ acpi_attach(device_t dev) } static int -acpi_stype_to_sstate(struct acpi_softc *sc, enum power_stype stype) +acpi_stype_to_sstate(const struct acpi_softc *const sc, + const enum power_stype stype) { switch (stype) { case POWER_STYPE_AWAKE: @@ -2160,7 +2162,7 @@ acpi_device_pwr_for_sleep_sxd(device_t dev, ACPI_HANDLE handle, int state, int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) { - struct acpi_softc *sc = device_get_softc(bus); + const struct acpi_softc *const sc = device_get_softc(bus); ACPI_HANDLE handle = acpi_get_handle(dev); int state; @@ -3846,7 +3848,7 @@ acpi_wake_set_enable(device_t dev, int enable) } static int -acpi_wake_sleep_prep(struct acpi_softc *sc, ACPI_HANDLE handle, +acpi_wake_sleep_prep(struct acpi_softc *const sc, ACPI_HANDLE handle, enum power_stype stype) { int sstate; @@ -3884,7 +3886,7 @@ acpi_wake_sleep_prep(struct acpi_softc *sc, ACPI_HANDLE handle, } static int -acpi_wake_run_prep(struct acpi_softc *sc, ACPI_HANDLE handle, +acpi_wake_run_prep(struct acpi_softc *const sc, ACPI_HANDLE handle, enum power_stype stype) { int sstate; @@ -4557,7 +4559,7 @@ acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS) static int acpi_suspend_state_sysctl(SYSCTL_HANDLER_ARGS) { - struct acpi_softc *const sc = oidp->oid_arg1; + const struct acpi_softc *const sc = oidp->oid_arg1; const enum power_stype old_stype = power_suspend_stype; enum power_stype new_stype; int old_sstate = acpi_stype_to_sstate(sc, old_stype); diff --git a/sys/kern/subr_power.c b/sys/kern/subr_power.c index 1cfa6e5c77dd..5c1f6283caff 100644 --- a/sys/kern/subr_power.c +++ b/sys/kern/subr_power.c @@ -191,7 +191,7 @@ power_pm_deferred_fn(void *arg, int pending) int power_pm_register(u_int pm_type, power_pm_fn_t pm_fn, void *pm_arg, - bool pm_supported[static POWER_STYPE_COUNT]) + const bool pm_supported[static POWER_STYPE_COUNT]) { int error; diff --git a/sys/sys/power.h b/sys/sys/power.h index b2d49781d359..c9439d89db20 100644 --- a/sys/sys/power.h +++ b/sys/sys/power.h @@ -107,7 +107,7 @@ extern const char *power_stype_to_name(enum power_stype _stype); typedef int (*power_pm_fn_t)(u_long _cmd, void* _arg, enum power_stype _stype); extern int power_pm_register(u_int _pm_type, power_pm_fn_t _pm_fn, void *_pm_arg, - bool _pm_supported[static POWER_STYPE_COUNT]); + const bool _pm_supported[static POWER_STYPE_COUNT]); extern u_int power_pm_get_type(void); extern int power_pm_suspend(enum power_transition _trans);
