Author: avg
Date: Thu Dec 20 08:45:41 2018
New Revision: 342278
URL: https://svnweb.freebsd.org/changeset/base/342278

Log:
  MFC r341632: acpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour
  
  Specifically, assume that the device is present if evaluation of _STA
  method fails.
  
  PR:           227191

Modified:
  stable/12/sys/dev/acpica/acpi.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/acpica/acpi.c
==============================================================================
--- stable/12/sys/dev/acpica/acpi.c     Thu Dec 20 08:33:11 2018        
(r342277)
+++ stable/12/sys/dev/acpica/acpi.c     Thu Dec 20 08:45:41 2018        
(r342278)
@@ -2219,8 +2219,6 @@ acpi_DeviceIsPresent(device_t dev)
        h = acpi_get_handle(dev);
        if (h == NULL)
                return (FALSE);
-       status = acpi_GetInteger(h, "_STA", &s);
-
        /*
         * Onboard serial ports on certain AMD motherboards have an invalid _STA
         * method that always returns 0.  Force them to always be treated as 
present.
@@ -2230,9 +2228,14 @@ acpi_DeviceIsPresent(device_t dev)
        if (acpi_MatchHid(h, "AMDI0020") || acpi_MatchHid(h, "AMDI0010"))
                return (TRUE);
 
-       /* If no _STA method, must be present */
+       status = acpi_GetInteger(h, "_STA", &s);
+
+       /*
+        * If no _STA method or if it failed, then assume that
+        * the device is present.
+        */
        if (ACPI_FAILURE(status))
-               return (status == AE_NOT_FOUND ? TRUE : FALSE);
+               return (TRUE);
 
        return (ACPI_DEVICE_PRESENT(s) ? TRUE : FALSE);
 }
@@ -2252,9 +2255,12 @@ acpi_BatteryIsPresent(device_t dev)
                return (FALSE);
        status = acpi_GetInteger(h, "_STA", &s);
 
-       /* If no _STA method, must be present */
+       /*
+        * If no _STA method or if it failed, then assume that
+        * the device is present.
+        */
        if (ACPI_FAILURE(status))
-               return (status == AE_NOT_FOUND ? TRUE : FALSE);
+               return (TRUE);
 
        return (ACPI_BATTERY_PRESENT(s) ? TRUE : FALSE);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to