svn commit: r209065 - head/sys/dev/acpica
Jung-uk Kim
jkim at FreeBSD.org
Fri Jun 11 19:58:41 UTC 2010
Author: jkim
Date: Fri Jun 11 19:58:41 2010
New Revision: 209065
URL: http://svn.freebsd.org/changeset/base/209065
Log:
Simplify a function for getting brightness levels.
Modified:
head/sys/dev/acpica/acpi_video.c
Modified: head/sys/dev/acpica/acpi_video.c
==============================================================================
--- head/sys/dev/acpica/acpi_video.c Fri Jun 11 19:53:42 2010 (r209064)
+++ head/sys/dev/acpica/acpi_video.c Fri Jun 11 19:58:41 2010 (r209065)
@@ -944,39 +944,34 @@ vo_get_brightness_levels(ACPI_HANDLE han
if (status != AE_NOT_FOUND)
printf("can't evaluate %s._BCL - %s\n",
acpi_name(handle), AcpiFormatException(status));
- num = -1;
goto out;
}
res = (ACPI_OBJECT *)bcl_buf.Pointer;
if (!ACPI_PKG_VALID(res, 2)) {
printf("evaluation of %s._BCL makes no sense\n",
acpi_name(handle));
- num = -1;
goto out;
}
num = res->Package.Count;
- if (levelp == NULL)
+ if (num < 2 || levelp == NULL)
goto out;
levels = AcpiOsAllocate(num * sizeof(*levels));
- if (levels == NULL) {
- num = -1;
+ if (levels == NULL)
goto out;
- }
for (i = 0, n = 0; i < num; i++)
if (acpi_PkgInt32(res, i, &levels[n]) == 0)
n++;
if (n < 2) {
- num = -1;
AcpiOsFree(levels);
- } else {
- num = n;
- *levelp = levels;
+ goto out;
}
+ *levelp = levels;
+ return (n);
+
out:
if (bcl_buf.Pointer != NULL)
AcpiOsFree(bcl_buf.Pointer);
-
- return (num);
+ return (0);
}
static int
More information about the svn-src-all
mailing list