Index: acpi_asus.c =================================================================== RCS file: /usr/repo/src/sys/dev/acpi_support/acpi_asus.c,v retrieving revision 1.21 diff -u -p -r1.21 acpi_asus.c --- acpi_asus.c 24 Mar 2005 21:07:55 -0000 1.21 +++ acpi_asus.c 30 Mar 2005 12:30:41 -0000 @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD: src/sys/dev/acpi_sup #include #include #include +#include #include "acpi.h" #include @@ -105,6 +106,14 @@ struct acpi_asus_softc { int s_lcd; }; +static struct acpi_asus_led_info { + struct acpi_asus_softc *sc; + char *method; + int state; + struct task task; + int busy; +} acpi_asus_led_ctx; + /* * We can identify Asus laptops from the string they return * as a result of calling the ATK0100 'INIT' method. @@ -400,6 +409,7 @@ acpi_asus_attach(device_t dev) } /* Attach leds */ + acpi_asus_led_ctx.busy = 0; if (sc->model->mled_set) { sc->s_mled.dev = dev; sc->s_mled.type = ACPI_ASUS_LED_MLED; @@ -461,6 +471,20 @@ acpi_asus_detach(device_t dev) } static void +acpi_asus_led_task(void *ctx __unused, int pending __unused) +{ + struct acpi_asus_softc *sc; + char *method; + int state; + + sc = acpi_asus_led_ctx.sc; + method = acpi_asus_led_ctx.method; + state = acpi_asus_led_ctx.state; + acpi_SetInteger(sc->handle, method, state); + acpi_asus_led_ctx.busy = 0; +} + +static void acpi_asus_led(struct acpi_asus_led *led, int state) { struct acpi_asus_softc *sc; @@ -489,7 +513,14 @@ acpi_asus_led(struct acpi_asus_led *led, return; } - acpi_SetInteger(sc->handle, method, state); + if (acpi_asus_led_ctx.busy) + return; + acpi_asus_led_ctx.sc = sc; + acpi_asus_led_ctx.method = method; + acpi_asus_led_ctx.state = state; + acpi_asus_led_ctx.busy = 1; + TASK_INIT(&acpi_asus_led_ctx.task, 0, acpi_asus_led_task, NULL); + taskqueue_enqueue(taskqueue_swi, &acpi_asus_led_ctx.task); } static int