Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Simplify a little. No functional change.
details: https://anonhg.NetBSD.org/src/rev/675e0eed399e
branches: trunk
changeset: 764234:675e0eed399e
user: jruoho <jruoho%NetBSD.org@localhost>
date: Thu Apr 14 07:06:52 2011 +0000
description:
Simplify a little. No functional change.
diffstat:
sys/dev/acpi/thinkpad_acpi.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diffs (93 lines):
diff -r ae40794e019f -r 675e0eed399e sys/dev/acpi/thinkpad_acpi.c
--- a/sys/dev/acpi/thinkpad_acpi.c Thu Apr 14 06:56:28 2011 +0000
+++ b/sys/dev/acpi/thinkpad_acpi.c Thu Apr 14 07:06:52 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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));
}
Home |
Main Index |
Thread Index |
Old Index