git: bde56c994264 - acpi_wmi(4): Allow attachment to ACPI node if EC is not found

Vladimir Kondratyev wulf at FreeBSD.org
Wed Dec 23 08:11:56 UTC 2020


The branch main has been updated by wulf:

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

commit bde56c99426431c6319afd35c2a3cd66e315034a
Author:     Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2020-12-21 15:48:50 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2020-12-23 08:10:53 +0000

    acpi_wmi(4): Allow attachment to ACPI node if EC is not found
    
    Conducted tests showed that Embedded Controller is not mandatory for
    WMI extensions to work.
    
    Reported-by:    yuripv
    Reviewed-by:    avg
    MFC-after:      2 weeks
    Differential-Revision:  https://reviews.freebsd.org/D27653
---
 sys/dev/acpi_support/acpi_wmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c
index 379cfd1705f1..efae96cdcc9a 100644
--- a/sys/dev/acpi_support/acpi_wmi.c
+++ b/sys/dev/acpi_support/acpi_wmi.c
@@ -246,7 +246,7 @@ acpi_wmi_attach(device_t dev)
 	if ((sc->ec_dev = devclass_get_device(devclass_find("acpi_ec"), 0))
 	    == NULL)
 		device_printf(dev, "cannot find EC device\n");
-	else if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle,
+	if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle,
 		    ACPI_DEVICE_NOTIFY, acpi_wmi_notify_handler, sc))))
 		device_printf(sc->wmi_dev, "couldn't install notify handler - %s\n",
 		    AcpiFormatException(status));
@@ -701,6 +701,8 @@ acpi_wmi_ec_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address,
 		return (AE_BAD_PARAMETER);
 	if (address + (width / 8) - 1 > 0xFF)
 		return (AE_BAD_ADDRESS);
+	if (sc->ec_dev == NULL)
+		return (AE_NOT_FOUND);
 	if (function == ACPI_READ)
 		*value = 0;
 	ec_addr = address;


More information about the dev-commits-src-all mailing list