On 19/05/18(Sat) 21:39, Mark Kettenis wrote: > Without the wakeup, the event doesn't get scheduled until some other > event wakes up the acpi thread. On one of my machines the gpio event > reads a status byte over i2c in repsonse of a gpio event. Without the > wakeup that status byte has often been cleared/overwritten by the time > the event gets scheduled. > > ok?
ok mpi@ Then why not make acpi_addtask() call acpi_wakeup() if it could enqueue a task? This is how task_add(9) work. Most of the code paths already use the pattern your suggesting. > Index: acpi.c > =================================================================== > RCS file: /cvs/src/sys/dev/acpi/acpi.c,v > retrieving revision 1.343 > diff -u -p -r1.343 acpi.c > --- acpi.c 17 May 2018 20:46:45 -0000 1.343 > +++ acpi.c 19 May 2018 19:35:59 -0000 > @@ -861,6 +861,7 @@ acpi_gpio_event(void *arg) > struct acpi_gpio_event *ev = arg; > > acpi_addtask(acpi_softc, acpi_gpio_event_task, ev->node, ev->pin); > + acpi_wakeup(acpi_softc); > return 1; > } > >