Module Name:    src
Committed By:   jruoho
Date:           Thu Apr 15 04:03:39 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi.c acpi_util.c

Log Message:
Arrange some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.173 src/sys/dev/acpi/acpi.c:1.174
--- src/sys/dev/acpi/acpi.c:1.173	Wed Apr 14 19:27:28 2010
+++ src/sys/dev/acpi/acpi.c	Thu Apr 15 04:03:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.173 2010/04/14 19:27:28 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.174 2010/04/15 04:03:38 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.173 2010/04/14 19:27:28 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.174 2010/04/15 04:03:38 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -325,7 +325,6 @@
 	 */
 	return 1;
 
-
 fail:
 	KASSERT(rv != AE_OK);
 	KASSERT(func != NULL);
@@ -345,6 +344,9 @@
 	return (config_search_ia(acpi_submatch, parent, ifattr, NULL) != NULL);
 }
 
+/*
+ * Autoconfiguration.
+ */
 static int
 acpi_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -408,9 +410,6 @@
 
 	acpi_softc = sc;
 
-	/*
-	 * Register null power management handler.
-	 */
 	if (pmf_device_register(self, acpi_suspend, acpi_resume) != true)
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
@@ -440,7 +439,9 @@
 	if (ACPI_FAILURE(rv))
 		goto fail;
 
-	/* Early EC handler initialization if ECDT table is available. */
+	/*
+	 * Early EC handler initialization if ECDT table is available.
+	 */
 	config_found_ia(self, "acpiecdtbus", aa, NULL);
 
 	rv = AcpiInitializeObjects(ACPI_FULL_INITIALIZATION);
@@ -760,8 +761,8 @@
 			xirq = (ACPI_RESOURCE_EXTENDED_IRQ *)&resn->Data;
 #if 0
 			/*
-			 * XXX not duplicating the interrupt logic above
-			 * because its not clear what it accomplishes.
+			 * XXX:	Not duplicating the interrupt logic above
+			 *	because its not clear what it accomplishes.
 			 */
 			xirq->Interrupts[0] =
 			    ((ACPI_RESOURCE_EXT_IRQ *)&resp->Data)->
@@ -867,18 +868,14 @@
 		aa.aa_pciflags = sc->sc_pciflags;
 		aa.aa_ic = sc->sc_ic;
 
+		/*
+		 * XXX:	We only attach devices which are present, enabled, and
+		 *	functioning properly. However, if a device is enabled,
+		 *	it is decoding resources and we should claim these,
+		 *	if possible. This requires changes to bus_space(9).
+		 */
 		if (ad->ad_devinfo->Type == ACPI_TYPE_DEVICE) {
-			/*
-			 * XXX We only attach devices which are:
-			 *
-			 *	- present
-			 *	- enabled
-			 *	- functioning properly
-			 *
-			 * However, if enabled, it's decoding resources,
-			 * so we should claim them, if possible.
-			 * Requires changes to bus_space(9).
-			 */
+
 			if ((ad->ad_devinfo->Valid & ACPI_VALID_STA) ==
 			    ACPI_VALID_STA &&
 			    (ad->ad_devinfo->CurrentStatus &
@@ -890,10 +887,9 @@
 		}
 
 		/*
-		 * XXX Same problem as above...
-		 *
-		 * Do this check only for devices, as e.g.
-		 * a Thermal Zone doesn't have a HID.
+		 * XXX:	The same problem as above. As for example
+		 *	thermal zones and power resources do not
+		 *	have a valid HID, only evaluate devices.
 		 */
 		if (ad->ad_devinfo->Type == ACPI_TYPE_DEVICE &&
 		    (ad->ad_devinfo->Valid & ACPI_VALID_HID) == 0)

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.1 src/sys/dev/acpi/acpi_util.c:1.2
--- src/sys/dev/acpi/acpi_util.c:1.1	Wed Apr 14 17:12:14 2010
+++ src/sys/dev/acpi/acpi_util.c	Thu Apr 15 04:03:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.1 2010/04/14 17:12:14 jruoho Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.2 2010/04/15 04:03:39 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.1 2010/04/14 17:12:14 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.2 2010/04/15 04:03:39 jruoho Exp $");
 
 #include <sys/param.h>
 
@@ -76,9 +76,7 @@
 ACPI_MODULE_NAME		("acpi_util")
 
 /*
- * acpi_eval_integer:
- *
- *	Evaluate an integer object.
+ * Evaluate an integer object.
  */
 ACPI_STATUS
 acpi_eval_integer(ACPI_HANDLE handle, const char *path, ACPI_INTEGER *valp)
@@ -108,9 +106,7 @@
 }
 
 /*
- * acpi_eval_set_integer:
- *
- *	Evaluate an integer object with a single integer input parameter.
+ * Evaluate an integer object with a single integer input parameter.
  */
 ACPI_STATUS
 acpi_eval_set_integer(ACPI_HANDLE handle, const char *path, ACPI_INTEGER val)
@@ -131,9 +127,7 @@
 }
 
 /*
- * acpi_eval_string:
- *
- *	Evaluate a (Unicode) string object.
+ * Evaluate a (Unicode) string object.
  */
 ACPI_STATUS
 acpi_eval_string(ACPI_HANDLE handle, const char *path, char **stringp)
