Date: Fri, 24 Jul 2026 04:34:55 +0000 From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 490d561de6da - stable/15 - acpi: Constify thanks to AcpiGetHandle() taking a constant pathname Message-ID: <6a62eb6f.397b6.75c7e949@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=490d561de6da6d7508d9ef0084e70e85019c0804 commit 490d561de6da6d7508d9ef0084e70e85019c0804 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2026-06-03 20:30:22 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2026-07-24 04:33:26 +0000 acpi: Constify thanks to AcpiGetHandle() taking a constant pathname Make the ACPI interface's functions evaluate_object() and get_property() take a constant pathname (by substituting ACPI_STRING with 'const char *'). This allows to remove some __DECONST(). No functional change (intended). Reviewed by: obiwac Event: Halifax Hackathon 202606 Sponsored by: The FreeBSD Foundation Pull Request: https://github.com/OlCe2/freebsd-src/pull/8 (cherry picked from commit a12d069ef37fd60538b6f46372b194e6cf117250) --- sys/dev/acpica/acpi.c | 24 +++++++++--------------- sys/dev/acpica/acpi_if.m | 8 ++++---- sys/dev/acpica/acpivar.h | 6 +++--- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 0d3f1abeebe6..edaa2153b0c9 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1830,7 +1830,7 @@ acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **match) } static ACPI_STATUS -acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, +acpi_device_eval_obj(device_t bus, device_t dev, const char *pathname, ACPI_OBJECT_LIST *parameters, ACPI_BUFFER *ret) { ACPI_HANDLE h; @@ -1839,11 +1839,12 @@ acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, h = ACPI_ROOT_OBJECT; else if ((h = acpi_get_handle(dev)) == NULL) return (AE_BAD_PARAMETER); - return (AcpiEvaluateObject(h, pathname, parameters, ret)); + return (AcpiEvaluateObject(h, __DECONST(char *, pathname), parameters, + ret)); } static ACPI_STATUS -acpi_device_get_prop(device_t bus, device_t dev, ACPI_STRING propname, +acpi_device_get_prop(device_t bus, device_t dev, const char *propname, const ACPI_OBJECT **value) { const ACPI_OBJECT *pkg, *name, *val; @@ -1952,8 +1953,7 @@ acpi_bus_get_prop(device_t bus, device_t child, const char *propname, ACPI_STATUS status; const ACPI_OBJECT *obj; - status = acpi_device_get_prop(bus, child, __DECONST(char *, propname), - &obj); + status = acpi_device_get_prop(bus, child, propname, &obj); if (ACPI_FAILURE(status)) return (-1); @@ -1998,8 +1998,7 @@ acpi_bus_get_prop(device_t bus, device_t child, const char *propname, case ACPI_TYPE_PACKAGE: if (propvalue != NULL && size >= sizeof(ACPI_OBJECT *)) { - *((ACPI_OBJECT **) propvalue) = - __DECONST(ACPI_OBJECT *, obj); + *((const ACPI_OBJECT **) propvalue) = obj; } return (sizeof(ACPI_OBJECT *)); @@ -2682,7 +2681,7 @@ acpi_MatchHid(ACPI_HANDLE h, const char *hid) * or one if its parents. */ ACPI_STATUS -acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result) +acpi_GetHandleInScope(ACPI_HANDLE parent, const char *path, ACPI_HANDLE *result) { ACPI_HANDLE r; ACPI_STATUS status; @@ -2704,8 +2703,7 @@ acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result) } ACPI_STATUS -acpi_GetProperty(device_t dev, ACPI_STRING propname, - const ACPI_OBJECT **value) +acpi_GetProperty(device_t dev, const char *propname, const ACPI_OBJECT **value) { device_t bus = device_get_parent(dev); @@ -4076,14 +4074,10 @@ acpi_lookup(void *arg, const char *name, device_t *dev) * starts with '\'. We could restrict this to \_SB and friends, * but see acpi_probe_children() for notes on why we scan the entire * namespace for devices. - * - * XXX: The pathname argument to AcpiGetHandle() should be fixed to - * be const. */ if (name[0] != '\\') return; - if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, __DECONST(char *, name), - &handle))) + if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, name, &handle))) return; *dev = acpi_get_device(handle); } diff --git a/sys/dev/acpica/acpi_if.m b/sys/dev/acpica/acpi_if.m index 6b7a770f8812..b9960995a052 100644 --- a/sys/dev/acpica/acpi_if.m +++ b/sys/dev/acpica/acpi_if.m @@ -102,7 +102,7 @@ METHOD int id_probe { # device_t dev: evaluate the object relative to this device's handle. # Specify NULL to begin the search at the ACPI root. # -# ACPI_STRING pathname: absolute or relative path to this object +# const char *pathname: absolute or relative path to this object # # ACPI_OBJECT_LIST *parameters: array of arguments to pass to the object. # Specify NULL if there are none. @@ -115,7 +115,7 @@ METHOD int id_probe { METHOD ACPI_STATUS evaluate_object { device_t bus; device_t dev; - ACPI_STRING pathname; + const char *pathname; ACPI_OBJECT_LIST *parameters; ACPI_BUFFER *ret; }; @@ -127,7 +127,7 @@ METHOD ACPI_STATUS evaluate_object { # # device_t dev: find property for this device's handle. # -# const ACPI_STRING propname: name of the property +# const char *propname: name of the property # # const ACPI_OBJECT **value: property value output # Specify NULL if ignored @@ -137,7 +137,7 @@ METHOD ACPI_STATUS evaluate_object { METHOD ACPI_STATUS get_property { device_t bus; device_t dev; - ACPI_STRING propname; + const char *propname; const ACPI_OBJECT **value; }; diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 15738bbb1171..e73ba47d3255 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -382,9 +382,9 @@ typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *); BOOLEAN acpi_DeviceIsPresent(device_t dev); BOOLEAN acpi_BatteryIsPresent(device_t dev); -ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, +ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, const char *path, ACPI_HANDLE *result); -ACPI_STATUS acpi_GetProperty(device_t dev, ACPI_STRING propname, +ACPI_STATUS acpi_GetProperty(device_t dev, const char *propname, const ACPI_OBJECT **value); ACPI_BUFFER *acpi_AllocBuffer(int size); ACPI_STATUS acpi_ConvertBufferToInteger(ACPI_BUFFER *bufp, @@ -433,7 +433,7 @@ int acpi_MatchHid(ACPI_HANDLE h, const char *hid); #define ACPI_MATCHHID_CID 2 static __inline bool -acpi_HasProperty(device_t dev, ACPI_STRING propname) +acpi_HasProperty(device_t dev, const char *propname) { return ACPI_SUCCESS(acpi_GetProperty(dev, propname, NULL));home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a62eb6f.397b6.75c7e949>
