tty: remove tty event queues
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user