Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Sep 2009 15:14:33 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r197487 - in stable/7/sys: . contrib/pf dev/acpi_support
Message-ID:  <200909251514.n8PFEXRK032225@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Sep 25 15:14:33 2009
New Revision: 197487
URL: http://svn.freebsd.org/changeset/base/197487

Log:
  MFC 197415:
  The elements in the component arrays may be direct Package objects rather
  than references to objects.  In that case, simply use the Package directly.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpi_support/acpi_aiboost.c

Modified: stable/7/sys/dev/acpi_support/acpi_aiboost.c
==============================================================================
--- stable/7/sys/dev/acpi_support/acpi_aiboost.c	Fri Sep 25 15:14:11 2009	(r197486)
+++ stable/7/sys/dev/acpi_support/acpi_aiboost.c	Fri Sep 25 15:14:33 2009	(r197487)
@@ -44,7 +44,6 @@ ACPI_MODULE_NAME("AIBOOST")
 
 #define DESCSTRLEN 32
 struct acpi_aiboost_element{
-	ACPI_HANDLE h;
 	uint32_t id;
 	char desc[DESCSTRLEN];
 };
@@ -125,22 +124,23 @@ static ACPI_STATUS acpi_aiboost_getcompo
 	
 	for(i = 1 ; i < o->Package.Count; i++){
 		elem = &o->Package.Elements[i];
-		if(elem->Type != ACPI_TYPE_ANY){
-			printf("NOREF\n");
-			goto error;
-		}
-		c->elem[ i - 1].h = elem->Reference.Handle;
-
-		buf2.Pointer = NULL;
-		buf2.Length = ACPI_ALLOCATE_BUFFER;
-		
-		status = AcpiEvaluateObject(c->elem[i - 1].h, NULL, NULL,
-					    &buf2);
-		if(ACPI_FAILURE(status)){
-			printf("FETCH OBJECT\n");
+		if (elem->Type == ACPI_TYPE_ANY) {
+			buf2.Pointer = NULL;
+			buf2.Length = ACPI_ALLOCATE_BUFFER;
+
+			status = AcpiEvaluateObject(elem->Reference.Handle,
+			    NULL, NULL, &buf2);
+			if (ACPI_FAILURE(status)){
+				printf("FETCH OBJECT\n");
+				goto error;
+			}
+			subobj = buf2.Pointer;
+		} else if (elem->Type == ACPI_TYPE_PACKAGE)
+			subobj = elem;
+		else {
+			printf("NO PACKAGE\n");
 			goto error;
 		}
-		subobj = buf2.Pointer;
 		if(ACPI_FAILURE(acpi_PkgInt32(subobj,0, &c->elem[i -1].id))){
 			printf("ID FAILED\n");
 			goto error;
@@ -149,15 +149,17 @@ static ACPI_STATUS acpi_aiboost_getcompo
 				     sizeof(c->elem[i - 1].desc));
 		if(ACPI_FAILURE(status)){
 			if(status == E2BIG){
-				c->elem[i-1].desc[DESCSTRLEN-1] = 0;
+				c->elem[i - 1].desc[DESCSTRLEN-1] = 0;
 			}else{
 				printf("DESC FAILED %d\n", i-1);
 				goto error;
 			}
 		}
 		
-		if(buf2.Pointer)
-		  AcpiOsFree(buf2.Pointer);
+		if (buf2.Pointer) {
+			AcpiOsFree(buf2.Pointer);
+			buf2.Pointer = NULL;
+		}
 	}
 
 	if(buf.Pointer)



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