Module Name: src Committed By: jmcneill Date: Sun Jan 9 14:28:23 UTC 2022
Modified Files: src/sys/dev/acpi: acpi_util.c acpi_util.h Log Message: acpi: Add acpi_dsd_bool helper To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/acpi_util.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/acpi_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi_util.c diff -u src/sys/dev/acpi/acpi_util.c:1.29 src/sys/dev/acpi/acpi_util.c:1.30 --- src/sys/dev/acpi/acpi_util.c:1.29 Fri Dec 31 13:15:00 2021 +++ src/sys/dev/acpi/acpi_util.c Sun Jan 9 14:28:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_util.c,v 1.29 2021/12/31 13:15:00 jmcneill Exp $ */ +/* $NetBSD: acpi_util.c,v 1.30 2022/01/09 14:28:23 jmcneill Exp $ */ /*- * Copyright (c) 2003, 2007, 2021 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.29 2021/12/31 13:15:00 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.30 2022/01/09 14:28:23 jmcneill Exp $"); #include <sys/param.h> #include <sys/kmem.h> @@ -1018,6 +1018,19 @@ acpi_dsd_string(ACPI_HANDLE handle, cons return rv; } +ACPI_STATUS +acpi_dsd_bool(ACPI_HANDLE handle, const char *prop, bool *val) +{ + ACPI_STATUS rv; + ACPI_INTEGER ival; + + rv = acpi_dsd_integer(handle, prop, &ival); + if (ACPI_SUCCESS(rv)) { + *val = ival != 0; + } + + return rv; +} /* Index: src/sys/dev/acpi/acpi_util.h diff -u src/sys/dev/acpi/acpi_util.h:1.11 src/sys/dev/acpi/acpi_util.h:1.12 --- src/sys/dev/acpi/acpi_util.h:1.11 Fri Feb 5 17:12:43 2021 +++ src/sys/dev/acpi/acpi_util.h Sun Jan 9 14:28:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_util.h,v 1.11 2021/02/05 17:12:43 thorpej Exp $ */ +/* $NetBSD: acpi_util.h,v 1.12 2022/01/09 14:28:23 jmcneill Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -98,6 +98,7 @@ char *acpi_pack_compat_list(ACPI_DEVICE ACPI_STATUS acpi_dsd_integer(ACPI_HANDLE, const char *, ACPI_INTEGER *); ACPI_STATUS acpi_dsd_string(ACPI_HANDLE, const char *, char **); +ACPI_STATUS acpi_dsd_bool(ACPI_HANDLE, const char *, bool *); ACPI_STATUS acpi_dsm(ACPI_HANDLE, uint8_t *, ACPI_INTEGER, ACPI_INTEGER, const ACPI_OBJECT *, ACPI_OBJECT **);