Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jul 2025 17:38:58 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 21cb44bf33f1 - main - LinuxKPI: acpi: fix guid_t argument type
Message-ID:  <202507311738.56VHcwDT015135@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=21cb44bf33f137eaab1ff6f9287c6bc8c27677f0

commit 21cb44bf33f137eaab1ff6f9287c6bc8c27677f0
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-07-31 00:42:15 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-07-31 17:37:53 +0000

    LinuxKPI: acpi: fix guid_t argument type
    
    acpi_check_dsm() and acpi_evaluate_dsm_typed() take a guid_t argument
    and not a char *.  For in-tree Linux based drivers this leads to a
    compile error due to a warning.  Fix the function argument type and
    cast internally.
    
    While this made the long statements in the wrapper functions for *_dsm_*
    even less readable split them up using a local variable.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D51649
---
 sys/compat/linuxkpi/common/include/acpi/acpi_bus.h |  4 ++--
 sys/compat/linuxkpi/common/src/linux_acpi.c        | 24 ++++++++++++++--------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h b/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h
index 47195e7d66a6..da50d25a63bb 100644
--- a/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h
+++ b/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h
@@ -45,9 +45,9 @@ struct acpi_bus_event {
 	lkpi_acpi_dev_get_first_match_dev(__VA_ARGS__)
 
 ACPI_HANDLE	bsd_acpi_get_handle(device_t bsddev);
-bool		acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev,
+bool		acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev,
 		    uint64_t funcs);
-ACPI_OBJECT *	acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid,
+ACPI_OBJECT *	acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid,
 		    int rev, int func, ACPI_OBJECT *argv4,
 		    ACPI_OBJECT_TYPE type);
 int		register_acpi_notifier(struct notifier_block *nb);
diff --git a/sys/compat/linuxkpi/common/src/linux_acpi.c b/sys/compat/linuxkpi/common/src/linux_acpi.c
index d18c69d9210d..43783bb8727b 100644
--- a/sys/compat/linuxkpi/common/src/linux_acpi.c
+++ b/sys/compat/linuxkpi/common/src/linux_acpi.c
@@ -72,8 +72,9 @@ bsd_acpi_get_handle(device_t bsddev)
 }
 
 bool
-acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, uint64_t funcs)
+acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, uint64_t funcs)
 {
+	UINT64 ret;
 
 	if (funcs == 0)
 		return (false);
@@ -87,17 +88,20 @@ acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, uint64_t funcs)
 	 */
 	funcs |= 1 << 0;
 
-	return ((acpi_DSMQuery(handle, uuid, rev) & funcs) == funcs);
+	ret = acpi_DSMQuery(handle, (const uint8_t *)uuid, rev);
+	return ((ret & funcs) == funcs);
 }
 
 ACPI_OBJECT *
-acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev,
+acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid, int rev,
     int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type)
 {
 	ACPI_BUFFER buf;
+	ACPI_STATUS status;
 
-	return (ACPI_SUCCESS(acpi_EvaluateDSMTyped(handle, uuid, rev, func,
-	    argv4, &buf, type)) ? (ACPI_OBJECT *)buf.Pointer : NULL);
+	status = acpi_EvaluateDSMTyped(handle, (const uint8_t *)uuid, rev, func,
+	    argv4, &buf, type);
+	return (ACPI_SUCCESS(status) ? (ACPI_OBJECT *)buf.Pointer : NULL);
 }
 
 union linuxkpi_acpi_object *
@@ -105,9 +109,11 @@ acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid,
     UINT64 rev, UINT64 func, union linuxkpi_acpi_object *pkg)
 {
 	ACPI_BUFFER buf;
+	ACPI_STATUS status;
 
-	return (ACPI_SUCCESS(acpi_EvaluateDSM(ObjHandle, (const uint8_t *)guid,
-	    rev, func, (ACPI_OBJECT *)pkg, &buf)) ?
+	status = acpi_EvaluateDSM(ObjHandle, (const uint8_t *)guid, rev, func,
+	    (ACPI_OBJECT *)pkg, &buf);
+	return (ACPI_SUCCESS(status) ?
 	    (union linuxkpi_acpi_object *)buf.Pointer : NULL);
 }
 
@@ -323,13 +329,13 @@ bsd_acpi_get_handle(device_t bsddev)
 }
 
 bool
-acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, uint64_t funcs)
+acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, uint64_t funcs)
 {
 	return (false);
 }
 
 ACPI_OBJECT *
-acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev,
+acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid, int rev,
      int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type)
 {
 	return (NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507311738.56VHcwDT015135>