tty: remove tty event queues

This commit is contained in:
2023-06-11 19:00:55 +01:00
parent a7c28e983c
commit cdb9fef36c
4 changed files with 13 additions and 57 deletions

View File

@@ -92,34 +92,12 @@ kern_status_t tty_write(struct device *tty, const void *buf, size_t len, size_t
return KERN_OK;
}
static void process_events(struct device *tty)
{
struct tty_device *ttydev = TTY_DEVICE(tty);
if (!ttydev->tty_ldisc || !ttydev->tty_ldisc->process_events) {
struct input_event ev;
while (ringbuffer_unread(&ttydev->tty_events)) {
ringbuffer_read(&ttydev->tty_events, sizeof ev, &ev, S_NOBLOCK);
}
return;
}
ttydev->tty_ldisc->process_events(tty);
}
kern_status_t tty_report_event(struct device *tty, const struct input_event *ev)
{
struct tty_device *ttydev = TTY_DEVICE(tty);
size_t w = ringbuffer_write(&ttydev->tty_events, sizeof *ev, ev, S_NOBLOCK);
if (w != sizeof *ev) {
return KERN_WOULD_BLOCK;
}
if (ringbuffer_unread(&ttydev->tty_events) > 0) {
process_events(tty);
if (ttydev->tty_ldisc || ttydev->tty_ldisc->write) {
ttydev->tty_ldisc->write(tty, ev);
}
return KERN_OK;