Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jun 2022 13:01:15 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: 945eaca155fc - main - ACPI: change arguments to internal acpi_find_dsd()
Message-ID:  <202206281301.25SD1FeA049650@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=945eaca155fc0d48da8d11fc41b8b00f17254d90

commit 945eaca155fc0d48da8d11fc41b8b00f17254d90
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-06-23 00:17:14 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-06-28 12:57:04 +0000

    ACPI: change arguments to internal acpi_find_dsd()
    
    acpi_find_dsd() is not a bus function and we only need the acpi_device (ad).
    The only caller has already looked up the ad (from ivars) for us.
    Directly pass the ad to acpi_find_dsd() instead of bus, dev and remove
    the extra call to device_get_ivars(); the changed argument also means we
    now call AcpiEvaluateObject directly on the handle.
    
    This optimisation was done a while ago while debugging a driver which
    ended up with a bad bus, dev combination making the old version fail.
    
    MFC after:      2 weeks
    Reviewed by:    mw
    Differential Revision: https://reviews.freebsd.org/D35558
---
 sys/dev/acpica/acpi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 2488e5aa83f0..37d7b88811a6 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -156,7 +156,7 @@ static ACPI_STATUS acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level,
 		    void *context, void **retval);
 static ACPI_STATUS acpi_device_scan_children(device_t bus, device_t dev,
 		    int max_depth, acpi_scan_cb_t user_fn, void *arg);
-static ACPI_STATUS acpi_find_dsd(device_t bus, device_t dev);
+static ACPI_STATUS acpi_find_dsd(struct acpi_device *ad);
 static int	acpi_isa_pnp_probe(device_t bus, device_t child,
 		    struct isa_pnp_id *ids);
 static void	acpi_platform_osc(device_t dev);
@@ -1864,7 +1864,7 @@ acpi_device_get_prop(device_t bus, device_t dev, ACPI_STRING propname,
 		return (AE_BAD_PARAMETER);
 	if (ad->dsd_pkg == NULL) {
 		if (ad->dsd.Pointer == NULL) {
-			status = acpi_find_dsd(bus, dev);
+			status = acpi_find_dsd(ad);
 			if (ACPI_FAILURE(status))
 				return (status);
 		} else {
@@ -1893,18 +1893,16 @@ acpi_device_get_prop(device_t bus, device_t dev, ACPI_STRING propname,
 }
 
 static ACPI_STATUS
-acpi_find_dsd(device_t bus, device_t dev)
+acpi_find_dsd(struct acpi_device *ad)
 {
 	const ACPI_OBJECT *dsd, *guid, *pkg;
-	struct acpi_device *ad;
 	ACPI_STATUS status;
 
-	ad = device_get_ivars(dev);
 	ad->dsd.Length = ACPI_ALLOCATE_BUFFER;
 	ad->dsd.Pointer = NULL;
 	ad->dsd_pkg = NULL;
 
-	status = ACPI_EVALUATE_OBJECT(bus, dev, "_DSD", NULL, &ad->dsd);
+	status = AcpiEvaluateObject(ad->ad_handle, "_DSD", NULL, &ad->dsd);
 	if (ACPI_FAILURE(status))
 		return (status);
 



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