Module Name:    src
Committed By:   jruoho
Date:           Thu Apr 14 07:06:53 UTC 2011

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

Log Message:
Simplify a little. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/acpi/thinkpad_acpi.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/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.36 src/sys/dev/acpi/thinkpad_acpi.c:1.37
--- src/sys/dev/acpi/thinkpad_acpi.c:1.36	Thu Apr 14 06:37:13 2011
+++ src/sys/dev/acpi/thinkpad_acpi.c	Thu Apr 14 07:06:52 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.37 2011/04/14 07:06:52 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.37 2011/04/14 07:06:52 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -54,7 +54,6 @@
 	struct acpi_devnode	*sc_node;
 	ACPI_HANDLE		sc_powhdl;
 	ACPI_HANDLE		sc_cmoshdl;
-	bool			sc_cmoshdl_valid;
 
 #define	TP_PSW_SLEEP		0
 #define	TP_PSW_HIBERNATE	1
@@ -174,21 +173,13 @@
 
 	sc->sc_dev = self;
 	sc->sc_powhdl = NULL;
+	sc->sc_cmoshdl = NULL;
 	sc->sc_node = aa->aa_node;
 	sc->sc_display_state = THINKPAD_DISPLAY_LCD;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	/* T61 uses \UCMS method for issuing CMOS commands */
-	rv = AcpiGetHandle(NULL, "\\UCMS", &sc->sc_cmoshdl);
-	if (ACPI_FAILURE(rv))
-		sc->sc_cmoshdl_valid = false;
-	else {
-		aprint_debug_dev(self, "using CMOS at \\UCMS\n");
-		sc->sc_cmoshdl_valid = true;
-	}
-
 	sc->sc_ecdev = NULL;
 	for (curdev = deviter_first(&di, DEVITER_F_ROOT_FIRST);
 	     curdev != NULL; curdev = deviter_next(&di))
@@ -222,6 +213,11 @@
 	(void)acpi_register_notify(sc->sc_node, thinkpad_notify_handler);
 
 	/*
+	 * Obtain a handle for CMOS commands. This is used by T61.
+	 */
+	(void)AcpiGetHandle(NULL, "\\UCMS", &sc->sc_cmoshdl);
+
+	/*
 	 * Obtain a handle to the power resource available on many models.
 	 * Since pmf(9) is not yet integrated with the ACPI power resource
 	 * code, this must be turned on manually upon resume. Otherwise the
@@ -614,6 +610,7 @@
 
 	if (thinkpad_brightness_read(sc) == 7)
 		return;
+
 	thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_UP);
 }
 
@@ -624,6 +621,7 @@
 
 	if (thinkpad_brightness_read(sc) == 0)
 		return;
+
 	thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_DOWN);
 }
 
@@ -632,12 +630,13 @@
 {
 	ACPI_STATUS rv;
 
-	if (sc->sc_cmoshdl_valid == false)
+	if (sc->sc_cmoshdl == NULL)
 		return;
 
 	rv = acpi_eval_set_integer(sc->sc_cmoshdl, NULL, cmd);
+
 	if (ACPI_FAILURE(rv))
-		aprint_error_dev(sc->sc_dev, "couldn't evalute CMOS: %s\n",
+		aprint_error_dev(sc->sc_dev, "couldn't evaluate CMOS: %s\n",
 		    AcpiFormatException(rv));
 }
 

Reply via email to