@@ -177,10 +171,7 @@
 }
 
 /*
- * acpi_eval_struct:
- *
- *	Evaluate a more complex structure.
- *	Caller must free buf.Pointer by ACPI_FREE().
+ * Evaluate a structure. Caller must free buf.Pointer by ACPI_FREE().
  */
 ACPI_STATUS
 acpi_eval_struct(ACPI_HANDLE handle, const char *path, ACPI_BUFFER *buf)
@@ -196,9 +187,7 @@
 }
 
 /*
- * acpi_eval_reference_handle:
- *
- *	Evaluate a reference handle from an element in a package.
+ * Evaluate a reference handle from an element in a package.
  */
 ACPI_STATUS
 acpi_eval_reference_handle(ACPI_OBJECT *elm, ACPI_HANDLE *handle)
@@ -228,11 +217,9 @@
 }
 
 /*
- * acpi_foreach_package_object:
- *
- *	Iterate over all objects in a package, and pass them all
- *	to a function. If the called function returns non-AE_OK,
- *	the iteration is stopped and that value is returned.
+ * Iterate over all objects in a package, and pass them all
+ * to a function. If the called function returns non-AE_OK,
+ * the iteration is stopped and that value is returned.
  */
 ACPI_STATUS
 acpi_foreach_package_object(ACPI_OBJECT *pkg,
@@ -256,10 +243,8 @@
 }
 
 /*
- * acpi_get:
- *
- *	Fetch data info the specified (empty) ACPI buffer.
- *	Caller must free buf.Pointer by ACPI_FREE().
+ * Fetch data info the specified (empty) ACPI buffer.
+ * Caller must free buf.Pointer by ACPI_FREE().
  */
 ACPI_STATUS
 acpi_get(ACPI_HANDLE handle, ACPI_BUFFER *buf,
@@ -273,13 +258,11 @@
 }
 
 /*
- * acpi_name:
+ * Return a complete pathname from a handle.
  *
- *	Return a complete pathname from a handle.
- *
- *	Note that the function uses static data storage;
- *	if the data is needed for future use, it should be
- *	copied before any subsequent calls overwrite it.
+ * Note that the function uses static data storage;
+ * if the data is needed for future use, it should be
+ * copied before any subsequent calls overwrite it.
  */
 const char *
 acpi_name(ACPI_HANDLE handle)
@@ -300,9 +283,7 @@
 }
 
 /*
- * acpi_match_hid:
- *
- *	Match given ids against _HID and _CIDs.
+ * Match given IDs against _HID and _CIDs.
  */
 int
 acpi_match_hid(ACPI_DEVICE_INFO *ad, const char * const *ids)

Reply via email to