diff options
author | markus <markus@FreeBSD.org> | 2007-04-24 23:09:37 +0000 |
---|---|---|
committer | markus <markus@FreeBSD.org> | 2007-04-24 23:09:37 +0000 |
commit | ec4a19fefd12c15afc72b7596f41a03bfa2d269f (patch) | |
tree | 8299b3bd1690817d0361f5b22797057fe8cb0d22 /sys/dev/acpi_support/acpi_ibm.c | |
parent | f98690eabe7bc9093b1dea1146b7389b03ead106 (diff) | |
download | FreeBSD-src-ec4a19fefd12c15afc72b7596f41a03bfa2d269f.zip FreeBSD-src-ec4a19fefd12c15afc72b7596f41a03bfa2d269f.tar.gz |
Utilize led_create_state in order to preserve the status of the ThinkLight
on driver attach.
PR: kern/112044
Submitted by: Henrik Brix Andersen <henrik@brixandersen.dk>
Approved by: emax (mentor) (earlier version)
Diffstat (limited to 'sys/dev/acpi_support/acpi_ibm.c')
-rw-r--r-- | sys/dev/acpi_support/acpi_ibm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index fe4ea9b..6eee11f 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -412,7 +412,7 @@ acpi_ibm_attach(device_t dev) /* Hook up light to led(4) */ if (sc->light_set_supported) - sc->led_dev = led_create(ibm_led, sc, "thinklight"); + sc->led_dev = led_create_state(ibm_led, sc, "thinklight", sc->light_val); return (0); } @@ -810,7 +810,8 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method) case ACPI_IBM_METHOD_THINKLIGHT: sc->cmos_handle = NULL; - sc->light_get_supported = ACPI_SUCCESS(acpi_GetInteger(sc->ec_handle, IBM_NAME_KEYLIGHT, &dummy)); + sc->light_get_supported = ACPI_SUCCESS(acpi_GetInteger( + sc->ec_handle, IBM_NAME_KEYLIGHT, &sc->light_val)); if ((ACPI_SUCCESS(AcpiGetHandle(sc->handle, "\\UCMS", &sc->light_handle)) || ACPI_SUCCESS(AcpiGetHandle(sc->handle, "\\CMOS", &sc->light_handle)) || @@ -831,12 +832,15 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method) sc->light_set_supported = (sc->light_handle && ACPI_FAILURE(AcpiGetHandle(sc->ec_handle, "LEDB", &ledb_handle))); - if (sc->light_get_supported || sc->light_set_supported) { + if (sc->light_get_supported) + return (TRUE); + + if (sc->light_set_supported) { sc->light_val = 0; return (TRUE); } - else - return (FALSE); + + return (FALSE); case ACPI_IBM_METHOD_BLUETOOTH: case ACPI_IBM_METHOD_WLAN: |