/* Interrupts are disabled, just acquire the lock. */
spin_lock(&client->buffer_lock);
- wake_lock_timeout(&client->wake_lock, 5 * HZ);
client->buffer[client->head++] = *event;
client->head &= client->bufsize - 1;
client->buffer[client->tail].value = 0;
client->packet_head = client->tail;
+ wake_unlock(&client->wake_lock);
}
if (event->type == EV_SYN && event->code == SYN_REPORT) {
client->packet_head = client->head;
+ wake_lock_timeout(&client->wake_lock, 5 * HZ);
kill_fasync(&client->fasync, SIGIO, POLL_IN);
}
if (have_event) {
*event = client->buffer[client->tail++];
client->tail &= client->bufsize - 1;
- if (client->head == client->tail)
+ if (client->packet_head == client->tail)
wake_unlock(&client->wake_lock);
}