[Midnightbsd-cvs] src [7302] trunk/sys/dev/acpica/acpi_powerres.c: sync acpi_powerres code with freebsd 9 stable

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Sep 5 07:47:59 EDT 2015


Revision: 7302
          http://svnweb.midnightbsd.org/src/?rev=7302
Author:   laffer1
Date:     2015-09-05 07:47:59 -0400 (Sat, 05 Sep 2015)
Log Message:
-----------
sync acpi_powerres code with freebsd 9 stable

Modified Paths:
--------------
    trunk/sys/dev/acpica/acpi_powerres.c

Modified: trunk/sys/dev/acpica/acpi_powerres.c
===================================================================
--- trunk/sys/dev/acpica/acpi_powerres.c	2015-09-05 11:46:53 UTC (rev 7301)
+++ trunk/sys/dev/acpica/acpi_powerres.c	2015-09-05 11:47:59 UTC (rev 7302)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/dev/acpica/acpi_powerres.c 249132 2013-04-05 08:22:11Z mav $");
+__FBSDID("$FreeBSD: stable/9/sys/dev/acpica/acpi_powerres.c 267983 2014-06-27 20:57:12Z jhb $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -65,7 +65,6 @@
 /* Return values from _STA on a power resource */
 #define ACPI_PWR_OFF	0
 #define ACPI_PWR_ON	1
-#define ACPI_PWR_UNK	(-1)
 
 /* A relationship between a power resource and a consumer. */
 struct acpi_powerreference {
@@ -91,7 +90,6 @@
     ACPI_HANDLE				ap_resource;
     UINT64				ap_systemlevel;
     UINT64				ap_order;
-    int					ap_state;
 };
 
 static TAILQ_HEAD(acpi_powerresource_list, acpi_powerresource)
@@ -174,7 +172,6 @@
     }
     rp->ap_systemlevel = obj->PowerResource.SystemLevel;
     rp->ap_order = obj->PowerResource.ResourceOrder;
-    rp->ap_state = ACPI_PWR_UNK;
     
     /* Sort the resource into the list */
     status = AE_OK;
@@ -639,7 +636,6 @@
 	    continue;
 	}
 
-	/* We could cache this if we trusted it not to change under us */
 	status = acpi_GetInteger(rp->ap_resource, "_STA", &cur);
 	if (ACPI_FAILURE(status)) {
 	    ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get status of %s - %d\n",
@@ -646,8 +642,7 @@
 			      acpi_name(rp->ap_resource), status));
 	    /* XXX is this correct?  Always switch if in doubt? */
 	    continue;
-	} else if (rp->ap_state == ACPI_PWR_UNK)
-	    rp->ap_state = cur;
+	}
 
 	/*
 	 * Switch if required.  Note that we ignore the result of the switch
@@ -654,7 +649,7 @@
 	 * effort; we don't know what to do if it fails, so checking wouldn't
 	 * help much.
 	 */
-	if (rp->ap_state != ACPI_PWR_ON) {
+	if (cur != ACPI_PWR_ON) {
 	    status = AcpiEvaluateObject(rp->ap_resource, "_ON", NULL, NULL);
 	    if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
@@ -662,7 +657,6 @@
 				 acpi_name(rp->ap_resource),
 				 AcpiFormatException(status)));
 	    } else {
-		rp->ap_state = ACPI_PWR_ON;
 		ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "switched %s on\n",
 				 acpi_name(rp->ap_resource)));
 	    }
@@ -683,7 +677,6 @@
 	    continue;
 	}
 
-	/* We could cache this if we trusted it not to change under us */
 	status = acpi_GetInteger(rp->ap_resource, "_STA", &cur);
 	if (ACPI_FAILURE(status)) {
 	    ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get status of %s - %d\n",
@@ -690,8 +683,7 @@
 			      acpi_name(rp->ap_resource), status));
 	    /* XXX is this correct?  Always switch if in doubt? */
 	    continue;
-	} else if (rp->ap_state == ACPI_PWR_UNK)
-	    rp->ap_state = cur;
+	}
 
 	/*
 	 * Switch if required.  Note that we ignore the result of the switch
@@ -698,7 +690,7 @@
 	 * effort; we don't know what to do if it fails, so checking wouldn't
 	 * help much.
 	 */
-	if (rp->ap_state != ACPI_PWR_OFF) {
+	if (cur != ACPI_PWR_OFF) {
 	    status = AcpiEvaluateObject(rp->ap_resource, "_OFF", NULL, NULL);
 	    if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
@@ -706,7 +698,6 @@
 				 acpi_name(rp->ap_resource),
 				 AcpiFormatException(status)));
 	    } else {
-		rp->ap_state = ACPI_PWR_OFF;
 		ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "switched %s off\n",
 				 acpi_name(rp->ap_resource)));
 	    }



More information about the Midnightbsd-cvs mailing list