Date: Wed, 13 May 2026 12:39:40 +0000 From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: f77731ee95c1 - main - acpi_spmc(4): Introduce supports_function() Message-ID: <6a04710c.1973a.14acb230@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=f77731ee95c179cede7dec0e87bc8146a2c546bc commit f77731ee95c179cede7dec0e87bc8146a2c546bc Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2026-05-04 14:52:31 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2026-05-13 12:38:19 +0000 acpi_spmc(4): Introduce supports_function() For better readability and because this stance will be used in many more places in a subsequent commit. No functional change (intended). Reviewed by: imp (older version), obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56803 --- sys/dev/acpica/acpi_spmc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index e7f658dbcad0..a6b18767e91b 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -34,6 +34,9 @@ static char *spmc_ids[] = { NULL }; +/* Conversion of an index to a mask. */ +#define IDX_TO_BIT(idx) (1ull << (idx)) + enum intel_dsm_index { DSM_ENUM_FUNCTIONS = 0, DSM_GET_DEVICE_CONSTRAINTS = 1, @@ -172,6 +175,12 @@ struct acpi_spmc_softc { struct acpi_spmc_constraint *constraints; }; +static bool +supports_function(const struct dsm_desc *const dsm, const int function_index) +{ + return ((dsm->supported_functions & IDX_TO_BIT(function_index)) != 0); +} + static bool has_dsm(const struct acpi_spmc_softc *const sc, const int dsm_bit) { @@ -617,8 +626,7 @@ acpi_spmc_exit_notif(device_t dev) acpi_spmc_run_dsm(dev, &dsm_amd, AMD_DSM_EXIT_NOTIF); if (has_dsm(sc, DSM_MS)) { acpi_spmc_run_dsm(dev, &dsm_ms, DSM_EXIT_NOTIF); - if (dsm_ms.supported_functions & - (1 << DSM_MODERN_TURN_ON_DISPLAY)) + if (supports_function(&dsm_ms, DSM_MODERN_TURN_ON_DISPLAY)) acpi_spmc_run_dsm(dev, &dsm_ms, DSM_MODERN_TURN_ON_DISPLAY); acpi_spmc_run_dsm(dev, &dsm_ms, DSM_MODERN_EXIT_NOTIF);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a04710c.1973a.14acb230>
